Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Model interface

ModelTracing

Bases:Enum

Source code insrc/agents/models/interface.py
classModelTracing(enum.Enum):DISABLED=0"""Tracing is disabled entirely."""ENABLED=1"""Tracing is enabled, and all data is included."""ENABLED_WITHOUT_DATA=2"""Tracing is enabled, but inputs/outputs are not included."""defis_disabled(self)->bool:returnself==ModelTracing.DISABLEDdefinclude_data(self)->bool:returnself==ModelTracing.ENABLED

DISABLEDclass-attributeinstance-attribute

DISABLED=0

Tracing is disabled entirely.

ENABLEDclass-attributeinstance-attribute

ENABLED=1

Tracing is enabled, and all data is included.

ENABLED_WITHOUT_DATAclass-attributeinstance-attribute

ENABLED_WITHOUT_DATA=2

Tracing is enabled, but inputs/outputs are not included.

Model

Bases:ABC

The base interface for calling an LLM.

Source code insrc/agents/models/interface.py
classModel(abc.ABC):"""The base interface for calling an LLM."""@abc.abstractmethodasyncdefget_response(self,system_instructions:str|None,input:str|list[TResponseInputItem],model_settings:ModelSettings,tools:list[Tool],output_schema:AgentOutputSchemaBase|None,handoffs:list[Handoff],tracing:ModelTracing,*,previous_response_id:str|None,prompt:ResponsePromptParam|None,)->ModelResponse:"""Get a response from the model.        Args:            system_instructions: The system instructions to use.            input: The input items to the model, in OpenAI Responses format.            model_settings: The model settings to use.            tools: The tools available to the model.            output_schema: The output schema to use.            handoffs: The handoffs available to the model.            tracing: Tracing configuration.            previous_response_id: the ID of the previous response. Generally not used by the model,                except for the OpenAI Responses API.            prompt: The prompt config to use for the model.        Returns:            The full model response.        """pass@abc.abstractmethoddefstream_response(self,system_instructions:str|None,input:str|list[TResponseInputItem],model_settings:ModelSettings,tools:list[Tool],output_schema:AgentOutputSchemaBase|None,handoffs:list[Handoff],tracing:ModelTracing,*,previous_response_id:str|None,prompt:ResponsePromptParam|None,)->AsyncIterator[TResponseStreamEvent]:"""Stream a response from the model.        Args:            system_instructions: The system instructions to use.            input: The input items to the model, in OpenAI Responses format.            model_settings: The model settings to use.            tools: The tools available to the model.            output_schema: The output schema to use.            handoffs: The handoffs available to the model.            tracing: Tracing configuration.            previous_response_id: the ID of the previous response. Generally not used by the model,                except for the OpenAI Responses API.            prompt: The prompt config to use for the model.        Returns:            An iterator of response stream events, in OpenAI Responses format.        """pass

get_responseabstractmethodasync

get_response(system_instructions:str|None,input:str|list[TResponseInputItem],model_settings:ModelSettings,tools:list[Tool],output_schema:AgentOutputSchemaBase|None,handoffs:list[Handoff],tracing:ModelTracing,*,previous_response_id:str|None,prompt:ResponsePromptParam|None,)->ModelResponse

Get a response from the model.

Parameters:

NameTypeDescriptionDefault
system_instructionsstr | None

The system instructions to use.

required
inputstr |list[TResponseInputItem]

The input items to the model, in OpenAI Responses format.

required
model_settingsModelSettings

The model settings to use.

required
toolslist[Tool]

The tools available to the model.

required
output_schemaAgentOutputSchemaBase | None

The output schema to use.

required
handoffslist[Handoff]

The handoffs available to the model.

required
tracingModelTracing

Tracing configuration.

required
previous_response_idstr | None

the ID of the previous response. Generally not used by the model,except for the OpenAI Responses API.

required
promptResponsePromptParam | None

The prompt config to use for the model.

required

Returns:

TypeDescription
ModelResponse

The full model response.

