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

Vertex Model garden models #960

Open
pedroallenrevez opened this issue Feb 21, 2025 · 3 comments
Open

Vertex Model garden models #960

pedroallenrevez opened this issue Feb 21, 2025 · 3 comments
Assignees

Comments

@pedroallenrevez
Copy link

Is it possible to use other models in the vertex model garden, or is it just gemini models through vertex?

@Kludex
Copy link
Member

Kludex commented Feb 21, 2025

Do you have a reference to which models are you referring to?

@Kludex Kludex self-assigned this Feb 21, 2025
@pedroallenrevez
Copy link
Author

LIke mistral and anthropic models through vertex

@pedroallenrevez
Copy link
Author

Ok @Kludex, basically you can use the already existing models, but with the vertex counterpart clients of the mistral and anthropic packages.

Feels really silly that there is no docs for this.
There are typing errors, but (mostly) it works.

            if "mistral" in model.identity.id:
                import sys
                from mistralai_gcp.models.usermessage import UserMessage as MistralUserMessage
                sys.modules['pydantic_ai.models.mistral'].MistralUserMessage = MistralUserMessage

                from mistralai_gcp import MistralGoogleCloud
                self._pydantic_model = MistralModel(
                    model.extra['pydantic_ai_alias'],
                    client=MistralGoogleCloud(
                        project_id=provider.project_id, 
                        region=provider.locations[0]
                    ),
                )
            elif "claude" in model.identity.id:
                from anthropic import AsyncAnthropicVertex
                self._pydantic_model = AnthropicModel(
                    model.extra["pydantic_ai_alias"],
                    anthropic_client=AsyncAnthropicVertex(
                        project_id=provider.project_id,
                        region=provider.locations[0]
                    )
                )

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

No branches or pull requests

2 participants