Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pydantic_ai_slim/pydantic_ai/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,16 @@ class ModelTextResponse:

@dataclass
class ArgsJson:
"""Tool arguments as a JSON string."""

args_json: str
"""A JSON string of arguments."""


@dataclass
class ArgsDict:
"""Tool arguments as a Python dictionary."""

args_dict: dict[str, Any]
"""A python dictionary of arguments."""

Expand Down
4 changes: 4 additions & 0 deletions pydantic_ai_slim/pydantic_ai/models/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,15 @@ def name(self) -> str:


class AuthProtocol(Protocol):
"""Abstract definition for Gemini authentication."""

async def headers(self) -> dict[str, str]: ...


@dataclass
class ApiKeyAuth:
"""Authentication using an API key for the `X-Goog-Api-Key` header."""

api_key: str

async def headers(self) -> dict[str, str]:
Expand Down
12 changes: 4 additions & 8 deletions pydantic_ai_slim/pydantic_ai/models/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@
)


class UnSetType:
def __repr__(self):
return 'UnSet'


UnSet = UnSetType()


@dataclass
class TestModel(Model):
"""A model specifically for testing purposes.
Expand Down Expand Up @@ -186,6 +178,8 @@ def _request(self, messages: list[Message]) -> ModelAnyResponse:

@dataclass
class TestStreamTextResponse(StreamTextResponse):
"""A text response that streams test data."""

_text: str
_cost: Cost
_iter: Iterator[str] = field(init=False)
Expand Down Expand Up @@ -217,6 +211,8 @@ def timestamp(self) -> datetime:

@dataclass
class TestStreamStructuredResponse(StreamStructuredResponse):
"""A structured response that streams test data."""

_structured_response: ModelStructuredResponse
_cost: Cost
_iter: Iterator[None] = field(default_factory=lambda: iter([None]))
Expand Down
2 changes: 2 additions & 0 deletions pydantic_ai_slim/pydantic_ai/models/vertexai.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ async def _async_google_auth() -> tuple[BaseCredentials, str | None]:

@dataclass
class BearerTokenAuth:
"""Authentication using a bearer token generated by google-auth."""

credentials: BaseCredentials | ServiceAccountCredentials
token_created: datetime | None = field(default=None, init=False)

Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,11 @@ flake8-quotes = { inline-quotes = "single", multiline-quotes = "double" }
isort = { combine-as-imports = true, known-first-party = ["pydantic_ai"] }
mccabe = { max-complexity = 15 }
ignore = [
"D101", # ignore missing docstring in public class TODO remove
"D102", # ignore missing docstring in public method TODO remove
"D107", # ignore missing docstring in __init__ methods
"D100", # ignore missing docstring in module
"D102", # ignore missing docstring in public method
"D104", # ignore missing docstring in public package
"D105", # ignore missing docstring in magic methods
"D107", # ignore missing docstring in __init__ methods
]

[tool.ruff.lint.pydocstyle]
Expand All @@ -107,7 +106,7 @@ quote-style = "single"
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["D"]
"docs/**/*.py" = ["D"]
"pydantic_ai_examples/**/*.py" = ["D103"]
"pydantic_ai_examples/**/*.py" = ["D101", "D103"]

[tool.pyright]
typeCheckingMode = "strict"
Expand Down