Source code insrc/agents/models/interface.py
@abc.abstractmethodasyncdefget_response(self,system_instructions:str|None,input:str|list[TResponseInputItem],model_settings:ModelSettings,tools:list[Tool],output_schema:AgentOutputSchemaBase|None,handoffs:list[Handoff],tracing:ModelTracing,*,previous_response_id:str|None,prompt:ResponsePromptParam|None,)->ModelResponse:"""Get a response from the model.    Args:        system_instructions: The system instructions to use.        input: The input items to the model, in OpenAI Responses format.        model_settings: The model settings to use.        tools: The tools available to the model.        output_schema: The output schema to use.        handoffs: The handoffs available to the model.        tracing: Tracing configuration.        previous_response_id: the ID of the previous response. Generally not used by the model,            except for the OpenAI Responses API.        prompt: The prompt config to use for the model.    Returns:        The full model response.    """pass

stream_responseabstractmethod

stream_response(system_instructions:str|None,input:str|list[TResponseInputItem],model_settings:ModelSettings,tools:list[Tool],output_schema:AgentOutputSchemaBase|None,handoffs:list[Handoff],tracing:ModelTracing,*,previous_response_id:str|None,prompt:ResponsePromptParam|None,)->AsyncIterator[TResponseStreamEvent]

Stream a response from the model.

Parameters:

NameTypeDescriptionDefault
system_instructionsstr | None

The system instructions to use.

required
inputstr |list[TResponseInputItem]

The input items to the model, in OpenAI Responses format.

required
model_settingsModelSettings

The model settings to use.

required
toolslist[Tool]

The tools available to the model.

required
output_schemaAgentOutputSchemaBase | None

The output schema to use.

required
handoffslist[Handoff]

The handoffs available to the model.

required
tracingModelTracing

Tracing configuration.

required
previous_response_idstr | None

the ID of the previous response. Generally not used by the model,except for the OpenAI Responses API.

required
promptResponsePromptParam | None

The prompt config to use for the model.

required

Returns:

TypeDescription
AsyncIterator[TResponseStreamEvent]

An iterator of response stream events, in OpenAI Responses format.

Source code insrc/agents/models/interface.py
@abc.abstractmethoddefstream_response(self,system_instructions:str|None,input:str|list[TResponseInputItem],model_settings:ModelSettings,tools:list[Tool],output_schema:AgentOutputSchemaBase|None,handoffs:list[Handoff],tracing:ModelTracing,*,previous_response_id:str|None,prompt:ResponsePromptParam|None,)->AsyncIterator[TResponseStreamEvent]:"""Stream a response from the model.    Args:        system_instructions: The system instructions to use.        input: The input items to the model, in OpenAI Responses format.        model_settings: The model settings to use.        tools: The tools available to the model.        output_schema: The output schema to use.        handoffs: The handoffs available to the model.        tracing: Tracing configuration.        previous_response_id: the ID of the previous response. Generally not used by the model,            except for the OpenAI Responses API.        prompt: The prompt config to use for the model.    Returns:        An iterator of response stream events, in OpenAI Responses format.    """pass

ModelProvider

Bases:ABC

The base interface for a model provider.

Model provider is responsible for looking up Models by name.

Source code insrc/agents/models/interface.py
classModelProvider(abc.ABC):"""The base interface for a model provider.    Model provider is responsible for looking up Models by name.    """@abc.abstractmethoddefget_model(self,model_name:str|None)->Model:"""Get a model by name.        Args:            model_name: The name of the model to get.        Returns:            The model.        """

get_modelabstractmethod

get_model(model_name:str|None)->Model

Get a model by name.

Parameters:

NameTypeDescriptionDefault
model_namestr | None

The name of the model to get.

required

Returns:

TypeDescription
Model

The model.

Source code insrc/agents/models/interface.py
@abc.abstractmethoddefget_model(self,model_name:str|None)->Model:"""Get a model by name.    Args:        model_name: The name of the model to get.    Returns:        The model.    """

[8]ページ先頭

©2009-2025 Movatter.jp