Skip to content
Merged
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
16 changes: 12 additions & 4 deletions docs/user-guide/concepts/model-providers/custom_model_provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,16 @@ The `stream` method accepts three parameters directly:
self,
messages: Messages,
tool_specs: Optional[list[ToolSpec]] = None,
system_prompt: Optional[str] = None
system_prompt: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[StreamEvent]:
"""Stream responses from the Custom model.

Args:
messages: List of conversation messages
tool_specs: Optional list of available tools
system_prompt: Optional system prompt
**kwargs: Additional keyword arguments for future extensibility

Returns:
Iterator of StreamEvent objects
Expand Down Expand Up @@ -330,15 +332,21 @@ T = TypeVar('T', bound=BaseModel)

@override
async def structured_output(
self, output_model: Type[T], prompt: Messages
self, output_model: Type[T], prompt: Messages, **kwargs: Any
) -> Generator[dict[str, Union[T, Any]], None, None]:
"""Get structured output using tool calling."""
"""Get structured output using tool calling.

Args:
output_model: The output model to use for the agent.
prompt: The prompt messages to use for the agent.
**kwargs: Additional keyword arguments for future extensibility.
"""

# Convert Pydantic model to tool specification
tool_spec = convert_pydantic_to_tool_spec(output_model)

# Use the stream method with tool specification
response = await self.stream(messages=prompt, tool_specs=[tool_spec])
response = await self.stream(messages=prompt, tool_specs=[tool_spec], **kwargs)

# Process streaming response
async for event in process_stream(response, prompt):
Expand Down