Skip to content

Vertex Model garden models #960

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

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

Vertex Model garden models #960

pedroallenrevez opened this issue Feb 21, 2025 · 8 comments
Assignees
Labels
Feature request New feature request

Comments

@pedroallenrevez
Copy link
Contributor

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
Contributor Author

LIke mistral and anthropic models through vertex

@pedroallenrevez
Copy link
Contributor 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]
                    )
                )

@ehaca
Copy link
Contributor

ehaca commented Apr 5, 2025

Hey I came looking for this one - is this something one can contribute to? Would be thrilled to help out if wanted/needed/possible :)

@ehaca
Copy link
Contributor

ehaca commented Apr 6, 2025

Hey, I had some ideas and couldn't help starting drafting: #1392 🙈

@Kludex
Copy link
Member

Kludex commented Apr 7, 2025

@ehaca The point here is that we need to use the AnthropicModel instead of the GeminiModel because the API followed is the one in AnthropicModel, right?

@Kludex Kludex added the Feature request New feature request label Apr 7, 2025
@ehaca
Copy link
Contributor

ehaca commented Apr 8, 2025

You can use Anthropic's models via Anthropic itself or via GCP/AWS. For the this, the SDK offers dedicated clients that handle auth etc. currently you can plug those clients into anthropic_client and it works, but yields typing errors. I tried just extending the existing Anthropic Provider, but since Anthropic's SDK has dedicated extras for the different clients it was kind of an import mess (?).

@avivex1000
Copy link

avivex1000 commented Apr 16, 2025

You can use Anthropic's models via Anthropic itself or via GCP/AWS. For the this, the SDK offers dedicated clients that handle auth etc. currently you can plug those clients into anthropic_client and it works, but yields typing errors. I tried just extending the existing Anthropic Provider, but since Anthropic's SDK has dedicated extras for the different clients it was kind of an import mess (?).

This comment saved me a lot of time, thanks 🙏🏻
Will be happy to see these supported properly in the sdk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request New feature request
Projects
None yet
Development

No branches or pull requests

4 participants