Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for OpenRouter with Gemini #1294

Open
lukyanov opened this issue Jan 4, 2025 · 1 comment
Open

Better support for OpenRouter with Gemini #1294

lukyanov opened this issue Jan 4, 2025 · 1 comment
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@lukyanov
Copy link

lukyanov commented Jan 4, 2025

I'm trying to use Instructor with OpenRouter. It works perfectly for OpenAI models, but I can't make it work for Gemini.
Maybe it actually works, but I couldn't figure out how to call Instructor in this case. The tricky part is that I need to use OpenAI client but with Gemini-specific modes.

The following does not work:

        client = instructor.from_openai(OpenAI(base_url="https://openrouter.ai/api/v1"), mode=instructor.Mode.TOOLS)
        response = ai_client.chat.completions.create(
            model="google/gemini-flash-1.5-8b",
            response_model=MyModel
            temperature=0.0,
            max_tokens=4096,
            messages=messages
        )

Changing the mode to instructor.Mode.GEMINI_TOOLS is not helping (failing because GEMINI_TOOLS is not OpenAI mode).

Am I right that my use case is currently not supported?

@github-actions github-actions bot added help wanted Extra attention is needed question Further information is requested labels Jan 4, 2025
@ivanleomk
Copy link
Collaborator

Hey @lukyanov could you provide some of the error messages that you're encountering with this?

Specifically, what Gemini modes are you using in this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants