pydantic-ai icon indicating copy to clipboard operation
pydantic-ai copied to clipboard

Sambanova models support

Open jhpiedrahitao opened this issue 1 year ago • 4 comments

PR implementing SambaNovaModel and allowing access to SambaNovaCloudModels. includes, model, base tests and docs

jhpiedrahitao avatar Dec 11 '24 17:12 jhpiedrahitao

Hi @jhpiedrahitao, I've never heard of Sambanova. Please can you start by creating an issue and see if we get significant interest from the community, before we consider adding this to pydantic-ai itself.

Alternatively if you want to use or even distribute this without waiting, you can always create a new package, e.g. pyantic-ai-sambanova which has pydantic-ai as a dependency, and exposes SambaNovaModel.

samuelcolvin avatar Dec 11 '24 17:12 samuelcolvin

Hi @jhpiedrahitao, I've never heard of Sambanova. Please can you start by creating an issue and see if we get significant interest from the community, before we consider adding this to pydantic-ai itself.

we've got a number of sambanova provided models at openrouter, and there is support for that already in pydantic-ai

i actually just saw this recent issue, after hearing users ask if it works with our services: https://github.com/pydantic/pydantic-ai/issues/139

would you be open to a quick docs pr adding another example at the end of here?

from openai import AsyncOpenAI

from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIModel

client = AsyncOpenAI(
  base_url='https://openrouter.ai/api/v1',
  api_key='your-api-key',
)
model = OpenAIModel('anthropic/claude-3.5-sonnet', openai_client=client)
agent = Agent(model)
...

we're considering making pydantic-ai the default in our quickstart docs as well, considering a lot of people really love the devx so far

sambarnes avatar Dec 11 '24 18:12 sambarnes

Hi @jhpiedrahitao, I've never heard of Sambanova. Please can you start by creating an issue and see if we get significant interest from the community, before we consider adding this to pydantic-ai itself.

Alternatively if you want to use or even distribute this without waiting, you can always create a new package, e.g. pyantic-ai-sambanova which has pydantic-ai as a dependency, and exposes SambaNovaModel.

Hi @samuelcolvin I created the issue here https://github.com/pydantic/pydantic-ai/issues/218

You can find more information here https://sambanova.ai/ also in the issue linked to artificial analysis providers leader board, where you can see SambaNova being on top for several models

jhpiedrahitao avatar Dec 11 '24 18:12 jhpiedrahitao

@sambarnes definitely happy to add that example to the docs. I also think we could add base_url as a kwarg to OpenAIModel so you can simplify it to just

model = OpenAIModel(
    'anthropic/claude-3.5-sonnet',
  base_url='https://openrouter.ai/api/v1',
  api_key='your-api-key',
)

PR welcome to add that.

samuelcolvin avatar Dec 12 '24 11:12 samuelcolvin

Closing as per https://github.com/pydantic/pydantic-ai/issues/218#issuecomment-2543169564

samuelcolvin avatar Dec 14 '24 16:12 samuelcolvin