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: object

Represents 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: object

Represents a partial update in a streaming chat response.

content: str | List[TextPart | ImagePart]

The text content of the chat delta.

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: object

Represents 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: object

Represents 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.

Type:

gen_ai_hub.orchestration.models.message.Message

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.

message: Message

The message object containing the role and content of the response.

finish_reason: str

The reason why the model stopped generating tokens.

logprobs: Dict[str, float] | None = None

Optional dictionary containing token log probabilities.

__init__(index: int, message: Message, finish_reason: str, logprobs: Dict[str, float] | None = None) None
class gen_ai_hub.orchestration.models.response.LLMChoiceStreaming(index: int, delta: ChatDelta, finish_reason: str | None = None, logprobs: Dict[str, float] | None = None)

Bases: object

Represents 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.

Type:

gen_ai_hub.orchestration.models.response.ChatDelta

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.

delta: ChatDelta

The partial update (ChatDelta) for this choice.

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.

__init__(index: int, delta: ChatDelta, finish_reason: str | None = None, logprobs: Dict[str, float] | None = None) None
class gen_ai_hub.orchestration.models.response.BaseLLMResult(id: str, object: str, created: int, model: str)

Bases: object

Base 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: BaseLLMResult

Represents 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.

Type:

List[gen_ai_hub.orchestration.models.response.LLMChoice]

usage

The token usage statistics for this operation.

Type:

gen_ai_hub.orchestration.models.response.LLMUsage

system_fingerprint

An optional system fingerprint for tracking the model used.

Type:

str | None

choices: List[LLMChoice]

A list of possible choices generated by the LLM.

usage: LLMUsage

The token usage statistics for this operation.

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[LLMChoice], usage: LLMUsage, system_fingerprint: str | None = None) None
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: BaseLLMResult

Represents 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.

Type:

List[gen_ai_hub.orchestration.models.response.LLMChoiceStreaming]

usage

optional token usage statistics for this operation.

Type:

gen_ai_hub.orchestration.models.response.LLMUsage | None

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.

usage: LLMUsage | None = None

optional token usage statistics for this operation.

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: object

Represents 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: object

Base class for module results containing grounding, common filtering and masking attributes.

input_filtering

Results from the input filtering module.

Type:

gen_ai_hub.orchestration.models.response.GenericModuleResult | None

output_filtering

Results from the output filtering module.

Type:

gen_ai_hub.orchestration.models.response.GenericModuleResult | None

input_masking

Results from the input masking module.

Type:

gen_ai_hub.orchestration.models.response.GenericModuleResult | None

grounding

A list of extracted text to be provided as grounding context.

Type:

gen_ai_hub.orchestration.models.response.GenericModuleResult | None

input_translation

Results from the input translation module.

Type:

gen_ai_hub.orchestration.models.response.GenericModuleResult | None

output_translation

Results from the output translation module.

Type:

gen_ai_hub.orchestration.models.response.GenericModuleResult | 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) 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: BaseModuleResults

Represents 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:

gen_ai_hub.orchestration.models.response.LLMResult | None

input_filtering

The result of any input filtering, if applicable.

Type:

gen_ai_hub.orchestration.models.response.GenericModuleResult | None

output_filtering

The result of any output filtering, if applicable.

Type:

gen_ai_hub.orchestration.models.response.GenericModuleResult | None

input_masking

The result of input masking, if applicable.

Type:

gen_ai_hub.orchestration.models.response.GenericModuleResult | None

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
llm: LLMResult | None = None

The result from the LLM operation.

templating: List[Message] | None = None

A list of messages that define the conversation’s context or template.

output_unmasking: List[LLMChoice] | None = None

The result of output unmasking, if applicable.

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: BaseModuleResults

Represents the streaming results of various modules used in processing an orchestration request.

llm

The streaming result from the LLM operation.

Type:

gen_ai_hub.orchestration.models.response.LLMResultStreaming | None

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.

Type:

gen_ai_hub.orchestration.models.response.GenericModuleResult | None

output_filtering

The result of any output filtering, if applicable.

Type:

gen_ai_hub.orchestration.models.response.GenericModuleResult | None

input_masking

The result of input masking, if applicable.

Type:

gen_ai_hub.orchestration.models.response.GenericModuleResult | None

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: object

Represents 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.

Type:

gen_ai_hub.orchestration.models.response.ModuleResults

orchestration_result

The final result from the orchestration, typically mirroring the LLM result.

Type:

gen_ai_hub.orchestration.models.response.LLMResult

__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: object

Represents 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.

Type:

gen_ai_hub.orchestration.models.response.ModuleResultsStreaming

orchestration_result

The streaming result from the orchestration.

Type:

gen_ai_hub.orchestration.models.response.LLMResultStreaming

__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: OrchestrationResponse

Extended 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.