diff --git a/.mock/asyncapi.yml b/.mock/asyncapi.yml index 7ea19b93..75fdd5ce 100644 --- a/.mock/asyncapi.yml +++ b/.mock/asyncapi.yml @@ -147,7 +147,7 @@ channels: contexts, flush them, or close them independently. A `close_socket` message can be used to terminate the entire connection gracefully. - For more information on how to use this API for conversational agents see the [conversational agents guide](/docs/best-practices/conversational-agents). + For more information on best practices for how to use this API, please see the [multi context websocket guide](/docs/cookbooks/multi-context-web-socket). bindings: ws: @@ -624,18 +624,18 @@ components: items: $ref: '#/components/schemas/PronunciationDictionaryLocator' description: Optional list of pronunciation dictionary locators. Can only be provided in the first message for a given context_id. - context_id: + contextId: type: string nullable: true description: An identifier for the text-to-speech context. Allows managing multiple independent audio generation streams over a single WebSocket connection. If omitted, a default context is used. close_context: type: boolean default: false - description: If true, closes the specified `context_id`. No further audio will be generated for this context. The `text` field is ignored. + description: If true, closes the specified `contextId`. No further audio will be generated for this context. The `text` field is ignored. close_socket: type: boolean default: false - description: If true, flushes all contexts and closes the entire WebSocket connection. The `text` and `context_id` fields are ignored. + description: If true, flushes all contexts and closes the entire WebSocket connection. The `text` and `contextId` fields are ignored. WebsocketTTSServerMessageMulti: type: object @@ -762,9 +762,9 @@ components: alignment: $ref: '#/components/schemas/Alignment' nullable: true - context_id: + contextId: type: string - description: The context_id for which this audio is. + description: The contextId for which this audio is. FinalOutputMulti: type: object diff --git a/.mock/definition/__package__.yml b/.mock/definition/__package__.yml index 5fd13805..4130a0c4 100644 --- a/.mock/definition/__package__.yml +++ b/.mock/definition/__package__.yml @@ -212,26 +212,6 @@ types: source: openapi: openapi.json AgentConfig: - properties: - first_message: - type: optional - docs: >- - If non-empty, the first message the agent will say. If empty, the - agent waits for the user to start the discussion. - default: '' - language: - type: optional - docs: Language of the agent - used for ASR and TTS - default: en - dynamic_variables: - type: optional - docs: Configuration for dynamic variables - prompt: - type: optional - docs: The prompt for the agent - source: - openapi: openapi.json - AgentConfigDbModel: properties: first_message: type: optional @@ -1253,8 +1233,19 @@ types: properties: {} source: openapi: openapi.json + ChapterContentBlockInputModelSubType: + enum: + - p + - h1 + - h2 + - h3 + inline: true + source: + openapi: openapi.json ChapterContentBlockInputModel: properties: + sub_type: + type: optional block_id: type: optional nodes: @@ -2135,7 +2126,7 @@ types: agent and an AI user. properties: simulated_user_config: - type: AgentConfigDbModel + type: AgentConfig tool_mock_config: type: optional> partial_conversation_history: @@ -2182,6 +2173,9 @@ types: expiration_time_unix_secs: type: optional docs: The expiration time of the token in unix seconds + conversation_id: + type: optional + docs: The ID of the conversation purpose: type: optional docs: The purpose of the token @@ -3017,6 +3011,11 @@ types: type: WidgetConfigResponseModel source: openapi: openapi.json + GetAgentKnowledgebaseSizeResponseModel: + properties: + number_of_pages: double + source: + openapi: openapi.json GetAgentLinkResponseModel: properties: agent_id: @@ -3651,6 +3650,19 @@ types: type: optional> source: openapi: openapi.json + LlmUsageCalculatorLlmResponseModel: + properties: + llm: + type: Llm + price_per_minute: double + source: + openapi: openapi.json + LlmUsageCalculatorResponseModel: + properties: + llm_prices: + type: list + source: + openapi: openapi.json LanguageAddedResponse: properties: version: integer @@ -4067,6 +4079,66 @@ types: docs: Whether the user is on the watchlist. source: openapi: openapi.json + NativeMcpToolConfigInput: + docs: A Native MCP tool is a tool that is used to call a Native MCP server + properties: + id: + type: optional + default: '' + name: + type: string + validation: + pattern: ^[a-zA-Z0-9_-]{1,64}$ + minLength: 0 + description: + type: string + validation: + minLength: 0 + response_timeout_secs: + type: optional + docs: The maximum time in seconds to wait for the tool call to complete. + default: 20 + parameters: + type: optional + docs: Schema for any parameters the LLM needs to provide to the MCP tool. + mcp_tool_name: + type: string + docs: The name of the MCP tool to call + mcp_server_id: + type: string + docs: The id of the MCP server to call + source: + openapi: openapi.json + NativeMcpToolConfigOutput: + docs: A Native MCP tool is a tool that is used to call a Native MCP server + properties: + id: + type: optional + default: '' + name: + type: string + validation: + pattern: ^[a-zA-Z0-9_-]{1,64}$ + minLength: 0 + description: + type: string + validation: + minLength: 0 + response_timeout_secs: + type: optional + docs: The maximum time in seconds to wait for the tool call to complete. + default: 20 + parameters: + type: optional + docs: Schema for any parameters the LLM needs to provide to the MCP tool. + mcp_tool_name: + type: string + docs: The name of the MCP tool to call + mcp_server_id: + type: string + docs: The id of the MCP server to call + source: + openapi: openapi.json ObjectJsonSchemaPropertyInputPropertiesValue: discriminated: false union: @@ -4673,6 +4745,8 @@ types: type: ClientToolConfigInput mcp: type: McpToolConfigInput + native_mcp: + type: NativeMcpToolConfigInput system: type: SystemToolConfigInput webhook: @@ -4707,6 +4781,9 @@ types: mcp_server_ids: type: optional> docs: A list of MCP server ids to be used by the agent + native_mcp_server_ids: + type: optional> + docs: A list of Native MCP server ids to be used by the agent knowledge_base: type: optional> docs: A list of knowledge bases to be used by the agent @@ -4730,6 +4807,8 @@ types: type: ClientToolConfigOutput mcp: type: McpToolConfigOutput + native_mcp: + type: NativeMcpToolConfigOutput system: type: SystemToolConfigOutput webhook: @@ -4745,6 +4824,8 @@ types: type: ClientToolConfigInput mcp: type: McpToolConfigInput + native_mcp: + type: NativeMcpToolConfigInput system: type: SystemToolConfigInput webhook: @@ -4779,6 +4860,9 @@ types: mcp_server_ids: type: optional> docs: A list of MCP server ids to be used by the agent + native_mcp_server_ids: + type: optional> + docs: A list of Native MCP server ids to be used by the agent knowledge_base: type: optional> docs: A list of knowledge bases to be used by the agent @@ -7506,7 +7590,7 @@ types: docs: >- Optional list of pronunciation dictionary locators. Can only be provided in the first message for a given context_id. - context_id: + contextId: type: optional docs: >- An identifier for the text-to-speech context. Allows managing multiple @@ -7515,14 +7599,14 @@ types: close_context: type: optional docs: >- - If true, closes the specified `context_id`. No further audio will be + If true, closes the specified `contextId`. No further audio will be generated for this context. The `text` field is ignored. default: false close_socket: type: optional docs: >- If true, flushes all contexts and closes the entire WebSocket - connection. The `text` and `context_id` fields are ignored. + connection. The `text` and `contextId` fields are ignored. default: false source: openapi: asyncapi.yml @@ -7651,9 +7735,9 @@ types: docs: Base64 encoded audio chunk. normalizedAlignment: optional alignment: optional - context_id: + contextId: type: optional - docs: The context_id for which this audio is. + docs: The contextId for which this audio is. source: openapi: asyncapi.yml FinalOutputMulti: diff --git a/.mock/definition/conversationalAi/agents/knowledgeBase.yml b/.mock/definition/conversationalAi/agents/knowledgeBase.yml new file mode 100644 index 00000000..d466bc3d --- /dev/null +++ b/.mock/definition/conversationalAi/agents/knowledgeBase.yml @@ -0,0 +1,32 @@ +imports: + root: ../../__package__.yml +service: + auth: false + base-path: '' + endpoints: + size: + path: /v1/convai/agent/{agent_id}/knowledge-base/size + method: GET + auth: false + docs: Returns the number of pages in the agent's knowledge base. + source: + openapi: openapi.json + path-parameters: + agent_id: string + display-name: Returns The Size Of The Agent'S Knowledge Base + response: + docs: Successful Response + type: root.GetAgentKnowledgebaseSizeResponseModel + status-code: 200 + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + agent_id: agent_id + response: + body: + number_of_pages: 1.1 + audiences: + - convai + source: + openapi: openapi.json diff --git a/.mock/definition/conversationalAi/agents/link.yml b/.mock/definition/conversationalAi/agents/link.yml index 57187529..1a90f92f 100644 --- a/.mock/definition/conversationalAi/agents/link.yml +++ b/.mock/definition/conversationalAi/agents/link.yml @@ -29,9 +29,10 @@ service: body: agent_id: J3Pbu5gP6NNKBscdCdwB token: - agent_id: J3Pbu5gP6NNKBscdCdwB + agent_id: agent_J3Pbu5gP6NNKBscdCdwB conversation_token: '1234567890' expiration_time_unix_secs: 1716153600 + conversation_id: conv_J3Pbu5gP6NNKBscdCdwB purpose: signed_url audiences: - convai diff --git a/.mock/definition/conversationalAi/agents/llmUsage.yml b/.mock/definition/conversationalAi/agents/llmUsage.yml new file mode 100644 index 00000000..2a9f4a34 --- /dev/null +++ b/.mock/definition/conversationalAi/agents/llmUsage.yml @@ -0,0 +1,51 @@ +imports: + root: ../../__package__.yml +service: + auth: false + base-path: '' + endpoints: + calculate: + path: /v1/convai/agent/{agent_id}/llm-usage/calculate + method: POST + auth: false + docs: Calculates expected number of LLM tokens needed for the specified agent. + source: + openapi: openapi.json + path-parameters: + agent_id: string + display-name: Calculate Expected Llm Usage For An Agent + request: + name: LlmUsageCalculatorRequestModel + body: + properties: + prompt_length: + type: optional + docs: Length of the prompt in characters. + number_of_pages: + type: optional + docs: >- + Pages of content in pdf documents OR urls in agent's Knowledge + Base. + rag_enabled: + type: optional + docs: Whether RAG is enabled. + content-type: application/json + response: + docs: Successful Response + type: root.LlmUsageCalculatorResponseModel + status-code: 200 + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + agent_id: agent_id + request: {} + response: + body: + llm_prices: + - llm: gpt-4o-mini + price_per_minute: 1.1 + audiences: + - convai + source: + openapi: openapi.json diff --git a/.mock/definition/conversationalAi/llmUsage.yml b/.mock/definition/conversationalAi/llmUsage.yml new file mode 100644 index 00000000..30fefa99 --- /dev/null +++ b/.mock/definition/conversationalAi/llmUsage.yml @@ -0,0 +1,52 @@ +imports: + root: ../__package__.yml +service: + auth: false + base-path: '' + endpoints: + calculate: + path: /v1/convai/llm-usage/calculate + method: POST + auth: false + docs: >- + Returns a list of LLM models and the expected cost for using them based + on the provided values. + source: + openapi: openapi.json + display-name: Calculate Expected Llm Usage + request: + name: LlmUsageCalculatorPublicRequestModel + body: + properties: + prompt_length: + type: integer + docs: Length of the prompt in characters. + number_of_pages: + type: integer + docs: >- + Pages of content in PDF documents or URLs in the agent's + knowledge base. + rag_enabled: + type: boolean + docs: Whether RAG is enabled. + content-type: application/json + response: + docs: Successful Response + type: root.LlmUsageCalculatorResponseModel + status-code: 200 + errors: + - root.UnprocessableEntityError + examples: + - request: + prompt_length: 1 + number_of_pages: 1 + rag_enabled: true + response: + body: + llm_prices: + - llm: gpt-4o-mini + price_per_minute: 1.1 + audiences: + - convai + source: + openapi: openapi.json diff --git a/.mock/definition/v1TextToSpeechVoiceIdMultiStreamInput.yml b/.mock/definition/v1TextToSpeechVoiceIdMultiStreamInput.yml index 5d1e079e..ced848fe 100644 --- a/.mock/definition/v1TextToSpeechVoiceIdMultiStreamInput.yml +++ b/.mock/definition/v1TextToSpeechVoiceIdMultiStreamInput.yml @@ -26,9 +26,9 @@ channel: the entire connection gracefully. - For more information on how to use this API for conversational agents see - the [conversational agents - guide](/docs/best-practices/conversational-agents). + For more information on best practices for how to use this API, please see + the [multi context websocket + guide](/docs/cookbooks/multi-context-web-socket). path-parameters: voice_id: type: string @@ -192,6 +192,7 @@ channel: - r - l - d + contextId: conv_1 - type: publish body: text: 'Hi this is a new context with different settings! ' @@ -210,6 +211,7 @@ channel: - type: subscribe body: audio: Y3VyaW91cyBtaW5kcyB0aGluayBhbGlrZSA6KQ== + contextId: interruption_context - type: subscribe body: isFinal: true diff --git a/.mock/openapi.json b/.mock/openapi.json index 3fd61901..4103e642 100644 --- a/.mock/openapi.json +++ b/.mock/openapi.json @@ -10790,6 +10790,150 @@ "x-fern-sdk-method-name": "list" } }, + "/v1/convai/agent/{agent_id}/knowledge-base/size": { + "get": { + "operationId": "Returns_the_size_of_the_agent_s_knowledge_base_v1_convai_agent__agent_id__knowledge_base_size_get", + "summary": "Returns The Size Of The Agent'S Knowledge Base", + "description": "Returns the number of pages in the agent's knowledge base.", + "parameters": [ + { + "name": "agent_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Agent Id" + } + }, + { + "name": "xi-api-key", + "in": "header", + "description": "Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.", + "required": false, + "schema": { + "description": "Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Xi-Api-Key" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetAgentKnowledgebaseSizeResponseModel" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + }, + "tags": [ + "Conversational AI" + ], + "x-fern-sdk-group-name": [ + "conversational_ai", + "agents", + "knowledge_base" + ], + "x-fern-sdk-method-name": "size" + } + }, + "/v1/convai/agent/{agent_id}/llm-usage/calculate": { + "post": { + "operationId": "Calculate_expected_LLM_usage_for_an_agent_v1_convai_agent__agent_id__llm_usage_calculate_post", + "summary": "Calculate Expected Llm Usage For An Agent", + "description": "Calculates expected number of LLM tokens needed for the specified agent.", + "parameters": [ + { + "name": "agent_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Agent Id" + } + }, + { + "name": "xi-api-key", + "in": "header", + "description": "Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.", + "required": false, + "schema": { + "description": "Your API key. This is required by most endpoints to access our API programatically. You can view your xi-api-key using the 'Profile' tab on the website.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Xi-Api-Key" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LLMUsageCalculatorRequestModel" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LLMUsageCalculatorResponseModel" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + }, + "tags": [ + "Conversational AI" + ], + "x-fern-sdk-group-name": [ + "conversational_ai", + "agents", + "llm_usage" + ], + "x-fern-sdk-method-name": "calculate" + } + }, "/v1/convai/agents/{agent_id}/simulate-conversation": { "post": { "operationId": "Simulates_a_conversation_v1_convai_agents__agent_id__simulate_conversation_post", @@ -11789,6 +11933,53 @@ "x-fern-sdk-method-name": "list" } }, + "/v1/convai/llm-usage/calculate": { + "post": { + "operationId": "Calculate_expected_LLM_usage_v1_convai_llm_usage_calculate_post", + "summary": "Calculate Expected Llm Usage", + "description": "Returns a list of LLM models and the expected cost for using them based on the provided values.", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LLMUsageCalculatorPublicRequestModel" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LLMUsageCalculatorResponseModel" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + }, + "tags": [ + "Conversational AI" + ], + "x-fern-sdk-group-name": [ + "conversational_ai", + "llm_usage" + ], + "x-fern-sdk-method-name": "calculate" + } + }, "/v1/convai/knowledge-base": { "post": { "operationId": "Add_to_knowledge_base_v1_convai_knowledge_base_post", @@ -21273,6 +21464,23 @@ "ChapterContentBlockInputModel": { "type": "object", "properties": { + "sub_type": { + "anyOf": [ + { + "type": "string", + "enum": [ + "p", + "h1", + "h2", + "h3" + ] + }, + { + "type": "null" + } + ], + "title": "Sub Type" + }, "block_id": { "anyOf": [ { @@ -23522,6 +23730,18 @@ ], "title": "Expiration Time Unix Secs" }, + "conversation_id": { + "description": "The ID of the conversation", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Conversation Id" + }, "purpose": { "description": "The purpose of the token", "default": "signed_url", @@ -23529,7 +23749,8 @@ } }, "example": { - "agent_id": "J3Pbu5gP6NNKBscdCdwB", + "agent_id": "agent_J3Pbu5gP6NNKBscdCdwB", + "conversation_id": "conv_J3Pbu5gP6NNKBscdCdwB", "conversation_token": "1234567890", "expiration_time_unix_secs": 1716153600, "purpose": "signed_url" @@ -25416,6 +25637,19 @@ ], "title": "GetAgentEmbedResponseModel" }, + "GetAgentKnowledgebaseSizeResponseModel": { + "type": "object", + "properties": { + "number_of_pages": { + "type": "number", + "title": "Number Of Pages" + } + }, + "required": [ + "number_of_pages" + ], + "title": "GetAgentKnowledgebaseSizeResponseModel" + }, "GetAgentLinkResponseModel": { "type": "object", "properties": { @@ -27201,6 +27435,107 @@ }, "title": "LLMUsage" }, + "LLMUsageCalculatorLLMResponseModel": { + "type": "object", + "properties": { + "llm": { + "$ref": "#/components/schemas/LLM" + }, + "price_per_minute": { + "type": "number", + "title": "Price Per Minute" + } + }, + "required": [ + "llm", + "price_per_minute" + ], + "title": "LLMUsageCalculatorLLMResponseModel" + }, + "LLMUsageCalculatorPublicRequestModel": { + "type": "object", + "properties": { + "prompt_length": { + "description": "Length of the prompt in characters.", + "type": "integer", + "title": "Prompt Length" + }, + "number_of_pages": { + "description": "Pages of content in PDF documents or URLs in the agent's knowledge base.", + "type": "integer", + "title": "Number Of Pages" + }, + "rag_enabled": { + "description": "Whether RAG is enabled.", + "type": "boolean", + "title": "Rag Enabled" + } + }, + "required": [ + "prompt_length", + "number_of_pages", + "rag_enabled" + ], + "title": "LLMUsageCalculatorPublicRequestModel" + }, + "LLMUsageCalculatorRequestModel": { + "type": "object", + "properties": { + "prompt_length": { + "description": "Length of the prompt in characters.", + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Prompt Length" + }, + "number_of_pages": { + "description": "Pages of content in pdf documents OR urls in agent's Knowledge Base.", + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Number Of Pages" + }, + "rag_enabled": { + "description": "Whether RAG is enabled.", + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Rag Enabled" + } + }, + "title": "LLMUsageCalculatorRequestModel" + }, + "LLMUsageCalculatorResponseModel": { + "type": "object", + "properties": { + "llm_prices": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LLMUsageCalculatorLLMResponseModel" + }, + "title": "Llm Prices" + } + }, + "required": [ + "llm_prices" + ], + "title": "LLMUsageCalculatorResponseModel" + }, "LanguageAddedResponse": { "type": "object", "properties": { @@ -28172,6 +28507,132 @@ ], "title": "ModerationStatusResponseModel" }, + "NativeMCPToolConfig-Input": { + "description": "A Native MCP tool is a tool that is used to call a Native MCP server", + "type": "object", + "properties": { + "id": { + "type": "string", + "default": "", + "title": "Id" + }, + "name": { + "type": "string", + "minLength": 0, + "pattern": "^[a-zA-Z0-9_-]{1,64}$", + "title": "Name" + }, + "description": { + "type": "string", + "minLength": 0, + "title": "Description" + }, + "response_timeout_secs": { + "description": "The maximum time in seconds to wait for the tool call to complete.", + "type": "integer", + "default": 20, + "title": "Response Timeout Secs" + }, + "type": { + "description": "The type of tool", + "type": "string", + "default": "native_mcp", + "const": "native_mcp", + "title": "Type" + }, + "parameters": { + "description": "Schema for any parameters the LLM needs to provide to the MCP tool.", + "anyOf": [ + { + "$ref": "#/components/schemas/ObjectJsonSchemaProperty-Input" + }, + { + "type": "null" + } + ] + }, + "mcp_tool_name": { + "description": "The name of the MCP tool to call", + "type": "string", + "title": "Mcp Tool Name" + }, + "mcp_server_id": { + "description": "The id of the MCP server to call", + "type": "string", + "title": "Mcp Server Id" + } + }, + "required": [ + "name", + "description", + "mcp_tool_name", + "mcp_server_id" + ], + "title": "NativeMCPToolConfig" + }, + "NativeMCPToolConfig-Output": { + "description": "A Native MCP tool is a tool that is used to call a Native MCP server", + "type": "object", + "properties": { + "id": { + "type": "string", + "default": "", + "title": "Id" + }, + "name": { + "type": "string", + "minLength": 0, + "pattern": "^[a-zA-Z0-9_-]{1,64}$", + "title": "Name" + }, + "description": { + "type": "string", + "minLength": 0, + "title": "Description" + }, + "response_timeout_secs": { + "description": "The maximum time in seconds to wait for the tool call to complete.", + "type": "integer", + "default": 20, + "title": "Response Timeout Secs" + }, + "type": { + "description": "The type of tool", + "type": "string", + "default": "native_mcp", + "const": "native_mcp", + "title": "Type" + }, + "parameters": { + "description": "Schema for any parameters the LLM needs to provide to the MCP tool.", + "anyOf": [ + { + "$ref": "#/components/schemas/ObjectJsonSchemaProperty-Output" + }, + { + "type": "null" + } + ] + }, + "mcp_tool_name": { + "description": "The name of the MCP tool to call", + "type": "string", + "title": "Mcp Tool Name" + }, + "mcp_server_id": { + "description": "The id of the MCP server to call", + "type": "string", + "title": "Mcp Server Id" + } + }, + "required": [ + "name", + "description", + "mcp_tool_name", + "mcp_server_id" + ], + "title": "NativeMCPToolConfig" + }, "ObjectJsonSchemaProperty-Input": { "type": "object", "properties": { @@ -29819,6 +30280,9 @@ }, { "$ref": "#/components/schemas/MCPToolConfig-Input" + }, + { + "$ref": "#/components/schemas/NativeMCPToolConfig-Input" } ], "description": "The type of tool", @@ -29827,6 +30291,7 @@ "mapping": { "client": "#/components/schemas/ClientToolConfig-Input", "mcp": "#/components/schemas/MCPToolConfig-Input", + "native_mcp": "#/components/schemas/NativeMCPToolConfig-Input", "system": "#/components/schemas/SystemToolConfig-Input", "webhook": "#/components/schemas/WebhookToolConfig-Input" } @@ -29851,6 +30316,15 @@ "maxItems": 10, "title": "Mcp Server Ids" }, + "native_mcp_server_ids": { + "description": "A list of Native MCP server ids to be used by the agent", + "type": "array", + "items": { + "type": "string" + }, + "maxItems": 10, + "title": "Native Mcp Server Ids" + }, "knowledge_base": { "description": "A list of knowledge bases to be used by the agent", "type": "array", @@ -29941,6 +30415,9 @@ }, { "$ref": "#/components/schemas/MCPToolConfig-Output" + }, + { + "$ref": "#/components/schemas/NativeMCPToolConfig-Output" } ], "description": "The type of tool", @@ -29949,6 +30426,7 @@ "mapping": { "client": "#/components/schemas/ClientToolConfig-Output", "mcp": "#/components/schemas/MCPToolConfig-Output", + "native_mcp": "#/components/schemas/NativeMCPToolConfig-Output", "system": "#/components/schemas/SystemToolConfig-Output", "webhook": "#/components/schemas/WebhookToolConfig-Output" } @@ -29973,6 +30451,15 @@ "maxItems": 10, "title": "Mcp Server Ids" }, + "native_mcp_server_ids": { + "description": "A list of Native MCP server ids to be used by the agent", + "type": "array", + "items": { + "type": "string" + }, + "maxItems": 10, + "title": "Native Mcp Server Ids" + }, "knowledge_base": { "description": "A list of knowledge bases to be used by the agent", "type": "array", @@ -30063,6 +30550,9 @@ }, { "$ref": "#/components/schemas/MCPToolConfig-Input" + }, + { + "$ref": "#/components/schemas/NativeMCPToolConfig-Input" } ], "description": "The type of tool", @@ -30071,6 +30561,7 @@ "mapping": { "client": "#/components/schemas/ClientToolConfig-Input", "mcp": "#/components/schemas/MCPToolConfig-Input", + "native_mcp": "#/components/schemas/NativeMCPToolConfig-Input", "system": "#/components/schemas/SystemToolConfig-Input", "webhook": "#/components/schemas/WebhookToolConfig-Input" } @@ -30095,6 +30586,15 @@ "maxItems": 10, "title": "Mcp Server Ids" }, + "native_mcp_server_ids": { + "description": "A list of Native MCP server ids to be used by the agent", + "type": "array", + "items": { + "type": "string" + }, + "maxItems": 10, + "title": "Native Mcp Server Ids" + }, "knowledge_base": { "description": "A list of knowledge bases to be used by the agent", "type": "array", diff --git a/pyproject.toml b/pyproject.toml index b3bfab7e..00940bdc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "elevenlabs" [tool.poetry] name = "elevenlabs" -version = "v2.0.0" +version = "v2.1.0" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index ebbea200..c8c646d1 100644 --- a/reference.md +++ b/reference.md @@ -5370,7 +5370,7 @@ Run a conversation between the agent and a simulated user. ```python from elevenlabs import ( - AgentConfigDbModel, + AgentConfig, ConversationSimulationSpecification, ElevenLabs, ) @@ -5381,7 +5381,7 @@ client = ElevenLabs( client.conversational_ai.agents.simulate_conversation( agent_id="21m00Tcm4TlvDq8ikWAM", simulation_specification=ConversationSimulationSpecification( - simulated_user_config=AgentConfigDbModel( + simulated_user_config=AgentConfig( first_message="Hello, how can I help you today?", language="en", ), @@ -5466,7 +5466,7 @@ Run a conversation between the agent and a simulated user and stream back the re ```python from elevenlabs import ( - AgentConfigDbModel, + AgentConfig, ConversationSimulationSpecification, ElevenLabs, ) @@ -5477,7 +5477,7 @@ client = ElevenLabs( client.conversational_ai.agents.simulate_conversation_stream( agent_id="21m00Tcm4TlvDq8ikWAM", simulation_specification=ConversationSimulationSpecification( - simulated_user_config=AgentConfigDbModel( + simulated_user_config=AgentConfig( first_message="Hello, how can I help you today?", language="en", ), @@ -5887,6 +5887,95 @@ client.conversational_ai.phone_numbers.list() + + + + +## ConversationalAi LlmUsage +
client.conversational_ai.llm_usage.calculate(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of LLM models and the expected cost for using them based on the provided values. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs + +client = ElevenLabs( + api_key="YOUR_API_KEY", +) +client.conversational_ai.llm_usage.calculate( + prompt_length=1, + number_of_pages=1, + rag_enabled=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**prompt_length:** `int` — Length of the prompt in characters. + +
+
+ +
+
+ +**number_of_pages:** `int` — Pages of content in PDF documents or URLs in the agent's knowledge base. + +
+
+ +
+
+ +**rag_enabled:** `bool` — Whether RAG is enabled. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
@@ -6866,6 +6955,172 @@ client.conversational_ai.agents.link.get( + + + + +## ConversationalAi Agents KnowledgeBase +
client.conversational_ai.agents.knowledge_base.size(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the number of pages in the agent's knowledge base. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs + +client = ElevenLabs( + api_key="YOUR_API_KEY", +) +client.conversational_ai.agents.knowledge_base.size( + agent_id="agent_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents LlmUsage +
client.conversational_ai.agents.llm_usage.calculate(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Calculates expected number of LLM tokens needed for the specified agent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs + +client = ElevenLabs( + api_key="YOUR_API_KEY", +) +client.conversational_ai.agents.llm_usage.calculate( + agent_id="agent_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**prompt_length:** `typing.Optional[int]` — Length of the prompt in characters. + +
+
+ +
+
+ +**number_of_pages:** `typing.Optional[int]` — Pages of content in pdf documents OR urls in agent's Knowledge Base. + +
+
+ +
+
+ +**rag_enabled:** `typing.Optional[bool]` — Whether RAG is enabled. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
diff --git a/src/elevenlabs/__init__.py b/src/elevenlabs/__init__.py index bb15439e..7c42f546 100644 --- a/src/elevenlabs/__init__.py +++ b/src/elevenlabs/__init__.py @@ -20,7 +20,6 @@ AgentBan, AgentCallLimits, AgentConfig, - AgentConfigDbModel, AgentConfigOverride, AgentConfigOverrideConfig, AgentMetadataResponseModel, @@ -83,6 +82,7 @@ BreakdownTypes, ChapterContentBlockExtendableNodeResponseModel, ChapterContentBlockInputModel, + ChapterContentBlockInputModelSubType, ChapterContentBlockResponseModel, ChapterContentBlockResponseModelNodesItem, ChapterContentBlockResponseModelNodesItem_Other, @@ -255,6 +255,7 @@ GenerateVoiceRequest, GenerationConfig, GetAgentEmbedResponseModel, + GetAgentKnowledgebaseSizeResponseModel, GetAgentLinkResponseModel, GetAgentResponseModel, GetAgentResponseModelPhoneNumbersItem, @@ -345,6 +346,8 @@ LlmCategoryUsage, LlmInputOutputTokensUsage, LlmTokensCategoryUsage, + LlmUsageCalculatorLlmResponseModel, + LlmUsageCalculatorResponseModel, LlmUsageInput, LlmUsageOutput, ManualVerificationFileResponse, @@ -359,6 +362,8 @@ ModerationStatusResponseModel, ModerationStatusResponseModelSafetyStatus, ModerationStatusResponseModelWarningStatus, + NativeMcpToolConfigInput, + NativeMcpToolConfigOutput, NormalizedAlignment, ObjectJsonSchemaPropertyInput, ObjectJsonSchemaPropertyInputPropertiesValue, @@ -405,16 +410,19 @@ PromptAgentDbModelToolsItem, PromptAgentDbModelToolsItem_Client, PromptAgentDbModelToolsItem_Mcp, + PromptAgentDbModelToolsItem_NativeMcp, PromptAgentDbModelToolsItem_System, PromptAgentDbModelToolsItem_Webhook, PromptAgentInputToolsItem, PromptAgentInputToolsItem_Client, PromptAgentInputToolsItem_Mcp, + PromptAgentInputToolsItem_NativeMcp, PromptAgentInputToolsItem_System, PromptAgentInputToolsItem_Webhook, PromptAgentOutputToolsItem, PromptAgentOutputToolsItem_Client, PromptAgentOutputToolsItem_Mcp, + PromptAgentOutputToolsItem_NativeMcp, PromptAgentOutputToolsItem_System, PromptAgentOutputToolsItem_Webhook, PromptAgentOverride, @@ -676,7 +684,6 @@ "AgentBan", "AgentCallLimits", "AgentConfig", - "AgentConfigDbModel", "AgentConfigOverride", "AgentConfigOverrideConfig", "AgentMetadataResponseModel", @@ -760,6 +767,7 @@ "BreakdownTypes", "ChapterContentBlockExtendableNodeResponseModel", "ChapterContentBlockInputModel", + "ChapterContentBlockInputModelSubType", "ChapterContentBlockResponseModel", "ChapterContentBlockResponseModelNodesItem", "ChapterContentBlockResponseModelNodesItem_Other", @@ -935,6 +943,7 @@ "GenerateVoiceRequest", "GenerationConfig", "GetAgentEmbedResponseModel", + "GetAgentKnowledgebaseSizeResponseModel", "GetAgentLinkResponseModel", "GetAgentResponseModel", "GetAgentResponseModelPhoneNumbersItem", @@ -1026,6 +1035,8 @@ "LlmCategoryUsage", "LlmInputOutputTokensUsage", "LlmTokensCategoryUsage", + "LlmUsageCalculatorLlmResponseModel", + "LlmUsageCalculatorResponseModel", "LlmUsageInput", "LlmUsageOutput", "ManualVerificationFileResponse", @@ -1040,6 +1051,8 @@ "ModerationStatusResponseModel", "ModerationStatusResponseModelSafetyStatus", "ModerationStatusResponseModelWarningStatus", + "NativeMcpToolConfigInput", + "NativeMcpToolConfigOutput", "NormalizedAlignment", "NotFoundError", "ObjectJsonSchemaPropertyInput", @@ -1087,16 +1100,19 @@ "PromptAgentDbModelToolsItem", "PromptAgentDbModelToolsItem_Client", "PromptAgentDbModelToolsItem_Mcp", + "PromptAgentDbModelToolsItem_NativeMcp", "PromptAgentDbModelToolsItem_System", "PromptAgentDbModelToolsItem_Webhook", "PromptAgentInputToolsItem", "PromptAgentInputToolsItem_Client", "PromptAgentInputToolsItem_Mcp", + "PromptAgentInputToolsItem_NativeMcp", "PromptAgentInputToolsItem_System", "PromptAgentInputToolsItem_Webhook", "PromptAgentOutputToolsItem", "PromptAgentOutputToolsItem_Client", "PromptAgentOutputToolsItem_Mcp", + "PromptAgentOutputToolsItem_NativeMcp", "PromptAgentOutputToolsItem_System", "PromptAgentOutputToolsItem_Webhook", "PromptAgentOverride", diff --git a/src/elevenlabs/base_client.py b/src/elevenlabs/base_client.py index ba706601..8764a3a9 100644 --- a/src/elevenlabs/base_client.py +++ b/src/elevenlabs/base_client.py @@ -44,7 +44,7 @@ class BaseElevenLabs: api_key : typing.Optional[str] timeout : typing.Optional[float] - The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced. + The timeout to be used, in seconds, for requests. By default the timeout is 240 seconds, unless a custom httpx client is used, in which case this default is not enforced. follow_redirects : typing.Optional[bool] Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. @@ -71,7 +71,7 @@ def __init__( httpx_client: typing.Optional[httpx.Client] = None, ): _defaulted_timeout = ( - timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read + timeout if timeout is not None else 240 if httpx_client is None else httpx_client.timeout.read ) self._client_wrapper = SyncClientWrapper( environment=environment, @@ -121,7 +121,7 @@ class AsyncBaseElevenLabs: api_key : typing.Optional[str] timeout : typing.Optional[float] - The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced. + The timeout to be used, in seconds, for requests. By default the timeout is 240 seconds, unless a custom httpx client is used, in which case this default is not enforced. follow_redirects : typing.Optional[bool] Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. @@ -148,7 +148,7 @@ def __init__( httpx_client: typing.Optional[httpx.AsyncClient] = None, ): _defaulted_timeout = ( - timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read + timeout if timeout is not None else 240 if httpx_client is None else httpx_client.timeout.read ) self._client_wrapper = AsyncClientWrapper( environment=environment, diff --git a/src/elevenlabs/conversational_ai/__init__.py b/src/elevenlabs/conversational_ai/__init__.py index f5b2647e..b5c169bc 100644 --- a/src/elevenlabs/conversational_ai/__init__.py +++ b/src/elevenlabs/conversational_ai/__init__.py @@ -8,6 +8,7 @@ conversations, dashboard, knowledge_base, + llm_usage, phone_numbers, secrets, settings, @@ -47,6 +48,7 @@ "conversations", "dashboard", "knowledge_base", + "llm_usage", "phone_numbers", "secrets", "settings", diff --git a/src/elevenlabs/conversational_ai/agents/__init__.py b/src/elevenlabs/conversational_ai/agents/__init__.py index 6a432eaa..fa76fa00 100644 --- a/src/elevenlabs/conversational_ai/agents/__init__.py +++ b/src/elevenlabs/conversational_ai/agents/__init__.py @@ -2,6 +2,6 @@ # isort: skip_file -from . import link, widget +from . import knowledge_base, link, llm_usage, widget -__all__ = ["link", "widget"] +__all__ = ["knowledge_base", "link", "llm_usage", "widget"] diff --git a/src/elevenlabs/conversational_ai/agents/client.py b/src/elevenlabs/conversational_ai/agents/client.py index d52ac81e..16c9fc1a 100644 --- a/src/elevenlabs/conversational_ai/agents/client.py +++ b/src/elevenlabs/conversational_ai/agents/client.py @@ -12,7 +12,9 @@ from ...types.get_agent_response_model import GetAgentResponseModel from ...types.get_agents_page_response_model import GetAgentsPageResponseModel from ...types.prompt_evaluation_criteria import PromptEvaluationCriteria +from .knowledge_base.client import AsyncKnowledgeBaseClient, KnowledgeBaseClient from .link.client import AsyncLinkClient, LinkClient +from .llm_usage.client import AsyncLlmUsageClient, LlmUsageClient from .raw_client import AsyncRawAgentsClient, RawAgentsClient from .widget.client import AsyncWidgetClient, WidgetClient @@ -27,6 +29,10 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): self.link = LinkClient(client_wrapper=client_wrapper) + self.knowledge_base = KnowledgeBaseClient(client_wrapper=client_wrapper) + + self.llm_usage = LlmUsageClient(client_wrapper=client_wrapper) + @property def with_raw_response(self) -> RawAgentsClient: """ @@ -287,7 +293,7 @@ def simulate_conversation( Examples -------- from elevenlabs import ( - AgentConfigDbModel, + AgentConfig, ConversationSimulationSpecification, ElevenLabs, ) @@ -298,7 +304,7 @@ def simulate_conversation( client.conversational_ai.agents.simulate_conversation( agent_id="21m00Tcm4TlvDq8ikWAM", simulation_specification=ConversationSimulationSpecification( - simulated_user_config=AgentConfigDbModel( + simulated_user_config=AgentConfig( first_message="Hello, how can I help you today?", language="en", ), @@ -345,7 +351,7 @@ def simulate_conversation_stream( Examples -------- from elevenlabs import ( - AgentConfigDbModel, + AgentConfig, ConversationSimulationSpecification, ElevenLabs, ) @@ -356,7 +362,7 @@ def simulate_conversation_stream( client.conversational_ai.agents.simulate_conversation_stream( agent_id="21m00Tcm4TlvDq8ikWAM", simulation_specification=ConversationSimulationSpecification( - simulated_user_config=AgentConfigDbModel( + simulated_user_config=AgentConfig( first_message="Hello, how can I help you today?", language="en", ), @@ -379,6 +385,10 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): self.link = AsyncLinkClient(client_wrapper=client_wrapper) + self.knowledge_base = AsyncKnowledgeBaseClient(client_wrapper=client_wrapper) + + self.llm_usage = AsyncLlmUsageClient(client_wrapper=client_wrapper) + @property def with_raw_response(self) -> AsyncRawAgentsClient: """ @@ -683,7 +693,7 @@ async def simulate_conversation( import asyncio from elevenlabs import ( - AgentConfigDbModel, + AgentConfig, AsyncElevenLabs, ConversationSimulationSpecification, ) @@ -697,7 +707,7 @@ async def main() -> None: await client.conversational_ai.agents.simulate_conversation( agent_id="21m00Tcm4TlvDq8ikWAM", simulation_specification=ConversationSimulationSpecification( - simulated_user_config=AgentConfigDbModel( + simulated_user_config=AgentConfig( first_message="Hello, how can I help you today?", language="en", ), @@ -749,7 +759,7 @@ async def simulate_conversation_stream( import asyncio from elevenlabs import ( - AgentConfigDbModel, + AgentConfig, AsyncElevenLabs, ConversationSimulationSpecification, ) @@ -763,7 +773,7 @@ async def main() -> None: await client.conversational_ai.agents.simulate_conversation_stream( agent_id="21m00Tcm4TlvDq8ikWAM", simulation_specification=ConversationSimulationSpecification( - simulated_user_config=AgentConfigDbModel( + simulated_user_config=AgentConfig( first_message="Hello, how can I help you today?", language="en", ), diff --git a/src/elevenlabs/conversational_ai/agents/knowledge_base/__init__.py b/src/elevenlabs/conversational_ai/agents/knowledge_base/__init__.py new file mode 100644 index 00000000..5cde0202 --- /dev/null +++ b/src/elevenlabs/conversational_ai/agents/knowledge_base/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/src/elevenlabs/conversational_ai/agents/knowledge_base/client.py b/src/elevenlabs/conversational_ai/agents/knowledge_base/client.py new file mode 100644 index 00000000..3af3a93f --- /dev/null +++ b/src/elevenlabs/conversational_ai/agents/knowledge_base/client.py @@ -0,0 +1,112 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.get_agent_knowledgebase_size_response_model import GetAgentKnowledgebaseSizeResponseModel +from .raw_client import AsyncRawKnowledgeBaseClient, RawKnowledgeBaseClient + + +class KnowledgeBaseClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawKnowledgeBaseClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawKnowledgeBaseClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawKnowledgeBaseClient + """ + return self._raw_client + + def size( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetAgentKnowledgebaseSizeResponseModel: + """ + Returns the number of pages in the agent's knowledge base. + + Parameters + ---------- + agent_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentKnowledgebaseSizeResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.knowledge_base.size( + agent_id="agent_id", + ) + """ + _response = self._raw_client.size(agent_id, request_options=request_options) + return _response.data + + +class AsyncKnowledgeBaseClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawKnowledgeBaseClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawKnowledgeBaseClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawKnowledgeBaseClient + """ + return self._raw_client + + async def size( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetAgentKnowledgebaseSizeResponseModel: + """ + Returns the number of pages in the agent's knowledge base. + + Parameters + ---------- + agent_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentKnowledgebaseSizeResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.knowledge_base.size( + agent_id="agent_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.size(agent_id, request_options=request_options) + return _response.data diff --git a/src/elevenlabs/conversational_ai/agents/knowledge_base/raw_client.py b/src/elevenlabs/conversational_ai/agents/knowledge_base/raw_client.py new file mode 100644 index 00000000..f24e9e50 --- /dev/null +++ b/src/elevenlabs/conversational_ai/agents/knowledge_base/raw_client.py @@ -0,0 +1,124 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.get_agent_knowledgebase_size_response_model import GetAgentKnowledgebaseSizeResponseModel +from ....types.http_validation_error import HttpValidationError + + +class RawKnowledgeBaseClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def size( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetAgentKnowledgebaseSizeResponseModel]: + """ + Returns the number of pages in the agent's knowledge base. + + Parameters + ---------- + agent_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAgentKnowledgebaseSizeResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agent/{jsonable_encoder(agent_id)}/knowledge-base/size", + base_url=self._client_wrapper.get_environment().base, + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentKnowledgebaseSizeResponseModel, + construct_type( + type_=GetAgentKnowledgebaseSizeResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + HttpValidationError, + construct_type( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawKnowledgeBaseClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def size( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetAgentKnowledgebaseSizeResponseModel]: + """ + Returns the number of pages in the agent's knowledge base. + + Parameters + ---------- + agent_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAgentKnowledgebaseSizeResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agent/{jsonable_encoder(agent_id)}/knowledge-base/size", + base_url=self._client_wrapper.get_environment().base, + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentKnowledgebaseSizeResponseModel, + construct_type( + type_=GetAgentKnowledgebaseSizeResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + HttpValidationError, + construct_type( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/elevenlabs/conversational_ai/agents/llm_usage/__init__.py b/src/elevenlabs/conversational_ai/agents/llm_usage/__init__.py new file mode 100644 index 00000000..5cde0202 --- /dev/null +++ b/src/elevenlabs/conversational_ai/agents/llm_usage/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/src/elevenlabs/conversational_ai/agents/llm_usage/client.py b/src/elevenlabs/conversational_ai/agents/llm_usage/client.py new file mode 100644 index 00000000..ffabd877 --- /dev/null +++ b/src/elevenlabs/conversational_ai/agents/llm_usage/client.py @@ -0,0 +1,157 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.llm_usage_calculator_response_model import LlmUsageCalculatorResponseModel +from .raw_client import AsyncRawLlmUsageClient, RawLlmUsageClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class LlmUsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawLlmUsageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawLlmUsageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawLlmUsageClient + """ + return self._raw_client + + def calculate( + self, + agent_id: str, + *, + prompt_length: typing.Optional[int] = OMIT, + number_of_pages: typing.Optional[int] = OMIT, + rag_enabled: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> LlmUsageCalculatorResponseModel: + """ + Calculates expected number of LLM tokens needed for the specified agent. + + Parameters + ---------- + agent_id : str + + prompt_length : typing.Optional[int] + Length of the prompt in characters. + + number_of_pages : typing.Optional[int] + Pages of content in pdf documents OR urls in agent's Knowledge Base. + + rag_enabled : typing.Optional[bool] + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LlmUsageCalculatorResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.llm_usage.calculate( + agent_id="agent_id", + ) + """ + _response = self._raw_client.calculate( + agent_id, + prompt_length=prompt_length, + number_of_pages=number_of_pages, + rag_enabled=rag_enabled, + request_options=request_options, + ) + return _response.data + + +class AsyncLlmUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawLlmUsageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawLlmUsageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawLlmUsageClient + """ + return self._raw_client + + async def calculate( + self, + agent_id: str, + *, + prompt_length: typing.Optional[int] = OMIT, + number_of_pages: typing.Optional[int] = OMIT, + rag_enabled: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> LlmUsageCalculatorResponseModel: + """ + Calculates expected number of LLM tokens needed for the specified agent. + + Parameters + ---------- + agent_id : str + + prompt_length : typing.Optional[int] + Length of the prompt in characters. + + number_of_pages : typing.Optional[int] + Pages of content in pdf documents OR urls in agent's Knowledge Base. + + rag_enabled : typing.Optional[bool] + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LlmUsageCalculatorResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.llm_usage.calculate( + agent_id="agent_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.calculate( + agent_id, + prompt_length=prompt_length, + number_of_pages=number_of_pages, + rag_enabled=rag_enabled, + request_options=request_options, + ) + return _response.data diff --git a/src/elevenlabs/conversational_ai/agents/llm_usage/raw_client.py b/src/elevenlabs/conversational_ai/agents/llm_usage/raw_client.py new file mode 100644 index 00000000..5c92ec24 --- /dev/null +++ b/src/elevenlabs/conversational_ai/agents/llm_usage/raw_client.py @@ -0,0 +1,175 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.http_validation_error import HttpValidationError +from ....types.llm_usage_calculator_response_model import LlmUsageCalculatorResponseModel + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawLlmUsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def calculate( + self, + agent_id: str, + *, + prompt_length: typing.Optional[int] = OMIT, + number_of_pages: typing.Optional[int] = OMIT, + rag_enabled: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[LlmUsageCalculatorResponseModel]: + """ + Calculates expected number of LLM tokens needed for the specified agent. + + Parameters + ---------- + agent_id : str + + prompt_length : typing.Optional[int] + Length of the prompt in characters. + + number_of_pages : typing.Optional[int] + Pages of content in pdf documents OR urls in agent's Knowledge Base. + + rag_enabled : typing.Optional[bool] + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[LlmUsageCalculatorResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agent/{jsonable_encoder(agent_id)}/llm-usage/calculate", + base_url=self._client_wrapper.get_environment().base, + method="POST", + json={ + "prompt_length": prompt_length, + "number_of_pages": number_of_pages, + "rag_enabled": rag_enabled, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LlmUsageCalculatorResponseModel, + construct_type( + type_=LlmUsageCalculatorResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + HttpValidationError, + construct_type( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawLlmUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def calculate( + self, + agent_id: str, + *, + prompt_length: typing.Optional[int] = OMIT, + number_of_pages: typing.Optional[int] = OMIT, + rag_enabled: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[LlmUsageCalculatorResponseModel]: + """ + Calculates expected number of LLM tokens needed for the specified agent. + + Parameters + ---------- + agent_id : str + + prompt_length : typing.Optional[int] + Length of the prompt in characters. + + number_of_pages : typing.Optional[int] + Pages of content in pdf documents OR urls in agent's Knowledge Base. + + rag_enabled : typing.Optional[bool] + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[LlmUsageCalculatorResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agent/{jsonable_encoder(agent_id)}/llm-usage/calculate", + base_url=self._client_wrapper.get_environment().base, + method="POST", + json={ + "prompt_length": prompt_length, + "number_of_pages": number_of_pages, + "rag_enabled": rag_enabled, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LlmUsageCalculatorResponseModel, + construct_type( + type_=LlmUsageCalculatorResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + HttpValidationError, + construct_type( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/elevenlabs/conversational_ai/client.py b/src/elevenlabs/conversational_ai/client.py index 1df37532..60243d63 100644 --- a/src/elevenlabs/conversational_ai/client.py +++ b/src/elevenlabs/conversational_ai/client.py @@ -12,6 +12,7 @@ from .conversations.client import AsyncConversationsClient, ConversationsClient from .dashboard.client import AsyncDashboardClient, DashboardClient from .knowledge_base.client import AsyncKnowledgeBaseClient, KnowledgeBaseClient +from .llm_usage.client import AsyncLlmUsageClient, LlmUsageClient from .phone_numbers.client import AsyncPhoneNumbersClient, PhoneNumbersClient from .raw_client import AsyncRawConversationalAiClient, RawConversationalAiClient from .secrets.client import AsyncSecretsClient, SecretsClient @@ -34,6 +35,8 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): self.phone_numbers = PhoneNumbersClient(client_wrapper=client_wrapper) + self.llm_usage = LlmUsageClient(client_wrapper=client_wrapper) + self.knowledge_base = KnowledgeBaseClient(client_wrapper=client_wrapper) self.settings = SettingsClient(client_wrapper=client_wrapper) @@ -151,6 +154,8 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): self.phone_numbers = AsyncPhoneNumbersClient(client_wrapper=client_wrapper) + self.llm_usage = AsyncLlmUsageClient(client_wrapper=client_wrapper) + self.knowledge_base = AsyncKnowledgeBaseClient(client_wrapper=client_wrapper) self.settings = AsyncSettingsClient(client_wrapper=client_wrapper) diff --git a/src/elevenlabs/conversational_ai/llm_usage/__init__.py b/src/elevenlabs/conversational_ai/llm_usage/__init__.py new file mode 100644 index 00000000..5cde0202 --- /dev/null +++ b/src/elevenlabs/conversational_ai/llm_usage/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/src/elevenlabs/conversational_ai/llm_usage/client.py b/src/elevenlabs/conversational_ai/llm_usage/client.py new file mode 100644 index 00000000..674d9847 --- /dev/null +++ b/src/elevenlabs/conversational_ai/llm_usage/client.py @@ -0,0 +1,153 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.llm_usage_calculator_response_model import LlmUsageCalculatorResponseModel +from .raw_client import AsyncRawLlmUsageClient, RawLlmUsageClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class LlmUsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawLlmUsageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawLlmUsageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawLlmUsageClient + """ + return self._raw_client + + def calculate( + self, + *, + prompt_length: int, + number_of_pages: int, + rag_enabled: bool, + request_options: typing.Optional[RequestOptions] = None, + ) -> LlmUsageCalculatorResponseModel: + """ + Returns a list of LLM models and the expected cost for using them based on the provided values. + + Parameters + ---------- + prompt_length : int + Length of the prompt in characters. + + number_of_pages : int + Pages of content in PDF documents or URLs in the agent's knowledge base. + + rag_enabled : bool + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LlmUsageCalculatorResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.llm_usage.calculate( + prompt_length=1, + number_of_pages=1, + rag_enabled=True, + ) + """ + _response = self._raw_client.calculate( + prompt_length=prompt_length, + number_of_pages=number_of_pages, + rag_enabled=rag_enabled, + request_options=request_options, + ) + return _response.data + + +class AsyncLlmUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawLlmUsageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawLlmUsageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawLlmUsageClient + """ + return self._raw_client + + async def calculate( + self, + *, + prompt_length: int, + number_of_pages: int, + rag_enabled: bool, + request_options: typing.Optional[RequestOptions] = None, + ) -> LlmUsageCalculatorResponseModel: + """ + Returns a list of LLM models and the expected cost for using them based on the provided values. + + Parameters + ---------- + prompt_length : int + Length of the prompt in characters. + + number_of_pages : int + Pages of content in PDF documents or URLs in the agent's knowledge base. + + rag_enabled : bool + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LlmUsageCalculatorResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.llm_usage.calculate( + prompt_length=1, + number_of_pages=1, + rag_enabled=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.calculate( + prompt_length=prompt_length, + number_of_pages=number_of_pages, + rag_enabled=rag_enabled, + request_options=request_options, + ) + return _response.data diff --git a/src/elevenlabs/conversational_ai/llm_usage/raw_client.py b/src/elevenlabs/conversational_ai/llm_usage/raw_client.py new file mode 100644 index 00000000..e35a1096 --- /dev/null +++ b/src/elevenlabs/conversational_ai/llm_usage/raw_client.py @@ -0,0 +1,168 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.http_validation_error import HttpValidationError +from ...types.llm_usage_calculator_response_model import LlmUsageCalculatorResponseModel + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawLlmUsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def calculate( + self, + *, + prompt_length: int, + number_of_pages: int, + rag_enabled: bool, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[LlmUsageCalculatorResponseModel]: + """ + Returns a list of LLM models and the expected cost for using them based on the provided values. + + Parameters + ---------- + prompt_length : int + Length of the prompt in characters. + + number_of_pages : int + Pages of content in PDF documents or URLs in the agent's knowledge base. + + rag_enabled : bool + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[LlmUsageCalculatorResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/llm-usage/calculate", + base_url=self._client_wrapper.get_environment().base, + method="POST", + json={ + "prompt_length": prompt_length, + "number_of_pages": number_of_pages, + "rag_enabled": rag_enabled, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LlmUsageCalculatorResponseModel, + construct_type( + type_=LlmUsageCalculatorResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + HttpValidationError, + construct_type( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawLlmUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def calculate( + self, + *, + prompt_length: int, + number_of_pages: int, + rag_enabled: bool, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[LlmUsageCalculatorResponseModel]: + """ + Returns a list of LLM models and the expected cost for using them based on the provided values. + + Parameters + ---------- + prompt_length : int + Length of the prompt in characters. + + number_of_pages : int + Pages of content in PDF documents or URLs in the agent's knowledge base. + + rag_enabled : bool + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[LlmUsageCalculatorResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/llm-usage/calculate", + base_url=self._client_wrapper.get_environment().base, + method="POST", + json={ + "prompt_length": prompt_length, + "number_of_pages": number_of_pages, + "rag_enabled": rag_enabled, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LlmUsageCalculatorResponseModel, + construct_type( + type_=LlmUsageCalculatorResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + HttpValidationError, + construct_type( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/elevenlabs/core/client_wrapper.py b/src/elevenlabs/core/client_wrapper.py index 3ae4fc22..a47d5a5c 100644 --- a/src/elevenlabs/core/client_wrapper.py +++ b/src/elevenlabs/core/client_wrapper.py @@ -21,10 +21,10 @@ def __init__( def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { - "User-Agent": "elevenlabs/v2.0.0", + "User-Agent": "elevenlabs/v2.1.0", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "v2.0.0", + "X-Fern-SDK-Version": "v2.1.0", } if self._api_key is not None: headers["xi-api-key"] = self._api_key diff --git a/src/elevenlabs/types/__init__.py b/src/elevenlabs/types/__init__.py index 3a6e571c..7ba3f129 100644 --- a/src/elevenlabs/types/__init__.py +++ b/src/elevenlabs/types/__init__.py @@ -21,7 +21,6 @@ from .agent_ban import AgentBan from .agent_call_limits import AgentCallLimits from .agent_config import AgentConfig -from .agent_config_db_model import AgentConfigDbModel from .agent_config_override import AgentConfigOverride from .agent_config_override_config import AgentConfigOverrideConfig from .agent_metadata_response_model import AgentMetadataResponseModel @@ -116,6 +115,7 @@ from .breakdown_types import BreakdownTypes from .chapter_content_block_extendable_node_response_model import ChapterContentBlockExtendableNodeResponseModel from .chapter_content_block_input_model import ChapterContentBlockInputModel +from .chapter_content_block_input_model_sub_type import ChapterContentBlockInputModelSubType from .chapter_content_block_response_model import ChapterContentBlockResponseModel from .chapter_content_block_response_model_nodes_item import ( ChapterContentBlockResponseModelNodesItem, @@ -322,6 +322,7 @@ from .generate_voice_request import GenerateVoiceRequest from .generation_config import GenerationConfig from .get_agent_embed_response_model import GetAgentEmbedResponseModel +from .get_agent_knowledgebase_size_response_model import GetAgentKnowledgebaseSizeResponseModel from .get_agent_link_response_model import GetAgentLinkResponseModel from .get_agent_response_model import GetAgentResponseModel from .get_agent_response_model_phone_numbers_item import ( @@ -428,6 +429,8 @@ from .llm_category_usage import LlmCategoryUsage from .llm_input_output_tokens_usage import LlmInputOutputTokensUsage from .llm_tokens_category_usage import LlmTokensCategoryUsage +from .llm_usage_calculator_llm_response_model import LlmUsageCalculatorLlmResponseModel +from .llm_usage_calculator_response_model import LlmUsageCalculatorResponseModel from .llm_usage_input import LlmUsageInput from .llm_usage_output import LlmUsageOutput from .manual_verification_file_response import ManualVerificationFileResponse @@ -442,6 +445,8 @@ from .moderation_status_response_model import ModerationStatusResponseModel from .moderation_status_response_model_safety_status import ModerationStatusResponseModelSafetyStatus from .moderation_status_response_model_warning_status import ModerationStatusResponseModelWarningStatus +from .native_mcp_tool_config_input import NativeMcpToolConfigInput +from .native_mcp_tool_config_output import NativeMcpToolConfigOutput from .normalized_alignment import NormalizedAlignment from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput from .object_json_schema_property_input_properties_value import ObjectJsonSchemaPropertyInputPropertiesValue @@ -489,6 +494,7 @@ PromptAgentDbModelToolsItem, PromptAgentDbModelToolsItem_Client, PromptAgentDbModelToolsItem_Mcp, + PromptAgentDbModelToolsItem_NativeMcp, PromptAgentDbModelToolsItem_System, PromptAgentDbModelToolsItem_Webhook, ) @@ -496,6 +502,7 @@ PromptAgentInputToolsItem, PromptAgentInputToolsItem_Client, PromptAgentInputToolsItem_Mcp, + PromptAgentInputToolsItem_NativeMcp, PromptAgentInputToolsItem_System, PromptAgentInputToolsItem_Webhook, ) @@ -503,6 +510,7 @@ PromptAgentOutputToolsItem, PromptAgentOutputToolsItem_Client, PromptAgentOutputToolsItem_Mcp, + PromptAgentOutputToolsItem_NativeMcp, PromptAgentOutputToolsItem_System, PromptAgentOutputToolsItem_Webhook, ) @@ -707,7 +715,6 @@ "AgentBan", "AgentCallLimits", "AgentConfig", - "AgentConfigDbModel", "AgentConfigOverride", "AgentConfigOverrideConfig", "AgentMetadataResponseModel", @@ -770,6 +777,7 @@ "BreakdownTypes", "ChapterContentBlockExtendableNodeResponseModel", "ChapterContentBlockInputModel", + "ChapterContentBlockInputModelSubType", "ChapterContentBlockResponseModel", "ChapterContentBlockResponseModelNodesItem", "ChapterContentBlockResponseModelNodesItem_Other", @@ -942,6 +950,7 @@ "GenerateVoiceRequest", "GenerationConfig", "GetAgentEmbedResponseModel", + "GetAgentKnowledgebaseSizeResponseModel", "GetAgentLinkResponseModel", "GetAgentResponseModel", "GetAgentResponseModelPhoneNumbersItem", @@ -1032,6 +1041,8 @@ "LlmCategoryUsage", "LlmInputOutputTokensUsage", "LlmTokensCategoryUsage", + "LlmUsageCalculatorLlmResponseModel", + "LlmUsageCalculatorResponseModel", "LlmUsageInput", "LlmUsageOutput", "ManualVerificationFileResponse", @@ -1046,6 +1057,8 @@ "ModerationStatusResponseModel", "ModerationStatusResponseModelSafetyStatus", "ModerationStatusResponseModelWarningStatus", + "NativeMcpToolConfigInput", + "NativeMcpToolConfigOutput", "NormalizedAlignment", "ObjectJsonSchemaPropertyInput", "ObjectJsonSchemaPropertyInputPropertiesValue", @@ -1092,16 +1105,19 @@ "PromptAgentDbModelToolsItem", "PromptAgentDbModelToolsItem_Client", "PromptAgentDbModelToolsItem_Mcp", + "PromptAgentDbModelToolsItem_NativeMcp", "PromptAgentDbModelToolsItem_System", "PromptAgentDbModelToolsItem_Webhook", "PromptAgentInputToolsItem", "PromptAgentInputToolsItem_Client", "PromptAgentInputToolsItem_Mcp", + "PromptAgentInputToolsItem_NativeMcp", "PromptAgentInputToolsItem_System", "PromptAgentInputToolsItem_Webhook", "PromptAgentOutputToolsItem", "PromptAgentOutputToolsItem_Client", "PromptAgentOutputToolsItem_Mcp", + "PromptAgentOutputToolsItem_NativeMcp", "PromptAgentOutputToolsItem_System", "PromptAgentOutputToolsItem_Webhook", "PromptAgentOverride", diff --git a/src/elevenlabs/types/agent_config.py b/src/elevenlabs/types/agent_config.py index a5014e52..cfbc6afe 100644 --- a/src/elevenlabs/types/agent_config.py +++ b/src/elevenlabs/types/agent_config.py @@ -8,7 +8,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs from ..core.unchecked_base_model import UncheckedBaseModel from .dynamic_variables_config import DynamicVariablesConfig -from .prompt_agent import PromptAgent +from .prompt_agent_db_model import PromptAgentDbModel class AgentConfig(UncheckedBaseModel): @@ -27,10 +27,7 @@ class AgentConfig(UncheckedBaseModel): Configuration for dynamic variables """ - prompt: typing.Optional[PromptAgent] = pydantic.Field(default=None) - """ - The prompt for the agent - """ + prompt: typing.Optional[PromptAgentDbModel] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -42,7 +39,7 @@ class Config: extra = pydantic.Extra.allow -from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput # noqa: E402, F401, I001 -from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput # noqa: E402, F401, I001 +from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput # noqa: E402, F401, I001 +from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput # noqa: E402, F401, I001 update_forward_refs(AgentConfig) diff --git a/src/elevenlabs/types/audio_output_multi.py b/src/elevenlabs/types/audio_output_multi.py index 970d969c..36f592aa 100644 --- a/src/elevenlabs/types/audio_output_multi.py +++ b/src/elevenlabs/types/audio_output_multi.py @@ -25,9 +25,11 @@ class AudioOutputMulti(UncheckedBaseModel): typing.Optional[NormalizedAlignment], FieldMetadata(alias="normalizedAlignment") ] = None alignment: typing.Optional[Alignment] = None - context_id: typing.Optional[str] = pydantic.Field(default=None) + context_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="contextId")] = pydantic.Field( + default=None + ) """ - The context_id for which this audio is. + The contextId for which this audio is. """ if IS_PYDANTIC_V2: diff --git a/src/elevenlabs/types/chapter_content_block_input_model.py b/src/elevenlabs/types/chapter_content_block_input_model.py index 28aed629..6a861dc4 100644 --- a/src/elevenlabs/types/chapter_content_block_input_model.py +++ b/src/elevenlabs/types/chapter_content_block_input_model.py @@ -5,10 +5,12 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel +from .chapter_content_block_input_model_sub_type import ChapterContentBlockInputModelSubType from .chapter_content_paragraph_tts_node_input_model import ChapterContentParagraphTtsNodeInputModel class ChapterContentBlockInputModel(UncheckedBaseModel): + sub_type: typing.Optional[ChapterContentBlockInputModelSubType] = None block_id: typing.Optional[str] = None nodes: typing.List[ChapterContentParagraphTtsNodeInputModel] diff --git a/src/elevenlabs/types/chapter_content_block_input_model_sub_type.py b/src/elevenlabs/types/chapter_content_block_input_model_sub_type.py new file mode 100644 index 00000000..4974b86a --- /dev/null +++ b/src/elevenlabs/types/chapter_content_block_input_model_sub_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ChapterContentBlockInputModelSubType = typing.Union[typing.Literal["p", "h1", "h2", "h3"], typing.Any] diff --git a/src/elevenlabs/types/conversation_simulation_specification.py b/src/elevenlabs/types/conversation_simulation_specification.py index fe31e824..72085efc 100644 --- a/src/elevenlabs/types/conversation_simulation_specification.py +++ b/src/elevenlabs/types/conversation_simulation_specification.py @@ -7,7 +7,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs from ..core.unchecked_base_model import UncheckedBaseModel -from .agent_config_db_model import AgentConfigDbModel +from .agent_config import AgentConfig from .conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput from .tool_mock_config import ToolMockConfig @@ -17,7 +17,7 @@ class ConversationSimulationSpecification(UncheckedBaseModel): A specification that will be used to simulate a conversation between an agent and an AI user. """ - simulated_user_config: AgentConfigDbModel + simulated_user_config: AgentConfig tool_mock_config: typing.Optional[typing.Dict[str, ToolMockConfig]] = None partial_conversation_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = ( pydantic.Field(default=None) diff --git a/src/elevenlabs/types/conversation_token_db_model.py b/src/elevenlabs/types/conversation_token_db_model.py index c20e96bf..8b8d6475 100644 --- a/src/elevenlabs/types/conversation_token_db_model.py +++ b/src/elevenlabs/types/conversation_token_db_model.py @@ -24,6 +24,11 @@ class ConversationTokenDbModel(UncheckedBaseModel): The expiration time of the token in unix seconds """ + conversation_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the conversation + """ + purpose: typing.Optional[ConversationTokenPurpose] = pydantic.Field(default=None) """ The purpose of the token diff --git a/src/elevenlabs/types/conversational_config.py b/src/elevenlabs/types/conversational_config.py index 5bc34bd1..c574fedd 100644 --- a/src/elevenlabs/types/conversational_config.py +++ b/src/elevenlabs/types/conversational_config.py @@ -56,7 +56,7 @@ class Config: extra = pydantic.Extra.allow -from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput # noqa: E402, F401, I001 -from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput # noqa: E402, F401, I001 +from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput # noqa: E402, F401, I001 +from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput # noqa: E402, F401, I001 update_forward_refs(ConversationalConfig) diff --git a/src/elevenlabs/types/get_agent_knowledgebase_size_response_model.py b/src/elevenlabs/types/get_agent_knowledgebase_size_response_model.py new file mode 100644 index 00000000..d94234f7 --- /dev/null +++ b/src/elevenlabs/types/get_agent_knowledgebase_size_response_model.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetAgentKnowledgebaseSizeResponseModel(UncheckedBaseModel): + number_of_pages: float + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/elevenlabs/types/get_agent_response_model.py b/src/elevenlabs/types/get_agent_response_model.py index 6e37d263..eb8d13ec 100644 --- a/src/elevenlabs/types/get_agent_response_model.py +++ b/src/elevenlabs/types/get_agent_response_model.py @@ -65,7 +65,7 @@ class Config: extra = pydantic.Extra.allow -from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput # noqa: E402, F401, I001 -from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput # noqa: E402, F401, I001 +from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput # noqa: E402, F401, I001 +from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput # noqa: E402, F401, I001 update_forward_refs(GetAgentResponseModel) diff --git a/src/elevenlabs/types/llm_usage_calculator_llm_response_model.py b/src/elevenlabs/types/llm_usage_calculator_llm_response_model.py new file mode 100644 index 00000000..ec18a357 --- /dev/null +++ b/src/elevenlabs/types/llm_usage_calculator_llm_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm import Llm + + +class LlmUsageCalculatorLlmResponseModel(UncheckedBaseModel): + llm: Llm + price_per_minute: float + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/elevenlabs/types/llm_usage_calculator_response_model.py b/src/elevenlabs/types/llm_usage_calculator_response_model.py new file mode 100644 index 00000000..11719464 --- /dev/null +++ b/src/elevenlabs/types/llm_usage_calculator_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm_usage_calculator_llm_response_model import LlmUsageCalculatorLlmResponseModel + + +class LlmUsageCalculatorResponseModel(UncheckedBaseModel): + llm_prices: typing.List[LlmUsageCalculatorLlmResponseModel] + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/elevenlabs/types/agent_config_db_model.py b/src/elevenlabs/types/native_mcp_tool_config_input.py similarity index 52% rename from src/elevenlabs/types/agent_config_db_model.py rename to src/elevenlabs/types/native_mcp_tool_config_input.py index e71cd570..9f951341 100644 --- a/src/elevenlabs/types/agent_config_db_model.py +++ b/src/elevenlabs/types/native_mcp_tool_config_input.py @@ -7,27 +7,35 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs from ..core.unchecked_base_model import UncheckedBaseModel -from .dynamic_variables_config import DynamicVariablesConfig -from .prompt_agent_db_model import PromptAgentDbModel -class AgentConfigDbModel(UncheckedBaseModel): - first_message: typing.Optional[str] = pydantic.Field(default=None) +class NativeMcpToolConfigInput(UncheckedBaseModel): """ - If non-empty, the first message the agent will say. If empty, the agent waits for the user to start the discussion. + A Native MCP tool is a tool that is used to call a Native MCP server """ - language: typing.Optional[str] = pydantic.Field(default=None) + id: typing.Optional[str] = None + name: str + description: str + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) """ - Language of the agent - used for ASR and TTS + The maximum time in seconds to wait for the tool call to complete. """ - dynamic_variables: typing.Optional[DynamicVariablesConfig] = pydantic.Field(default=None) + parameters: typing.Optional["ObjectJsonSchemaPropertyInput"] = pydantic.Field(default=None) """ - Configuration for dynamic variables + Schema for any parameters the LLM needs to provide to the MCP tool. """ - prompt: typing.Optional[PromptAgentDbModel] = None + mcp_tool_name: str = pydantic.Field() + """ + The name of the MCP tool to call + """ + + mcp_server_id: str = pydantic.Field() + """ + The id of the MCP server to call + """ if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -42,4 +50,4 @@ class Config: from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput # noqa: E402, F401, I001 from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput # noqa: E402, F401, I001 -update_forward_refs(AgentConfigDbModel) +update_forward_refs(NativeMcpToolConfigInput) diff --git a/src/elevenlabs/types/native_mcp_tool_config_output.py b/src/elevenlabs/types/native_mcp_tool_config_output.py new file mode 100644 index 00000000..663c91cd --- /dev/null +++ b/src/elevenlabs/types/native_mcp_tool_config_output.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class NativeMcpToolConfigOutput(UncheckedBaseModel): + """ + A Native MCP tool is a tool that is used to call a Native MCP server + """ + + id: typing.Optional[str] = None + name: str + description: str + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum time in seconds to wait for the tool call to complete. + """ + + parameters: typing.Optional["ObjectJsonSchemaPropertyOutput"] = pydantic.Field(default=None) + """ + Schema for any parameters the LLM needs to provide to the MCP tool. + """ + + mcp_tool_name: str = pydantic.Field() + """ + The name of the MCP tool to call + """ + + mcp_server_id: str = pydantic.Field() + """ + The id of the MCP server to call + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput # noqa: E402, F401, I001 +from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput # noqa: E402, F401, I001 + +update_forward_refs(NativeMcpToolConfigOutput) diff --git a/src/elevenlabs/types/prompt_agent.py b/src/elevenlabs/types/prompt_agent.py index b74828bd..f31de1cd 100644 --- a/src/elevenlabs/types/prompt_agent.py +++ b/src/elevenlabs/types/prompt_agent.py @@ -50,6 +50,11 @@ class PromptAgent(UncheckedBaseModel): A list of MCP server ids to be used by the agent """ + native_mcp_server_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of Native MCP server ids to be used by the agent + """ + knowledge_base: typing.Optional[typing.List[KnowledgeBaseLocator]] = pydantic.Field(default=None) """ A list of knowledge bases to be used by the agent diff --git a/src/elevenlabs/types/prompt_agent_db_model.py b/src/elevenlabs/types/prompt_agent_db_model.py index 5b04d3c3..19f53f17 100644 --- a/src/elevenlabs/types/prompt_agent_db_model.py +++ b/src/elevenlabs/types/prompt_agent_db_model.py @@ -50,6 +50,11 @@ class PromptAgentDbModel(UncheckedBaseModel): A list of MCP server ids to be used by the agent """ + native_mcp_server_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of Native MCP server ids to be used by the agent + """ + knowledge_base: typing.Optional[typing.List[KnowledgeBaseLocator]] = pydantic.Field(default=None) """ A list of knowledge bases to be used by the agent diff --git a/src/elevenlabs/types/prompt_agent_db_model_tools_item.py b/src/elevenlabs/types/prompt_agent_db_model_tools_item.py index 8095aa13..3258b303 100644 --- a/src/elevenlabs/types/prompt_agent_db_model_tools_item.py +++ b/src/elevenlabs/types/prompt_agent_db_model_tools_item.py @@ -61,6 +61,30 @@ class Config: extra = pydantic.Extra.allow +class PromptAgentDbModelToolsItem_NativeMcp(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["native_mcp"] = "native_mcp" + id: typing.Optional[str] = None + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + parameters: typing.Optional["ObjectJsonSchemaPropertyInput"] = None + mcp_tool_name: str + mcp_server_id: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + class PromptAgentDbModelToolsItem_System(UncheckedBaseModel): """ The type of tool @@ -113,6 +137,7 @@ class Config: typing.Union[ PromptAgentDbModelToolsItem_Client, PromptAgentDbModelToolsItem_Mcp, + PromptAgentDbModelToolsItem_NativeMcp, PromptAgentDbModelToolsItem_System, PromptAgentDbModelToolsItem_Webhook, ], @@ -120,4 +145,5 @@ class Config: ] update_forward_refs(PromptAgentDbModelToolsItem_Client) update_forward_refs(PromptAgentDbModelToolsItem_Mcp) +update_forward_refs(PromptAgentDbModelToolsItem_NativeMcp) update_forward_refs(PromptAgentDbModelToolsItem_Webhook) diff --git a/src/elevenlabs/types/prompt_agent_input_tools_item.py b/src/elevenlabs/types/prompt_agent_input_tools_item.py index 8237ce95..97b91137 100644 --- a/src/elevenlabs/types/prompt_agent_input_tools_item.py +++ b/src/elevenlabs/types/prompt_agent_input_tools_item.py @@ -61,6 +61,30 @@ class Config: extra = pydantic.Extra.allow +class PromptAgentInputToolsItem_NativeMcp(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["native_mcp"] = "native_mcp" + id: typing.Optional[str] = None + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + parameters: typing.Optional["ObjectJsonSchemaPropertyInput"] = None + mcp_tool_name: str + mcp_server_id: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + class PromptAgentInputToolsItem_System(UncheckedBaseModel): """ The type of tool @@ -113,6 +137,7 @@ class Config: typing.Union[ PromptAgentInputToolsItem_Client, PromptAgentInputToolsItem_Mcp, + PromptAgentInputToolsItem_NativeMcp, PromptAgentInputToolsItem_System, PromptAgentInputToolsItem_Webhook, ], @@ -120,4 +145,5 @@ class Config: ] update_forward_refs(PromptAgentInputToolsItem_Client) update_forward_refs(PromptAgentInputToolsItem_Mcp) +update_forward_refs(PromptAgentInputToolsItem_NativeMcp) update_forward_refs(PromptAgentInputToolsItem_Webhook) diff --git a/src/elevenlabs/types/prompt_agent_output_tools_item.py b/src/elevenlabs/types/prompt_agent_output_tools_item.py index 73f915da..fa04de96 100644 --- a/src/elevenlabs/types/prompt_agent_output_tools_item.py +++ b/src/elevenlabs/types/prompt_agent_output_tools_item.py @@ -61,6 +61,30 @@ class Config: extra = pydantic.Extra.allow +class PromptAgentOutputToolsItem_NativeMcp(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["native_mcp"] = "native_mcp" + id: typing.Optional[str] = None + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + parameters: typing.Optional["ObjectJsonSchemaPropertyOutput"] = None + mcp_tool_name: str + mcp_server_id: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + class PromptAgentOutputToolsItem_System(UncheckedBaseModel): """ The type of tool @@ -113,6 +137,7 @@ class Config: typing.Union[ PromptAgentOutputToolsItem_Client, PromptAgentOutputToolsItem_Mcp, + PromptAgentOutputToolsItem_NativeMcp, PromptAgentOutputToolsItem_System, PromptAgentOutputToolsItem_Webhook, ], @@ -120,4 +145,5 @@ class Config: ] update_forward_refs(PromptAgentOutputToolsItem_Client) update_forward_refs(PromptAgentOutputToolsItem_Mcp) +update_forward_refs(PromptAgentOutputToolsItem_NativeMcp) update_forward_refs(PromptAgentOutputToolsItem_Webhook) diff --git a/src/elevenlabs/types/websocket_tts_client_message_multi.py b/src/elevenlabs/types/websocket_tts_client_message_multi.py index 376cc3e1..88896363 100644 --- a/src/elevenlabs/types/websocket_tts_client_message_multi.py +++ b/src/elevenlabs/types/websocket_tts_client_message_multi.py @@ -59,19 +59,21 @@ class WebsocketTtsClientMessageMulti(UncheckedBaseModel): Optional list of pronunciation dictionary locators. Can only be provided in the first message for a given context_id. """ - context_id: typing.Optional[str] = pydantic.Field(default=None) + context_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="contextId")] = pydantic.Field( + default=None + ) """ An identifier for the text-to-speech context. Allows managing multiple independent audio generation streams over a single WebSocket connection. If omitted, a default context is used. """ close_context: typing.Optional[bool] = pydantic.Field(default=None) """ - If true, closes the specified `context_id`. No further audio will be generated for this context. The `text` field is ignored. + If true, closes the specified `contextId`. No further audio will be generated for this context. The `text` field is ignored. """ close_socket: typing.Optional[bool] = pydantic.Field(default=None) """ - If true, flushes all contexts and closes the entire WebSocket connection. The `text` and `context_id` fields are ignored. + If true, flushes all contexts and closes the entire WebSocket connection. The `text` and `contextId` fields are ignored. """ if IS_PYDANTIC_V2: