Skip to content

Commit b46da6e

Browse files
committed
integ tests
1 parent 03e6f00 commit b46da6e

File tree

2 files changed

+77
-215
lines changed

2 files changed

+77
-215
lines changed

src/strands/models/gemini.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
from ..types.content import ContentBlock, Messages
1616
from ..types.exceptions import ModelThrottledException
1717
from ..types.streaming import StreamEvent
18-
from ..types.tools import ToolSpec
19-
from ._config_validation import validate_config_keys
18+
from ..types.tools import ToolChoice, ToolSpec
19+
from ._validation import validate_config_keys
2020
from .model import Model
2121

2222
logger = logging.getLogger(__name__)
@@ -91,7 +91,7 @@ def get_config(self) -> GeminiConfig:
9191
def _format_request_content_part(self, content: ContentBlock) -> genai.types.Part:
9292
"""Format content block into a Gemini part instance.
9393
94-
- Docs: https://ai.google.dev/api/caching#Part
94+
- Docs: https://googleapis.github.io/python-genai/genai.html#genai.types.Part
9595
9696
Args:
9797
content: Message content to format.
@@ -156,7 +156,7 @@ def _format_request_content_part(self, content: ContentBlock) -> genai.types.Par
156156
def _format_request_content(self, messages: Messages) -> list[genai.types.Content]:
157157
"""Format message content into Gemini content instances.
158158
159-
- Docs: https://ai.google.dev/api/caching#Content
159+
- Docs: https://googleapis.github.io/python-genai/genai.html#genai.types.Content
160160
161161
Args:
162162
messages: List of message objects to be processed by the model.
@@ -175,7 +175,7 @@ def _format_request_content(self, messages: Messages) -> list[genai.types.Conten
175175
def _format_request_tools(self, tool_specs: Optional[list[ToolSpec]]) -> list[genai.types.Tool | Any]:
176176
"""Format tool specs into Gemini tools.
177177
178-
- Docs: https://ai.google.dev/api/caching#Tool
178+
- Docs: https://googleapis.github.io/python-genai/genai.html#genai.types.Tool
179179
180180
Args:
181181
tool_specs: List of tool specifications to make available to the model.
@@ -203,6 +203,8 @@ def _format_request_config(
203203
) -> genai.types.GenerateContentConfig:
204204
"""Format Gemini request config.
205205
206+
- Docs: https://googleapis.github.io/python-genai/genai.html#genai.types.GenerateContentConfig
207+
206208
Args:
207209
tool_specs: List of tool specifications to make available to the model.
208210
system_prompt: System prompt to provide context to the model.
@@ -335,6 +337,7 @@ async def stream(
335337
messages: Messages,
336338
tool_specs: Optional[list[ToolSpec]] = None,
337339
system_prompt: Optional[str] = None,
340+
tool_choice: ToolChoice | None = None,
338341
**kwargs: Any,
339342
) -> AsyncGenerator[StreamEvent, None]:
340343
"""Stream conversation with the Gemini model.
@@ -343,6 +346,8 @@ async def stream(
343346
messages: List of message objects to be processed by the model.
344347
tool_specs: List of tool specifications to make available to the model.
345348
system_prompt: System prompt to provide context to the model.
349+
tool_choice: Selection strategy for tool invocation.
350+
Note: Currently unused.
346351
**kwargs: Additional keyword arguments for future extensibility.
347352
348353
Yields:

0 commit comments

Comments
 (0)