Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Fix output_json with custom OpenAI APIs

Fixes #2282

Problem

When using custom OpenAI-compatible APIs like Open-WebUI with Ollama, tasks with output_json fail with the error "Instructor does not support multiple tool calls, use List[Model] instead."

Solution

  • Modified InternalInstructor to use PARALLEL_TOOLS mode when dealing with custom OpenAI APIs
  • Added handling for list responses from the instructor library
  • Added tests to verify the fix

Testing

  • Added unit tests for the InternalInstructor class
  • Verified that the fix works with mocked custom OpenAI responses
  • Ran the full test suite to ensure no regressions

Link to Devin run: https://app.devin.ai/sessions/b7c7b68175c647acb3a0d58e19ce6e97
Requested by: Joe Moura (joao@crewai.com)

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration
Copy link
Contributor Author

Closing due to inactivity for more than 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] output_json not working with custom_openai

1 participant