aiq.data_models.api_server#
Attributes#
Classes#
AIQChatRequest is a data model that represents a request to the AgentIQ chat API. |
|
AIQChatResponseSerializable is an abstract class that defines the interface for serializing output for the AgentIQ |
|
AIQChatResponse is a data model that represents a response from the AgentIQ chat API. |
|
AIQChatResponseChunk is a data model that represents a response chunk from the AgentIQ chat streaming API. |
|
AIQResponseSerializedStep is a data model that represents a serialized step in the AgentIQ chat streaming API. |
|
str(object='') -> str |
|
ChatContentType is an Enum that represents the type of Chat content. |
|
WebSocketMessageType is an Enum that represents WebSocket Message types. |
|
WorkflowSchemaType is an Enum that represents Workkflow response types. |
|
WebSocketMessageStatus is an Enum that represents the status of a WebSocket message. |
|
str(object='') -> str |
|
For more details, refer to the API documentation: |
|
For more details, refer to the API documentation: |
|
For more details, refer to the API documentation: |
|
For more details, refer to the API documentation: |
|
For more details, refer to the API documentation: |
Functions#
|
|
|
|
|
|
|
|
|
|
|
Converts a string to an AIQChatResponse object |
|
Converts a string to an AIQChatResponseChunk object |
Module Contents#
- class AIQChatRequest(/, **data: Any)#
Bases:
pydantic.BaseModel
AIQChatRequest is a data model that represents a request to the AgentIQ chat API.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- class AIQChoiceMessage(/, **data: Any)#
Bases:
pydantic.BaseModel
- class AIQChoice(/, **data: Any)#
Bases:
pydantic.BaseModel
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- message: AIQChoiceMessage#
- class AIQUsage(/, **data: Any)#
Bases:
pydantic.BaseModel
- class AIQResponseSerializable#
Bases:
abc.ABC
AIQChatResponseSerializable is an abstract class that defines the interface for serializing output for the AgentIQ chat streaming API.
- class AIQResponseBaseModelOutput(/, **data: Any)#
Bases:
pydantic.BaseModel
,AIQResponseSerializable
- class AIQResponseBaseModelIntermediate(/, **data: Any)#
Bases:
pydantic.BaseModel
,AIQResponseSerializable
- class AIQChatResponse(/, **data: Any)#
Bases:
AIQResponseBaseModelOutput
AIQChatResponse is a data model that represents a response from the AgentIQ chat API.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- created: datetime.datetime#
- class AIQChatResponseChunk(/, **data: Any)#
Bases:
AIQResponseBaseModelOutput
AIQChatResponseChunk is a data model that represents a response chunk from the AgentIQ chat streaming API.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- created: datetime.datetime#
- class AIQResponseIntermediateStep(/, **data: Any)#
Bases:
AIQResponseBaseModelIntermediate
AIQResponseSerializedStep is a data model that represents a serialized step in the AgentIQ chat streaming API.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- class AIQResponsePayloadOutput(/, **data: Any)#
Bases:
pydantic.BaseModel
,AIQResponseSerializable
- payload: Any#
- class AIQGenerateResponse(/, **data: Any)#
Bases:
pydantic.BaseModel
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- class UserMessageContentRoleType#
-
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
Initialize self. See help(type(self)) for accurate signature.
- USER = 'user'#
- ASSISTANT = 'assistant'#
- class ChatContentType#
-
ChatContentType is an Enum that represents the type of Chat content.
Initialize self. See help(type(self)) for accurate signature.
- TEXT = 'text'#
- IMAGE_URL = 'image_url'#
- INPUT_AUDIO = 'input_audio'#
- class WebSocketMessageType#
-
WebSocketMessageType is an Enum that represents WebSocket Message types.
Initialize self. See help(type(self)) for accurate signature.
- USER_MESSAGE = 'user_message'#
- RESPONSE_MESSAGE = 'system_response_message'#
- INTERMEDIATE_STEP_MESSAGE = 'system_intermediate_message'#
- SYSTEM_INTERACTION_MESSAGE = 'system_interaction_message'#
- USER_INTERACTION_MESSAGE = 'user_interaction_message'#
- ERROR_MESSAGE = 'error_message'#
- class WorkflowSchemaType#
-
WorkflowSchemaType is an Enum that represents Workkflow response types.
Initialize self. See help(type(self)) for accurate signature.
- GENERATE_STREAM = 'generate_stream'#
- CHAT_STREAM = 'chat_stream'#
- GENERATE = 'generate'#
- CHAT = 'chat'#
- class WebSocketMessageStatus#
-
WebSocketMessageStatus is an Enum that represents the status of a WebSocket message.
Initialize self. See help(type(self)) for accurate signature.
- IN_PROGRESS = 'in_progress'#
- COMPLETE = 'complete'#
- class InputAudio(/, **data: Any)#
Bases:
pydantic.BaseModel
- class AudioContent(/, **data: Any)#
Bases:
pydantic.BaseModel
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- type: Literal[ChatContentType]#
- input_audio: InputAudio#
- class ImageContent(/, **data: Any)#
Bases:
pydantic.BaseModel
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- type: Literal[ChatContentType]#
- class TextContent(/, **data: Any)#
Bases:
pydantic.BaseModel
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- type: Literal[ChatContentType]#
- class Security(/, **data: Any)#
Bases:
pydantic.BaseModel
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- UserContent#
- class UserMessages(/, **data: Any)#
Bases:
pydantic.BaseModel
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- class UserMessageContent(/, **data: Any)#
Bases:
pydantic.BaseModel
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- messages: list[UserMessages]#
- class User(/, **data: Any)#
Bases:
pydantic.BaseModel
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- class ErrorTypes#
-
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
Initialize self. See help(type(self)) for accurate signature.
- UNKNOWN_ERROR = 'unknown_error'#
- INVALID_MESSAGE = 'invalid_message'#
- INVALID_MESSAGE_TYPE = 'invalid_message_type'#
- INVALID_USER_MESSAGE_CONTENT = 'invalid_user_message_content'#
- INVALID_DATA_CONTENT = 'invalid_data_content'#
- class Error(/, **data: Any)#
Bases:
pydantic.BaseModel
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- code: ErrorTypes#
- class WebSocketUserMessage(/, **data: Any)#
Bases:
pydantic.BaseModel
For more details, refer to the API documentation: docs/source/developer_guide/websockets.md
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- type: Literal[WebSocketMessageType]#
- schema_type: WorkflowSchemaType#
- content: UserMessageContent#
- class WebSocketUserInteractionResponseMessage(/, **data: Any)#
Bases:
pydantic.BaseModel
For more details, refer to the API documentation: docs/source/developer_guide/websockets.md
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.- type: Literal[WebSocketMessageType]#
- content: UserMessageContent#
- class SystemIntermediateStepContent(/, **data: Any)#
Bases:
pydantic.BaseModel
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- class WebSocketSystemIntermediateStepMessage(/, **data: Any)#
Bases:
pydantic.BaseModel
For more details, refer to the API documentation: docs/source/developer_guide/websockets.md
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- type: Literal[WebSocketMessageType]#
- content: SystemIntermediateStepContent#
- status: WebSocketMessageStatus#
- class SystemResponseContent(/, **data: Any)#
Bases:
pydantic.BaseModel
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- class WebSocketSystemResponseTokenMessage(/, **data: Any)#
Bases:
pydantic.BaseModel
For more details, refer to the API documentation: docs/source/developer_guide/websockets.md
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- type: Literal[WebSocketMessageType, WebSocketMessageType]#
- content: SystemResponseContent | Error | AIQGenerateResponse#
- status: WebSocketMessageStatus#
- classmethod validate_content_by_type(
- value: SystemResponseContent | Error | AIQGenerateResponse,
- info: pydantic_core.core_schema.ValidationInfo,
- class WebSocketSystemInteractionMessage(/, **data: Any)#
Bases:
pydantic.BaseModel
For more details, refer to the API documentation: docs/source/developer_guide/websockets.md
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- type: Literal[WebSocketMessageType]#
- content: aiq.data_models.interactive.HumanPrompt#
- status: WebSocketMessageStatus#
- _generate_response_to_str(response: AIQGenerateResponse) str #
- _generate_response_to_chat_response(
- response: AIQGenerateResponse,
- _aiq_chat_request_to_string(data: AIQChatRequest) str #
- _string_to_aiq_chat_request(data: str) AIQChatRequest #
- _aiq_chat_response_to_string(data: AIQChatResponse) str #
- _string_to_aiq_chat_response(data: str) AIQChatResponse #
Converts a string to an AIQChatResponse object
- _chat_response_to_chat_response_chunk(
- data: AIQChatResponse,
- _aiq_chat_response_chunk_to_string(data: AIQChatResponseChunk) str #
- _string_to_aiq_chat_response_chunk(data: str) AIQChatResponseChunk #
Converts a string to an AIQChatResponseChunk object