gen_ai_hub.orchestration.models.response module¶
- class gen_ai_hub.orchestration.models.response.ToolCallChunk(index: int, id: str | None = None, type: str | None = None, function: FunctionCall | None = None)¶
Bases:
objectRepresents a chunk of a tool call in a streaming chat response.
- index: int¶
The index of this tool call chunk in the sequence of chunks.
- id: str | None = None¶
The unique identifier for the tool call.
- type: str | None = None¶
The type of tool call, e.g., ‘function’ .
- function: FunctionCall | None = None¶
The function call details associated with this tool call chunk.
- __init__(index: int, id: str | None = None, type: str | None = None, function: FunctionCall | None = None) None¶
- class gen_ai_hub.orchestration.models.response.ChatDelta(content: str | List[TextPart | ImagePart], role: str | None = None, refusal: str | None = None, tool_calls: List[ToolCallChunk] | None = None)¶
Bases:
objectRepresents a partial update in a streaming chat response.
- role: str | None = None¶
Optional role identifier (e.g., ‘assistant’, ‘user’) for the message delta.
- refusal: str | None = None¶
Optional refusal reason if the model refused to generate content.
- tool_calls: List[ToolCallChunk] | None = None¶
Optional list of tool call chunks associated with this chat delta.
- __init__(content: str | List[TextPart | ImagePart], role: str | None = None, refusal: str | None = None, tool_calls: List[ToolCallChunk] | None = None) None¶
- class gen_ai_hub.orchestration.models.response.LLMUsage(completion_tokens: int, prompt_tokens: int, total_tokens: int)¶
Bases:
objectRepresents the token usage statistics for an LLM (Large Language Model) operation.
- completion_tokens: int¶
The number of tokens generated by the model in the response.
- prompt_tokens: int¶
The number of tokens in the input prompt.
- total_tokens: int¶
The total number of tokens used, including both prompt and completion tokens.
- __init__(completion_tokens: int, prompt_tokens: int, total_tokens: int) None¶
- class gen_ai_hub.orchestration.models.response.LLMChoice(index: int, message: Message, finish_reason: str, logprobs: Dict[str, float] | None = None)¶
Bases:
objectRepresents an individual choice or response generated by the LLM.
- index¶
The index of this particular choice in the list of possible choices.
- Type:
int
- message¶
The message object containing the role and content of the response.
- finish_reason¶
The reason why the model stopped generating tokens.
- Type:
str
- logprobs¶
Optional dictionary containing token log probabilities.
- Type:
Dict[str, float] | None
- index: int¶
The index of this particular choice in the list of possible choices.
- finish_reason: str¶
The reason why the model stopped generating tokens.
- logprobs: Dict[str, float] | None = None¶
Optional dictionary containing token log probabilities.
- class gen_ai_hub.orchestration.models.response.LLMChoiceStreaming(index: int, delta: ChatDelta, finish_reason: str | None = None, logprobs: Dict[str, float] | None = None)¶
Bases:
objectRepresents a streaming choice or partial response generated by the LLM.
- index¶
The index of this particular choice in the list of possible choices.
- Type:
int
- delta¶
The partial update (ChatDelta) for this choice.
- finish_reason¶
Optional reason for why the generation stopped, may be None during streaming.
- Type:
str | None
- logprobs¶
Optional dictionary containing token log probabilities.
- Type:
Dict[str, float] | None
- index: int¶
The index of this particular choice in the list of possible choices.
- finish_reason: str | None = None¶
Optional reason for why the generation stopped, may be None during streaming.
- logprobs: Dict[str, float] | None = None¶
Optional dictionary containing token log probabilities.
- class gen_ai_hub.orchestration.models.response.BaseLLMResult(id: str, object: str, created: int, model: str)¶
Bases:
objectBase class for LLM results containing common attributes.
- id¶
Unique identifier for the LLM operation.
- Type:
str
- object¶
Type of object returned (e.g., “chat.completion”).
- Type:
str
- created¶
Timestamp when this result was created.
- Type:
int
- model¶
Name or identifier of the model used.
- Type:
str
- id: str¶
- object: str¶
- created: int¶
- model: str¶
- __init__(id: str, object: str, created: int, model: str) None¶
- class gen_ai_hub.orchestration.models.response.LLMResult(id: str, object: str, created: int, model: str, choices: List[LLMChoice], usage: LLMUsage, system_fingerprint: str | None = None)¶
Bases:
BaseLLMResultRepresents the complete result from an LLM operation.
- id¶
The unique identifier for this LLM operation.
- Type:
str
- object¶
The type of object returned (typically “chat.completion”).
- Type:
str
- created¶
The timestamp when this result was created.
- Type:
int
- model¶
The name or identifier of the model used for generating the result.
- Type:
str
- choices¶
A list of possible choices generated by the LLM.
- usage¶
The token usage statistics for this operation.
- system_fingerprint¶
An optional system fingerprint for tracking the model used.
- Type:
str | None
- system_fingerprint: str | None = None¶
An optional system fingerprint for tracking the model used.
- class gen_ai_hub.orchestration.models.response.LLMResultStreaming(id: str, object: str, created: int, model: str, choices: List[LLMChoiceStreaming], usage: LLMUsage | None = None, system_fingerprint: str | None = None)¶
Bases:
BaseLLMResultRepresents a streaming result from an LLM operation.
- id¶
The unique identifier for this LLM operation.
- Type:
str
- object¶
The type of object returned (typically “chat.completion.chunk”).
- Type:
str
- created¶
The timestamp when this result was created.
- Type:
int
- model¶
The name or identifier of the model used.
- Type:
str
- choices¶
A list of streaming choices generated by the LLM.
- usage¶
optional token usage statistics for this operation.
- Type:
- system_fingerprint¶
An optional system fingerprint for tracking the model used.
- Type:
str | None
- choices: List[LLMChoiceStreaming]¶
A list of streaming choices generated by the LLM.
- system_fingerprint: str | None = None¶
An optional system fingerprint for tracking the model used.
- __init__(id: str, object: str, created: int, model: str, choices: List[LLMChoiceStreaming], usage: LLMUsage | None = None, system_fingerprint: str | None = None) None¶
- class gen_ai_hub.orchestration.models.response.GenericModuleResult(message: str, data: Dict[str, Any] | None = None)¶
Bases:
objectRepresents a generic module result in the orchestration process.
- message: str¶
A message or description generated by the module.
- __init__(message: str, data: Dict[str, Any] | None = None) None¶
- data: Dict[str, Any] | None = None¶
Additional data relevant to the module result.
- class gen_ai_hub.orchestration.models.response.BaseModuleResults(input_filtering: GenericModuleResult | None = None, output_filtering: GenericModuleResult | None = None, input_masking: GenericModuleResult | None = None, grounding: GenericModuleResult | None = None, input_translation: GenericModuleResult | None = None, output_translation: GenericModuleResult | None = None)¶
Bases:
objectBase class for module results containing grounding, common filtering and masking attributes.
- input_filtering¶
Results from the input filtering module.
- output_filtering¶
Results from the output filtering module.
- input_masking¶
Results from the input masking module.
- grounding¶
A list of extracted text to be provided as grounding context.
- input_translation¶
Results from the input translation module.
- output_translation¶
Results from the output translation module.
- __init__(input_filtering: GenericModuleResult | None = None, output_filtering: GenericModuleResult | None = None, input_masking: GenericModuleResult | None = None, grounding: GenericModuleResult | None = None, input_translation: GenericModuleResult | None = None, output_translation: GenericModuleResult | None = None) None¶
- input_filtering: GenericModuleResult | None = None¶
Results from the input filtering module.
- output_filtering: GenericModuleResult | None = None¶
Results from the output filtering module.
- input_masking: GenericModuleResult | None = None¶
Results from the input masking module.
- grounding: GenericModuleResult | None = None¶
A list of extracted text to be provided as grounding context.
- input_translation: GenericModuleResult | None = None¶
Results from the input translation module.
- output_translation: GenericModuleResult | None = None¶
Results from the output translation module.
- class gen_ai_hub.orchestration.models.response.ModuleResults(input_filtering: GenericModuleResult | None = None, output_filtering: GenericModuleResult | None = None, input_masking: GenericModuleResult | None = None, grounding: GenericModuleResult | None = None, input_translation: GenericModuleResult | None = None, output_translation: GenericModuleResult | None = None, llm: LLMResult | None = None, templating: List[Message] | None = None, output_unmasking: List[LLMChoice] | None = None)¶
Bases:
BaseModuleResultsRepresents the results of various modules used in processing an orchestration request.
- templating¶
A list of messages that define the conversation’s context or template.
- Type:
List[gen_ai_hub.orchestration.models.message.Message] | None
- llm¶
The result from the LLM operation.
- Type:
- input_filtering¶
The result of any input filtering, if applicable.
- output_filtering¶
The result of any output filtering, if applicable.
- input_masking¶
The result of input masking, if applicable.
- output_unmasking¶
The result of output unmasking, if applicable.
- Type:
List[gen_ai_hub.orchestration.models.response.LLMChoice] | None
- __init__(input_filtering: GenericModuleResult | None = None, output_filtering: GenericModuleResult | None = None, input_masking: GenericModuleResult | None = None, grounding: GenericModuleResult | None = None, input_translation: GenericModuleResult | None = None, output_translation: GenericModuleResult | None = None, llm: LLMResult | None = None, templating: List[Message] | None = None, output_unmasking: List[LLMChoice] | None = None) None¶
- class gen_ai_hub.orchestration.models.response.ModuleResultsStreaming(input_filtering: GenericModuleResult | None = None, output_filtering: GenericModuleResult | None = None, input_masking: GenericModuleResult | None = None, grounding: GenericModuleResult | None = None, input_translation: GenericModuleResult | None = None, output_translation: GenericModuleResult | None = None, llm: LLMResultStreaming | None = None, templating: List[ChatDelta] | None = None, output_unmasking: List[LLMChoiceStreaming] | None = None)¶
Bases:
BaseModuleResultsRepresents the streaming results of various modules used in processing an orchestration request.
- llm¶
The streaming result from the LLM operation.
- templating¶
A list of chat deltas that define the conversation’s context or template.
- Type:
List[gen_ai_hub.orchestration.models.response.ChatDelta] | None
- input_filtering¶
The result of any input filtering, if applicable.
- output_filtering¶
The result of any output filtering, if applicable.
- input_masking¶
The result of input masking, if applicable.
- output_unmasking¶
The result of output unmasking for streaming responses.
- Type:
List[gen_ai_hub.orchestration.models.response.LLMChoiceStreaming] | None
- __init__(input_filtering: GenericModuleResult | None = None, output_filtering: GenericModuleResult | None = None, input_masking: GenericModuleResult | None = None, grounding: GenericModuleResult | None = None, input_translation: GenericModuleResult | None = None, output_translation: GenericModuleResult | None = None, llm: LLMResultStreaming | None = None, templating: List[ChatDelta] | None = None, output_unmasking: List[LLMChoiceStreaming] | None = None) None¶
- llm: LLMResultStreaming | None = None¶
The streaming result from the LLM operation.
- templating: List[ChatDelta] | None = None¶
A list of chat deltas that define the conversation’s context or template.
- output_unmasking: List[LLMChoiceStreaming] | None = None¶
The result of output unmasking for streaming responses.
- class gen_ai_hub.orchestration.models.response.OrchestrationResponse(request_id: str, module_results: ModuleResults, orchestration_result: LLMResult)¶
Bases:
objectRepresents the complete response from an orchestration process.
- request_id¶
The unique identifier for the request being processed.
- Type:
str
- module_results¶
The results from the various modules involved in processing the request.
- orchestration_result¶
The final result from the orchestration, typically mirroring the LLM result.
- __init__(request_id: str, module_results: ModuleResults, orchestration_result: LLMResult) None¶
- request_id: str¶
The unique identifier for the request being processed.
- module_results: ModuleResults¶
The results from the various modules involved in processing the request.
- orchestration_result: LLMResult¶
The final result from the orchestration, typically mirroring the LLM result.
- property content: str¶
Gets the content of the first choice in the orchestration result.
- Raises:
ValueError – If there are no choices available in the orchestration result.
- Returns:
The content of the first choice.
- Return type:
str
- class gen_ai_hub.orchestration.models.response.OrchestrationResponseStreaming(request_id: str, module_results: ModuleResultsStreaming, orchestration_result: LLMResultStreaming)¶
Bases:
objectRepresents the streaming response from an orchestration process.
- request_id¶
The unique identifier for the request being processed.
- Type:
str
- module_results¶
The streaming results from the various modules involved in processing the request.
- orchestration_result¶
The streaming result from the orchestration.
- __init__(request_id: str, module_results: ModuleResultsStreaming, orchestration_result: LLMResultStreaming) None¶
- request_id: str¶
The unique identifier for the request being processed.
- module_results: ModuleResultsStreaming¶
The streaming results from the various modules involved in processing the request.
- orchestration_result: LLMResultStreaming¶
The streaming result from the orchestration.
- class gen_ai_hub.orchestration.models.response.OrchestrationResponseWithRetries(request_id: str, module_results: ModuleResults, orchestration_result: LLMResult, retries: int = 0)¶
Bases:
OrchestrationResponseExtended OrchestrationResponse that includes retry count information.
This is returned when using retry-enabled methods like run_with_retries().
- retries¶
Number of retry attempts that were made to successfully complete this request.
- Type:
int
- __init__(request_id: str, module_results: ModuleResults, orchestration_result: LLMResult, retries: int = 0) None¶
- retries: int = 0¶
Number of retry attempts that were made to successfully complete this request.