-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Allow proper type on AnthropicProvider
when using Bedrock
#2490
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
Changes from 11 commits
b856c3a
20a8451
aa939f1
c10c059
546e824
9b84bcd
0fb8f3a
cc388ed
4f4836d
a1ec18f
4f2dbc1
4ceb1fe
2f2ad75
1278d1e
235d3ac
5274084
60584d5
346788c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -37,12 +37,13 @@ | |||||
) | ||||||
from ..profiles import ModelProfileSpec | ||||||
from ..providers import Provider, infer_provider | ||||||
from ..providers.anthropic import AsyncAnthropicClient | ||||||
from ..settings import ModelSettings | ||||||
from ..tools import ToolDefinition | ||||||
from . import Model, ModelRequestParameters, StreamedResponse, check_allow_model_requests, download_item, get_user_agent | ||||||
|
||||||
try: | ||||||
from anthropic import NOT_GIVEN, APIStatusError, AsyncAnthropic, AsyncStream | ||||||
from anthropic import NOT_GIVEN, APIStatusError, AsyncStream | ||||||
from anthropic.types.beta import ( | ||||||
BetaBase64PDFBlockParam, | ||||||
BetaBase64PDFSourceParam, | ||||||
|
@@ -134,7 +135,7 @@ class AnthropicModel(Model): | |||||
Apart from `__init__`, all methods are private or match those of the base class. | ||||||
""" | ||||||
|
||||||
client: AsyncAnthropic = field(repr=False) | ||||||
client: AsyncAnthropicClient = field(repr=False) | ||||||
|
||||||
_model_name: AnthropicModelName = field(repr=False) | ||||||
_system: str = field(default='anthropic', repr=False) | ||||||
|
@@ -143,7 +144,7 @@ def __init__( | |||||
self, | ||||||
model_name: AnthropicModelName, | ||||||
*, | ||||||
provider: Literal['anthropic'] | Provider[AsyncAnthropic] = 'anthropic', | ||||||
provider: Literal['anthropic'] | Provider[AsyncAnthropicClient] = 'anthropic', | ||||||
profile: ModelProfileSpec | None = None, | ||||||
settings: ModelSettings | None = None, | ||||||
): | ||||||
|
@@ -153,7 +154,7 @@ def __init__( | |||||
model_name: The name of the Anthropic model to use. List of model names available | ||||||
[here](https://docs.anthropic.com/en/docs/about-claude/models). | ||||||
provider: The provider to use for the Anthropic API. Can be either the string 'anthropic' or an | ||||||
instance of `Provider[AsyncAnthropic]`. If not provided, the other parameters will be used. | ||||||
instance of `Provider[ASYNC_ANTHROPIC_CLIENT]`. If not provided, the other parameters will be used. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
profile: The model profile to use. Defaults to a profile picked by the provider based on the model name. | ||||||
settings: Default model settings for this model instance. | ||||||
""" | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ | |
|
||
from pydantic_ai.providers.anthropic import AnthropicProvider | ||
from pydantic_ai.providers.azure import AzureProvider | ||
from pydantic_ai.providers.cohere import CohereProvider | ||
from pydantic_ai.providers.deepseek import DeepSeekProvider | ||
from pydantic_ai.providers.fireworks import FireworksProvider | ||
from pydantic_ai.providers.github import GitHubProvider | ||
|
@@ -35,7 +34,6 @@ | |
|
||
test_infer_provider_params = [ | ||
('anthropic', AnthropicProvider, 'ANTHROPIC_API_KEY'), | ||
('cohere', CohereProvider, 'CO_API_KEY'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you remove this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Accidentally removed this line, fixed |
||
('deepseek', DeepSeekProvider, 'DEEPSEEK_API_KEY'), | ||
('openrouter', OpenRouterProvider, 'OPENROUTER_API_KEY'), | ||
('vercel', VercelProvider, 'VERCEL_AI_GATEWAY_API_KEY'), | ||
|
Uh oh!
There was an error while loading. Please reload this page.