### Install pytz Dependency Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/examples/tool_calling-1/README.md This example requires the `pytz` library for timezone support. Install it using pip. ```bash pip install pytz ``` -------------------------------- ### Install Smallest AI Python SDK Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt Install the SDK using pip. Set your API key as an environment variable. ```bash pip install smallestai ``` ```bash export SMALLEST_API_KEY="your_api_key_here" ``` -------------------------------- ### Start Campaign Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/CampaignsApi.md Starts a paused or new campaign. ```APIDOC ## POST /campaign/{id}/start ### Description Start a paused or new campaign. ### Method POST ### Endpoint /campaign/{id}/start ### Parameters #### Path Parameters - **id** (str) - Required - Campaign ID to start ### Response #### Success Response (200) - **data** (DeleteAgent200Response) - Description of the response data ### Request Example ```python "your_campaign_id" ``` ``` -------------------------------- ### Install Smallest Python SDK Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/README.md Install the latest version of the smallestai package using pip. It is recommended to pin to at least the major version for stability. ```bash pip install smallestai ``` -------------------------------- ### Agent Creation and Management Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt Examples for creating, listing, retrieving, updating, and deleting agents using the Smallest Python SDK. ```APIDOC ## Simple Agent Creation ### Description Creates a new agent with basic configuration. ### Method `client.new_agent` ### Parameters - **name** (string) - Required - The name of the agent. - **prompt** (string) - Required - The system prompt for the agent. - **description** (string) - Optional - A description for the agent. - **background_sound** (string) - Optional - The background sound for the agent ('', 'office', 'cafe', 'call_center', 'static'). ### Request Example ```python response = client.new_agent( name="Customer Support Bot", prompt="You are a helpful customer support agent for Acme Corp. Be concise and friendly.", description="Handles inbound customer queries", background_sound="office" ) agent_id = response.data print(f"Created agent: {agent_id}") ``` ## Full Agent Creation ### Description Creates a new agent with detailed configuration, including language and synthesizer settings. ### Method `client.create_agent` ### Parameters - **create_agent_request** (CreateAgentRequest) - Required - The request object containing agent details. - **name** (string) - Required - The name of the agent. - **description** (string) - Optional - A description for the agent. - **language** (dict) - Optional - Language configuration. Example: `{"enabled": "en", "switching": False}`. - **synthesizer** (dict) - Optional - Synthesizer configuration. Example: `{"voiceConfig": {"model": "waves_lightning_large", "voiceId": "nyah"}, "speed": 1.1, "consistency": 0.5, "similarity": 0.0, "enhancement": 1}`. - **slm_model** (string) - Optional - The SLM model to use. ### Request Example ```python request = CreateAgentRequest( name="Sales Agent", description="Outbound sales agent for SMB market", language={"enabled": "en", "switching": False}, synthesizer={ "voiceConfig": { "model": "waves_lightning_large", "voiceId": "nyah" }, "speed": 1.1, "consistency": 0.5, "similarity": 0.0, "enhancement": 1 }, slm_model="electron" ) response = client.create_agent(create_agent_request=request) agent_id = response.data print(f"Created agent: {agent_id}") ``` ## List Agents ### Description Retrieves a list of agents with support for pagination and search. ### Method `client.get_agents` ### Parameters - **page** (int) - Optional - The page number for pagination. - **offset** (int) - Optional - The offset for pagination. - **search** (string) - Optional - Search term for filtering agents. ### Request Example ```python agents_response = client.get_agents(page=1, offset=10, search="support") print(agents_response) ``` ## Get Agent by ID ### Description Retrieves a single agent's details by its ID. ### Method `client.get_agent_by_id` ### Parameters - **id** (string) - Required - The ID of the agent to retrieve. ### Request Example ```python agent = client.get_agent_by_id(id=agent_id) print(agent) ``` ## Update Agent ### Description Updates specific fields of an existing agent. ### Method `client.update_agent` ### Parameters - **id** (string) - Required - The ID of the agent to update. - **agent_id_patch_request** (AgentIdPatchRequest) - Required - The request object containing fields to update. - **name** (string) - Optional - The new name for the agent. - **description** (string) - Optional - The new description for the agent. ### Request Example ```python from smallestai.atoms.models import AgentIdPatchRequest update = AgentIdPatchRequest(name="Renamed Agent", description="Updated description") client.update_agent(id=agent_id, agent_id_patch_request=update) ``` ## Delete Agent ### Description Deletes (archives) an agent. ### Method `client.delete_agent` ### Parameters - **id** (string) - Required - The ID of the agent to delete. ### Request Example ```python client.delete_agent(id=agent_id) ``` ``` -------------------------------- ### CampaignGet200ResponseData Usage Example Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/CampaignGet200ResponseData.md Example demonstrating how to instantiate and use the CampaignGet200ResponseData model in Python, including conversion to and from JSON and dictionaries. ```APIDOC ## Example Usage ```python from atoms.models.campaign_get200_response_data import CampaignGet200ResponseData # TODO update the JSON string below json_string = "{}" # Create an instance of CampaignGet200ResponseData from a JSON string campaign_get200_response_data_instance = CampaignGet200ResponseData.from_json(json_string) # Print the JSON string representation of the object print(CampaignGet200ResponseData.to_json()) # Convert the object into a dict campaign_get200_response_data_dict = campaign_get200_response_data_instance.to_dict() # Create an instance of CampaignGet200ResponseData from a dict campaign_get200_response_data_from_dict = CampaignGet200ResponseData.from_dict(campaign_get200_response_data_dict) ``` ``` -------------------------------- ### Start Campaign with AtomsClient Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/CampaignsApi.md Initiate a paused or new campaign by providing its ID to the `start_campaign` method. The `AtomsClient` must be initialized first. ```python from smallestai.atoms import AtomsClient def main(): atoms_client = AtomsClient() campaign_id = "your_campaign_id" response = atoms_client.start_campaign(id=campaign_id) print("Campaign started successfully") if __name__ == "__main__": main() ``` -------------------------------- ### ApiResponse Usage Example Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/ApiResponse.md Example demonstrating how to create and manipulate ApiResponse objects using Python. ```APIDOC ## Example ```python from atoms.models.api_response import ApiResponse # TODO update the JSON string below json = "{}" # create an instance of ApiResponse from a JSON string api_response_instance = ApiResponse.from_json(json) # print the JSON string representation of the object print(ApiResponse.to_json()) # convert the object into a dict api_response_dict = api_response_instance.to_dict() # create an instance of ApiResponse from a dict api_response_from_dict = ApiResponse.from_dict(api_response_dict) ``` ``` -------------------------------- ### Start an Active Campaign Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt Initiate a previously created campaign. This begins the outbound calling process. ```python # Start the campaign start_result = client.start_campaign(id=campaign_id) print(f"Campaign started: {start_result}") ``` -------------------------------- ### Atoms: Client Setup and Configuration Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt Sets up the main entry point for the Atoms platform. Automatically reads the API key from the environment or allows custom configuration for host, access token, and HTTP settings. ```APIDOC ## Atoms: Client Setup and Configuration — `AtomsClient` / `Configuration` `AtomsClient` is the main entry point for the Atoms platform. It auto-reads `SMALLEST_API_KEY` from the environment. A custom `Configuration` object can override the host, access token, or other HTTP settings. ```python import os from smallestai.atoms import AtomsClient from smallestai.atoms.configuration import Configuration # Default: reads SMALLEST_API_KEY from environment, uses production host client = AtomsClient() # Custom configuration config = Configuration( access_token=os.environ["SMALLEST_API_KEY"], host="https://atoms-api.smallest.ai/api/v1", # default; override for custom deployments retries=3, ) client = AtomsClient(configuration=config) # Verify connectivity - get current user user = client.get_current_user() print(user) # Get organization details org = client.get_organization() print(org) ``` ``` -------------------------------- ### Atoms Client Setup with Default Configuration Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt Initializes the AtomsClient using default settings, which includes reading the API key from the SMALLEST_API_KEY environment variable and using the production host. ```python import os from smallestai.atoms import AtomsClient # Default: reads SMALLEST_API_KEY from environment, uses production host client = AtomsClient() ``` -------------------------------- ### Get Available SDK Methods Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/README.md This snippet demonstrates how to use the Smallest client to fetch lists of available languages, cloned voices, and models. Specify the model parameter for voice retrieval if needed. ```python from smallest import Smallest client = Smallest(api_key="SMALLEST_API_KEY") print(f"Available Languages: {client.get_languages()}") print(f"Available Voices: {client.get_voices(model='lightning')}") print(f"Available Voices: {client.get_cloned_voices()}") print(f"Available Models: {client.get_models()}") ``` -------------------------------- ### WebhookGet200ResponseData Usage Example Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/WebhookGet200ResponseData.md Example demonstrating how to use the WebhookGet200ResponseData model in Python, including instantiation from JSON, conversion to a dictionary, and vice versa. ```python from atoms.models.webhook_get200_response_data import WebhookGet200ResponseData # TODO update the JSON string below json_string = "{}" # create an instance of WebhookGet200ResponseData from a JSON string webhook_get200_response_data_instance = WebhookGet200ResponseData.from_json(json_string) # print the JSON string representation of the object print(WebhookGet200ResponseData.to_json()) # convert the object into a dict webhook_get200_response_data_dict = webhook_get200_response_data_instance.to_dict() # create an instance of WebhookGet200ResponseData from a dict webhook_get200_response_data_from_dict = WebhookGet200ResponseData.from_dict(webhook_get200_response_data_dict) ``` -------------------------------- ### CampaignIdGet200ResponseData Usage Example Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/CampaignIdGet200ResponseData.md Example demonstrating how to use the CampaignIdGet200ResponseData model in Python, including instantiation from JSON and conversion to/from dictionaries. ```APIDOC ## Example ```python from atoms.models.campaign_id_get200_response_data import CampaignIdGet200ResponseData # TODO update the JSON string below json = "{}" # create an instance of CampaignIdGet200ResponseData from a JSON string campaign_id_get200_response_data_instance = CampaignIdGet200ResponseData.from_json(json) # print the JSON string representation of the object print(CampaignIdGet200ResponseData.to_json()) # convert the object into a dict campaign_id_get200_response_data_dict = campaign_id_get200_response_data_instance.to_dict() # create an instance of CampaignIdGet200ResponseData from a dict campaign_id_get200_response_data_from_dict = CampaignIdGet200ResponseData.from_dict(campaign_id_get200_response_data_dict) ``` ``` -------------------------------- ### CreateAgentRequestLanguageSynthesizerVoiceConfig Example Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/CreateAgentRequestLanguageSynthesizerVoiceConfig.md Demonstrates how to create an instance of CreateAgentRequestLanguageSynthesizerVoiceConfig from a JSON string and convert it to a dictionary, and vice versa. Ensure the JSON string is valid and properly formatted. ```python from atoms.models.create_agent_request_language_synthesizer_voice_config import CreateAgentRequestLanguageSynthesizerVoiceConfig # TODO update the JSON string below json = "{}" # create an instance of CreateAgentRequestLanguageSynthesizerVoiceConfig from a JSON string create_agent_request_language_synthesizer_voice_config_instance = CreateAgentRequestLanguageSynthesizerVoiceConfig.from_json(json) # print the JSON string representation of the object print(CreateAgentRequestLanguageSynthesizerVoiceConfig.to_json()) # convert the object into a dict create_agent_request_language_synthesizer_voice_config_dict = create_agent_request_language_synthesizer_voice_config_instance.to_dict() # create an instance of CreateAgentRequestLanguageSynthesizerVoiceConfig from a dict create_agent_request_language_synthesizer_voice_config_from_dict = CreateAgentRequestLanguageSynthesizerVoiceConfig.from_dict(create_agent_request_language_synthesizer_voice_config_dict) ``` -------------------------------- ### Provide Context to an Agent with Python Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/README.md Attach a knowledge base to an agent for it to reference during conversations. This example demonstrates creating a knowledge base, uploading a PDF file to it, and associating it with the agent. Assumes the API key is set as an environment variable `SMALLEST_API_KEY`. ```python from smallestai.atoms import AtomsClient def main(): # assumes you have exported API_KEY in SMALLEST_API_KEY environment variable atoms_client = AtomsClient() # Create a new knowledge base knowledge_base = atoms_client.create_knowledge_base( create_knowledge_base_request={ "name": "Customer Support Knowledge Base", "description": "Contains FAQs and product information" } ) knowledge_base_id = knowledge_base.data with open("product_manual.pdf", "rb") as f: media_content = f.read() media_response = atoms_client.upload_media_to_knowledge_base( id=knowledge_base_id, media=media_content ) print("Added product_manual.pdf to knowledge base") if __name__ == "__main__": main() ``` -------------------------------- ### Get All Knowledge Bases using Python Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/KnowledgeBaseApi.md Retrieve a list of all available knowledge bases. Requires an initialized AtomsClient. ```python from smallestai.atoms import AtomsClient def main(): atoms_client = AtomsClient() response = atoms_client.get_knowledge_bases() print(f"Knowledge bases: {response.data}") if __name__ == "__main__": main() ``` -------------------------------- ### Atoms SDK Agent Server Setup Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt This section outlines how to create a FastAPI-based WebSocket server using AtomsApp, subclassing OutputAgentNode, and defining tools with `@function_tool`. ```APIDOC ## Atoms SDK Agent Server — `AtomsApp` / `OutputAgentNode` / `function_tool` `AtomsApp` is a FastAPI-based WebSocket server that hosts local agent logic. Developers subclass `OutputAgentNode`, implement `generate_response()`, and optionally decorate methods with `@function_tool` to expose callable tools to the LLM. The server connects to the Atoms platform over WebSocket. ```python import os import asyncio from dotenv import load_dotenv from smallestai.atoms.agent.server import AtomsApp from smallestai.atoms.agent.session import AgentSession from smallestai.atoms.agent.nodes import OutputAgentNode from smallestai.atoms.agent.clients.openai import OpenAIClient from smallestai.atoms.agent.tools import ToolRegistry, function_tool from smallestai.atoms.agent.events import SDKAgentEndCallEvent load_dotenv() class CustomerSupportAgent(OutputAgentNode): """Voice agent with tool calling capabilities.""" def __init__(self): super().__init__(name="customer-support-agent") self.llm = OpenAIClient( model="gpt-4o-mini", temperature=0.5, api_key=os.getenv("OPENAI_API_KEY") ) # Auto-discover all @function_tool methods on this instance self.tool_registry = ToolRegistry() self.tool_registry.discover(self) self.tool_schemas = self.tool_registry.get_schemas() self.context.add_message({ "role": "system", "content": "You are a helpful customer support agent. Use tools to assist customers." }) async def generate_response(self): """Stream LLM response and handle tool calls.""" response = await self.llm.chat( messages=self.context.messages, stream=True, tools=self.tool_schemas ) tool_calls = [] async for chunk in response: if chunk.content: yield chunk.content if chunk.tool_calls: tool_calls.extend(chunk.tool_calls) if tool_calls: results = await self.tool_registry.execute(tool_calls=tool_calls, parallel=True) self.context.add_messages([ { "role": "assistant", "content": "", "tool_calls": [ {"id": tc.id, "type": "function", "function": {"name": tc.name, "arguments": str(tc.arguments)}} for tc in tool_calls ] }, *[{"role": "tool", "tool_call_id": tc.id, "content": str(r)} for tc, r in zip(tool_calls, results)] ]) async for chunk in await self.llm.chat(messages=self.context.messages, stream=True): if chunk.content: yield chunk.content @function_tool() def check_order_status(self, order_id: str) -> dict: """Check the status of a customer order. Args: order_id: The order ID to look up (e.g., "ORD-12345") """ # In production, query your order management system here mock_orders = { "ORD-12345": {"status": "shipped", "eta": "2024-12-20"}, "ORD-99999": {"status": "processing", "eta": "2024-12-25"} } return mock_orders.get(order_id, {"status": "not_found", "eta": None}) @function_tool() async def end_call(self) -> None: """End the call when the user is satisfied or requests to hang up.""" await self.send_event(SDKAgentEndCallEvent()) return None async def setup_session(session: AgentSession): """Called for each new incoming WebSocket connection.""" agent = CustomerSupportAgent() session.add_node(agent) await session.start() # Create and run the server app = AtomsApp(setup_handler=setup_session) if __name__ == "__main__": app.run(port=8080) # Server listens at ws://0.0.0.0:8080/ws # Health check at http://0.0.0.0:8080/health ``` ``` -------------------------------- ### Atoms Client Setup with Custom Configuration Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt Initializes the AtomsClient with a custom Configuration object, allowing overrides for host, access token, and HTTP settings like retries. ```python import os from smallestai.atoms import AtomsClient from smallestai.atoms.configuration import Configuration # Custom configuration config = Configuration( access_token=os.environ["SMALLEST_API_KEY"], host="https://atoms-api.smallest.ai/api/v1", # default; override for custom deployments retries=3, ) client = AtomsClient(configuration=config) ``` -------------------------------- ### Start Outbound Call - Python Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/CallsApi.md Use this snippet to initiate an outbound call. Ensure you have the AtomsClient initialized and provide a valid agent ID and phone number in the request. ```python from smallestai.atoms import AtomsClient def main(): atoms_client = AtomsClient() call_request = { "agent_id": "your_agent_id", "phone_number": "+1234567890" } response = atoms_client.start_outbound_call(start_outbound_call_request=call_request) print(f"Started call with conversation ID: {response.conversation_id}") if __name__ == "__main__": main() ``` -------------------------------- ### AgentDTOSynthesizerVoiceConfig Usage Example Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/AgentDTOSynthesizerVoiceConfig.md Demonstrates how to create an instance of AgentDTOSynthesizerVoiceConfig from a JSON string, convert it to a dictionary, and create it from a dictionary. Requires the AgentDTOSynthesizerVoiceConfig class to be imported. ```python from atoms.models.agent_dto_synthesizer_voice_config import AgentDTOSynthesizerVoiceConfig # TODO update the JSON string below json = "{}" # create an instance of AgentDTOSynthesizerVoiceConfig from a JSON string agent_dto_synthesizer_voice_config_instance = AgentDTOSynthesizerVoiceConfig.from_json(json) # print the JSON string representation of the object print(AgentDTOSynthesizerVoiceConfig.to_json()) # convert the object into a dict agent_dto_synthesizer_voice_config_dict = agent_dto_synthesizer_voice_config_instance.to_dict() # create an instance of AgentDTOSynthesizerVoiceConfig from a dict agent_dto_synthesizer_voice_config_from_dict = AgentDTOSynthesizerVoiceConfig.from_dict(agent_dto_synthesizer_voice_config_dict) ``` -------------------------------- ### Create a Simple Agent Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt Use this to quickly create an agent with basic configuration. Ensure the client is initialized. ```python response = client.new_agent( name="Customer Support Bot", prompt="You are a helpful customer support agent for Acme Corp. Be concise and friendly.", description="Handles inbound customer queries", background_sound="office" # '', 'office', 'cafe', 'call_center', 'static' ) agent_id = response.data print(f"Created agent: {agent_id}") ``` -------------------------------- ### AudienceGet200ResponseDataInner Usage Example Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/AudienceGet200ResponseDataInner.md Example code demonstrating how to use the AudienceGet200ResponseDataInner model, including instantiation from JSON, conversion to a dictionary, and vice versa. ```APIDOC ## Example ```python from atoms.models.audience_get200_response_data_inner import AudienceGet200ResponseDataInner # TODO update the JSON string below json = "{}" # create an instance of AudienceGet200ResponseDataInner from a JSON string audience_get200_response_data_inner_instance = AudienceGet200ResponseDataInner.from_json(json) # print the JSON string representation of the object print(AudienceGet200ResponseDataInner.to_json()) # convert the object into a dict audience_get200_response_data_inner_dict = audience_get200_response_data_inner_instance.to_dict() # create an instance of AudienceGet200ResponseDataInner from a dict audience_get200_response_data_inner_from_dict = AudienceGet200ResponseDataInner.from_dict(audience_get200_response_data_inner_dict) ``` ``` -------------------------------- ### KnowledgeBase Model Usage Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/KnowledgeBase.md Demonstrates how to create a KnowledgeBase instance from a JSON string and a dictionary, and how to convert it to a dictionary. Ensure the JSON string is valid. ```python from atoms.models.knowledge_base import KnowledgeBase # TODO update the JSON string below json = "{}" # create an instance of KnowledgeBase from a JSON string knowledge_base_instance = KnowledgeBase.from_json(json) # print the JSON string representation of the object print(KnowledgeBase.to_json()) # convert the object into a dict knowledge_base_dict = knowledge_base_instance.to_dict() # create an instance of KnowledgeBase from a dict knowledge_base_from_dict = KnowledgeBase.from_dict(knowledge_base_dict) ``` -------------------------------- ### Get Campaigns Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/CampaignsApi.md Retrieves a list of all campaigns, with optional pagination. ```APIDOC ## GET /campaign ### Description Retrieve all campaigns. ### Method GET ### Endpoint /campaign ### Parameters #### Query Parameters - **page** (int) - Optional - Page number for pagination - **limit** (int) - Optional - Number of campaigns to retrieve per page ### Response #### Success Response (200) - **data** (GetCampaigns200Response) - Description of the response data ### Request Example ```json { "page": 1, "limit": 10 } ``` ``` -------------------------------- ### Create Knowledge Base using Python Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/KnowledgeBaseApi.md Use this snippet to create a new knowledge base. Ensure you have initialized the AtomsClient. ```python from smallestai.atoms import AtomsClient def main(): atoms_client = AtomsClient() kb_request = { "name": "My Knowledge Base", "description": "Knowledge base description" } response = atoms_client.create_knowledge_base(create_knowledge_base_request=kb_request) print(f"Created knowledge base with ID: {response.data}") if __name__ == "__main__": main() ``` -------------------------------- ### Get Knowledge Bases Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/KnowledgeBaseApi.md Retrieves a list of all available knowledge bases. ```APIDOC ## Get Knowledge Bases ### Description Retrieves a list of all available knowledge bases. ### Method GET ### Endpoint /knowledgebases ### Parameters This endpoint does not require any parameters. ### Response #### Success Response (200) - **data** (array) - A list of knowledge base objects. ``` -------------------------------- ### Get Knowledge Bases Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/KnowledgeBaseApi.md Retrieves a list of all available knowledge bases. ```APIDOC ## GET /knowledgebase ### Description Get a list of all knowledge bases. ### Method GET ### Endpoint /knowledgebase ### Response #### Success Response (200) - **data** (object) - List of knowledge bases. ``` -------------------------------- ### Instantiate AgentTemplateGet200Response from JSON and Dict Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/AgentTemplateGet200Response.md Demonstrates how to create an instance of AgentTemplateGet200Response from a JSON string or a dictionary. It also shows how to convert an instance back to a dictionary and then recreate it. ```python from atoms.models.agent_template_get200_response import AgentTemplateGet200Response # TODO update the JSON string below json = "{}" # create an instance of AgentTemplateGet200Response from a JSON string agent_template_get200_response_instance = AgentTemplateGet200Response.from_json(json) # print the JSON string representation of the object print(AgentTemplateGet200Response.to_json()) # convert the object into a dict agent_template_get200_response_dict = agent_template_get200_response_instance.to_dict() # create an instance of AgentTemplateGet200Response from a dict agent_template_get200_response_from_dict = AgentTemplateGet200Response.from_dict(agent_template_get200_response_dict) ``` -------------------------------- ### Instantiate OrganizationGet200ResponseDataSubscription from JSON and Dict Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/OrganizationGet200ResponseDataSubscription.md Demonstrates how to create an instance of OrganizationGet200ResponseDataSubscription from a JSON string and a dictionary. Also shows how to convert the object back to JSON and a dictionary. ```python from atoms.models.organization_get200_response_data_subscription import OrganizationGet200ResponseDataSubscription # TODO update the JSON string below json = "{}" # create an instance of OrganizationGet200ResponseDataSubscription from a JSON string organization_get200_response_data_subscription_instance = OrganizationGet200ResponseDataSubscription.from_json(json) # print the JSON string representation of the object print(OrganizationGet200ResponseDataSubscription.to_json()) # convert the object into a dict organization_get200_response_data_subscription_dict = organization_get200_response_data_subscription_instance.to_dict() # create an instance of OrganizationGet200ResponseDataSubscription from a dict organization_get200_response_data_subscription_from_dict = OrganizationGet200ResponseDataSubscription.from_dict(organization_get200_response_data_subscription_dict) ``` -------------------------------- ### Get Conversation Logs Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/LogsApi.md Retrieves logs for a specific conversation ID. ```APIDOC ## GET /conversation/{id} ### Description Get conversation logs for a specific conversation ID. ### Method GET ### Endpoint /conversation/{id} ### Parameters #### Path Parameters - **id** (str) - Required - The conversation ID to retrieve logs for ### Response #### Success Response (200) - **data** (GetConversationLogs200Response) - Successful response containing conversation logs. #### Error Response - **400** - Invalid input - **401** - Unauthorized access - **500** - Internal server error ``` -------------------------------- ### Get Agent Templates Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/AgentTemplatesApi.md Retrieves a list of all available agent templates. ```APIDOC ## GET /agent/template ### Description Get a list of available agent templates. ### Method GET ### Endpoint /agent/template ### Parameters This endpoint does not need any parameters. ### Response #### Success Response (200) - **data** (object) - A list of available agent templates. ``` -------------------------------- ### Create a Knowledge Base Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt Initializes a new knowledge base to store information for agents. Requires `AtomsClient`. ```python from smallestai.atoms import AtomsClient client = AtomsClient() # Create a knowledge base kb_response = client.new_kb( name="Product FAQ", description="Frequently asked questions about our products" ) kb_id = kb_response.data print(f"Created KB: {kb_id}") ``` -------------------------------- ### Get Campaign By ID Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/CampaignsApi.md Retrieves the details of a specific campaign using its ID. ```APIDOC ## GET /campaign/{id} ### Description Get details of a specific campaign. ### Method GET ### Endpoint /campaign/{id} ### Parameters #### Path Parameters - **id** (str) - Required - Campaign ID to retrieve ### Response #### Success Response (200) - **data** (GetCampaignById200Response) - Description of the response data ### Request Example ```python "your_campaign_id" ``` ``` -------------------------------- ### Instantiate and Use ProductPhoneNumbersGet200Response Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/ProductPhoneNumbersGet200Response.md Demonstrates how to create an instance of ProductPhoneNumbersGet200Response from a JSON string, convert it to a dictionary, and create a new instance from that dictionary. Ensure the JSON string is valid. ```python from atoms.models.product_phone_numbers_get200_response import ProductPhoneNumbersGet200Response # TODO update the JSON string below json = "{}" # create an instance of ProductPhoneNumbersGet200Response from a JSON string product_phone_numbers_get200_response_instance = ProductPhoneNumbersGet200Response.from_json(json) # print the JSON string representation of the object print(ProductPhoneNumbersGet200Response.to_json()) # convert the object into a dict product_phone_numbers_get200_response_dict = product_phone_numbers_get200_response_instance.to_dict() # create an instance of ProductPhoneNumbersGet200Response from a dict product_phone_numbers_get200_response_from_dict = ProductPhoneNumbersGet200Response.from_dict(product_phone_numbers_get200_response_dict) ``` -------------------------------- ### Get Knowledge Base Items Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/KnowledgeBaseApi.md Retrieves all items associated with a specific knowledge base. ```APIDOC ## GET /knowledgebase/{id}/items ### Description Get all items in a knowledge base. ### Method GET ### Endpoint /knowledgebase/{id}/items ### Parameters #### Path Parameters - **id** (str) - Required - Knowledge base ID ### Response #### Success Response (200) - **data** (object) - List of items in the knowledge base. ``` -------------------------------- ### Get Agents Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/AgentsApi.md Retrieves a list of all agents. Supports pagination and searching to filter the results. ```APIDOC ## GET /agent ### Description Get all agents. ### Method GET ### Endpoint /agent ### Parameters #### Query Parameters - **page** (int) - Optional - Page number [default to 1] - **offset** (int) - Optional - Number of items per page [default to 5] - **search** (str) - Optional - Search term ### Response #### Success Response (200) - **data** (GetAgents200Response) - Description of the response object #### Response Example { "example": "response body" } ``` -------------------------------- ### Create a Full Agent with Synthesizer Config Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt Use this for advanced agent creation, including detailed language and synthesizer configurations. Requires importing `CreateAgentRequest`. ```python from smallestai.atoms.models import CreateAgentRequest request = CreateAgentRequest( name="Sales Agent", description="Outbound sales agent for SMB market", language={"enabled": "en", "switching": False}, synthesizer={ "voiceConfig": { "model": "waves_lightning_large", "voiceId": "nyah" }, "speed": 1.1, "consistency": 0.5, "similarity": 0.0, "enhancement": 1 }, slm_model="electron" ) response = client.create_agent(create_agent_request=request) agent_id = response.data print(f"Created agent: {agent_id}") ``` -------------------------------- ### AgentAgentIdWebhookSubscriptionsGet200Response Model Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/AgentAgentIdWebhookSubscriptionsGet200Response.md This snippet shows the properties of the AgentAgentIdWebhookSubscriptionsGet200Response model and provides examples of how to use it in Python. ```APIDOC ## AgentAgentIdWebhookSubscriptionsGet200Response ### Description Represents the response object for retrieving webhook subscriptions for a specific agent. ### Properties - **status** (bool) - Optional - Indicates the success status of the operation. - **data** (List[WebhookSubscription]) - Optional - A list of webhook subscription objects. ### Example ```python from atoms.models.agent_agent_id_webhook_subscriptions_get200_response import AgentAgentIdWebhookSubscriptionsGet200Response # TODO update the JSON string below json_string = "{}" # create an instance of AgentAgentIdWebhookSubscriptionsGet200Response from a JSON string agent_agent_id_webhook_subscriptions_get200_response_instance = AgentAgentIdWebhookSubscriptionsGet200Response.from_json(json_string) # print the JSON string representation of the object print(AgentAgentIdWebhookSubscriptionsGet200Response.to_json()) # convert the object into a dict agent_agent_id_webhook_subscriptions_get200_response_dict = agent_agent_id_webhook_subscriptions_get200_response_instance.to_dict() # create an instance of AgentAgentIdWebhookSubscriptionsGet200Response from a dict agent_agent_id_webhook_subscriptions_get200_response_from_dict = AgentAgentIdWebhookSubscriptionsGet200Response.from_dict(agent_agent_id_webhook_subscriptions_get200_response_dict) ``` ``` -------------------------------- ### Get Knowledge Base By ID Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/KnowledgeBaseApi.md Retrieves the details of a specific knowledge base using its ID. ```APIDOC ## GET /knowledgebase/{id} ### Description Get details of a specific knowledge base. ### Method GET ### Endpoint /knowledgebase/{id} ### Parameters #### Path Parameters - **id** (str) - Required - Knowledge base ID to retrieve ### Response #### Success Response (200) - **data** (object) - Details of the knowledge base. ``` -------------------------------- ### Create and Use ApiResponse Instance Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/ApiResponse.md Demonstrates how to create an ApiResponse instance from a JSON string, convert it to a dictionary, and create it from a dictionary. Ensure the JSON string is valid. ```python from atoms.models.api_response import ApiResponse # TODO update the JSON string below json = "{}" # create an instance of ApiResponse from a JSON string api_response_instance = ApiResponse.from_json(json) # print the JSON string representation of the object print(ApiResponse.to_json()) # convert the object into a dict api_response_dict = api_response_instance.to_dict() # create an instance of ApiResponse from a dict api_response_from_dict = ApiResponse.from_dict(api_response_dict) ``` -------------------------------- ### Get Agent By ID Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/AgentsApi.md Retrieves the detailed configuration and information for a specific agent identified by its ID. ```APIDOC ## GET /agent/{id} ### Description Get details of a specific agent by ID. ### Method GET ### Endpoint /agent/{id} ### Parameters #### Path Parameters - **id** (str) - Required - Agent ID to retrieve ### Response #### Success Response (200) - **data** (GetAgentById200Response) - Description of the response object #### Response Example { "example": "response body" } ``` -------------------------------- ### Campaign Management Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt Manage outbound calling campaigns, including creating, starting, pausing, and deleting campaigns. ```APIDOC ## Atoms: Campaign Management — `new_campaign` / `start_campaign` / `pause_campaign` # Create a campaign campaign_response = client.new_campaign( name="Q4 Outreach Campaign", agent_id=AGENT_ID, audience_id=AUDIENCE_ID, phone_ids=phone_ids[:2], # Use up to 2 phone numbers description="Q4 2024 outbound sales campaign", max_retries=3, # Retry failed calls up to 3 times retry_delay=30 # 30 minutes between retries ) campaign_id = campaign_response.data print(f"Campaign created: {campaign_id}") # Start the campaign start_result = client.start_campaign(id=campaign_id) print(f"Campaign started: {start_result}") # Get campaign status and metrics status = client.get_campaign_by_id(id=campaign_id) print(status) # Pause an active campaign client.pause_campaign(id=campaign_id) print("Campaign paused.") # Delete campaign client.delete_campaign(id=campaign_id) ``` -------------------------------- ### Get Knowledge Bases Python Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/KnowledgeBaseApi.md Retrieve a list of all available knowledge bases. Requires an initialized AtomsClient. ```python from smallestai.atoms import AtomsClient def main(): atoms_client = AtomsClient() response = atoms_client.get_knowledge_bases() print(f"Retrieved knowledge bases: {response.data}") if __name__ == "__main__": main() ``` -------------------------------- ### agent_from_template_post Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/AgentTemplatesApi.md Creates an agent from a specified template. Use the /agent/template endpoint to get a list of available templates and their IDs. ```APIDOC ## POST /agent/from-template ### Description Create agent from template ### Method POST ### Endpoint /agent/from-template ### Parameters #### Request Body - **create_agent_from_template_request** (CreateAgentFromTemplateRequest) - Required - Description of the request body ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **AgentFromTemplatePost200Response** - Description of the successful response #### Response Example ```json { "example": "response body" } ``` ### Authorization BearerAuth ``` -------------------------------- ### Create an Agent from a Template Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt Instantiate a new agent based on an existing agent template. Requires the template ID and basic agent configuration like name and description. ```python # Create an agent from a template template_id = "template-customer-support-v1" agent_response = client.create_agent_from_template( create_agent_from_template_request={ "template_id": template_id, "name": "Support Agent from Template", "description": "Instantiated from the customer support template" } ) print(f"Agent created from template: {agent_response.data}") ``` -------------------------------- ### Create Agent with Smallest Python SDK Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/AgentsApi.md Use this snippet to create a new agent. Provide a detailed configuration including name, description, language settings, synthesizer options, and SLM model. Ensure the `AtomsClient` is initialized. ```python from smallestai.atoms import AtomsClient def main(): atoms_client = AtomsClient() new_agent_request = { "name": "Test Agent", "description": "Test agent description", "language": { "enabled": "en", "switching": False }, "synthesizer": { "voiceConfig": { "model": "waves_lightning_large", "voiceId": "nyah" }, "speed": 1.2, "consistency": 0.5, "similarity": 0, "enhancement": 1 }, "slmModel": "electron" } response = atoms_client.create_agent(create_agent_request=new_agent_request) print(f"Created agent with ID: {response.data}") if __name__ == "__main__": main() ``` -------------------------------- ### AgentAgentIdWebhookSubscriptionsDelete200Response Model Usage Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/AgentAgentIdWebhookSubscriptionsDelete200Response.md Demonstrates creating an instance from a JSON string, converting to JSON, and converting to a dictionary. Ensure the JSON string is valid and update the placeholder as needed. ```python from atoms.models.agent_agent_id_webhook_subscriptions_delete200_response import AgentAgentIdWebhookSubscriptionsDelete200Response # TODO update the JSON string below json = "{}" # create an instance of AgentAgentIdWebhookSubscriptionsDelete200Response from a JSON string agent_agent_id_webhook_subscriptions_delete200_response_instance = AgentAgentIdWebhookSubscriptionsDelete200Response.from_json(json) # print the JSON string representation of the object print(AgentAgentIdWebhookSubscriptionsDelete200Response.to_json()) # convert the object into a dict agent_agent_id_webhook_subscriptions_delete200_response_dict = agent_agent_id_webhook_subscriptions_delete200_response_instance.to_dict() # create an instance of AgentAgentIdWebhookSubscriptionsDelete200Response from a dict agent_agent_id_webhook_subscriptions_delete200_response_from_dict = AgentAgentIdWebhookSubscriptionsDelete200Response.from_dict(agent_agent_id_webhook_subscriptions_delete200_response_dict) ``` -------------------------------- ### Get Available Agent Templates Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/AgentTemplatesApi.md Retrieve a list of all agent templates that are currently available. This endpoint requires no parameters. ```python from smallestai.atoms import AtomsClient def main(): atoms_client = AtomsClient() response = atoms_client.get_agent_templates() print(f"Available templates: {response.data}") if __name__ == "__main__": main() ``` -------------------------------- ### Create Campaign with AtomsClient Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/CampaignsApi.md Use this snippet to create a new campaign. Ensure the `AtomsClient` is initialized and the campaign request object is properly formatted with all required fields. ```python from smallestai.atoms import AtomsClient def main(): atoms_client = AtomsClient() campaign_request = { "name": "My Campaign", "description": "Campaign description", "agent_id": "your_agent_id", "schedule": { "start_time": "2024-03-20T10:00:00Z", "end_time": "2024-03-21T10:00:00Z" } } response = atoms_client.create_campaign(create_campaign_request=campaign_request) print(f"Created campaign with ID: {response.data}") if __name__ == "__main__": main() ``` -------------------------------- ### Get Campaign Status and Metrics Source: https://context7.com/smallest-inc/smallest-python-sdk/llms.txt Retrieve the current status and performance metrics of a campaign. Useful for monitoring campaign progress. ```python # Get campaign status and metrics status = client.get_campaign_by_id(id=campaign_id) print(status) ``` -------------------------------- ### InternalServerErrorResponse Model Usage Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/InternalServerErrorResponse.md Demonstrates creating an instance from JSON, converting to JSON string, converting to a dictionary, and creating from a dictionary. ```python from atoms.models.internal_server_error_response import InternalServerErrorResponse # TODO update the JSON string below json = "{}" # create an instance of InternalServerErrorResponse from a JSON string internal_server_error_response_instance = InternalServerErrorResponse.from_json(json) # print the JSON string representation of the object print(InternalServerErrorResponse.to_json()) # convert the object into a dict internal_server_error_response_dict = internal_server_error_response_instance.to_dict() # create an instance of InternalServerErrorResponse from a dict internal_server_error_response_from_dict = InternalServerErrorResponse.from_dict(internal_server_error_response_dict) ``` -------------------------------- ### KnowledgebasePostRequest Model Usage Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/KnowledgebasePostRequest.md Demonstrates how to create an instance of KnowledgebasePostRequest from a JSON string, convert it to a dictionary, and create a new instance from that dictionary. Also shows how to print the JSON string representation of the object. ```python from atoms.models.knowledgebase_post_request import KnowledgebasePostRequest # TODO update the JSON string below json = "{}" # create an instance of KnowledgebasePostRequest from a JSON string knowledgebase_post_request_instance = KnowledgebasePostRequest.from_json(json) # print the JSON string representation of the object print(KnowledgebasePostRequest.to_json()) # convert the object into a dict knowledgebase_post_request_dict = knowledgebase_post_request_instance.to_dict() # create an instance of KnowledgebasePostRequest from a dict knowledgebase_post_request_from_dict = KnowledgebasePostRequest.from_dict(knowledgebase_post_request_dict) ``` -------------------------------- ### Get All Campaigns with AtomsClient Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/CampaignsApi.md Retrieve a list of all campaigns. This method accepts optional pagination parameters. Ensure the `AtomsClient` is initialized. ```python from smallestai.atoms import AtomsClient def main(): atoms_client = AtomsClient() request = { "page": 1, "limit": 10 } response = atoms_client.get_campaigns(get_campaigns_request=request) print(f"Retrieved campaigns: {response.data}") if __name__ == "__main__": main() ``` -------------------------------- ### KnowledgeBaseItem Model Usage Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/models/KnowledgeBaseItem.md Demonstrates how to create a KnowledgeBaseItem instance from a JSON string, convert it to a dictionary, and create a new instance from a dictionary. Ensure the JSON string is valid. ```python from atoms.models.knowledge_base_item import KnowledgeBaseItem # TODO update the JSON string below json = "{}" # create an instance of KnowledgeBaseItem from a JSON string knowledge_base_item_instance = KnowledgeBaseItem.from_json(json) # print the JSON string representation of the object print(KnowledgeBaseItem.to_json()) # convert the object into a dict knowledge_base_item_dict = knowledge_base_item_instance.to_dict() # create an instance of KnowledgeBaseItem from a dict knowledge_base_item_from_dict = KnowledgeBaseItem.from_dict(knowledge_base_item_dict) ``` -------------------------------- ### Get Campaign by ID with AtomsClient Source: https://github.com/smallest-inc/smallest-python-sdk/blob/main/docs/atoms/CampaignsApi.md Retrieve details for a specific campaign using its ID. Initialize the `AtomsClient` before making the request. ```python from smallestai.atoms import AtomsClient def main(): atoms_client = AtomsClient() campaign_id = "your_campaign_id" response = atoms_client.get_campaign_by_id(id=campaign_id) print(f"Campaign details: {response.data}") if __name__ == "__main__": main() ```