superwise_api.entities.agent
This class provides methods to interact with the Agent API.
Attributes:
- api_client (ApiClient): An instance of the ApiClient to make requests.
- _model_name (str): The name of the model.
- _resource_path (str): The path of the resource.
Initializes the DatasetApi class.
Arguments:
- api_client (ApiClient): An instance of the SuperwiseApiClient to make requests.
Creates a new agent.
Arguments:
- name (str): The name of the agent.
- description (str): The agent's description.
- authentication_enabled (bool): Whether the agent requires an api token for access or not.
- observability_enabled (bool): Whether the agent logs conversation to the db or not.
Returns:
Agent: The created agent.
Creates a new version for the agent.
Arguments:
- agent_id (str): The id of the agent.
- name (str): The name of the version.
- description (str): The version's description.
- agent_config (AgentConfig): agent configuration for this version.
Returns:
Version: The created version.
Updates the agent.
Arguments:
- agent_id (str): The id of the agent.
- name (str, optional): The new name of the agent.
- description (str, optional): Description for the agent.
- authentication_enabled (bool, optional): Whether the agent requires an api token for access or not.
- observability_enabled (bool, optional): Whether the agent logs conversation to the db or not.
Returns:
Agent: The updated agent.
Updates the agent's version.
Arguments:
- version_id (str): The version's id.
- agent_id (str): The id of the version's agent.
- name (str, optional): The new name of the version.
- description (str, optional): New description for the version.
Returns:
Version: The updated version.
Retrieves an entity by its id.
Arguments:
- agent_id (str): The id of the agent.
- version_id (str): The id of the version to retrieve.
- **kwargs: Arbitrary keyword arguments.
Returns:
Source: The retrieved entity.
Retrieves agent entities.
Arguments:
- agent_id (str): The id of the agent.
- **kwargs: Arbitrary keyword arguments.
Returns:
list[Version]: The retrieved entities.
Gets agents. Filter if any of the parameters are provided.
Arguments:
- name (str, optional): The name of the agent.
- created_by (str, optional): The creator of the agent.
- prompt (str, optional): The prompt of the agent.
- dataset_id (str, optional): The id of the dataset.
- page (int, optional): The page number.
- size (int, optional): The size of the page.
Returns:
Page: A page of agents.
Tests the connection to the model. Raises exception on fail.
Arguments:
- llm_model (ModelLLM): The model to test.
Tests the connection to the tool. Raises exception on fail.
Arguments:
- tool (ToolDef): The tool to test.
Performs ask request in playground mode.
Arguments:
- input (str): The input to the model.
- agent_config (AgentConfig): The type of the agent and connected tools/context.
- chat_history (Sequence[dict], optional): The chat history.
Returns:
AskResponsePayload: The response payload.
Performs ask request to the specified worker.
Arguments:
- agent_id (str): The agent asked.
- input (str): The input to the model.
- api_token (str): The API token of the agent.
- chat_history (Sequence[dict], optional): The chat history.
Returns:
AskResponsePayload: The response payload.
Get credential schema.
Arguments:
- url (str): url to the flowise agent.
- api_key (str): Flow-relevant API key.
- flow_id (str): ID of the requested flow.
- **kwargs: Arbitrary keyword arguments.
Returns:
FlowiseCredentialUserInput: Required schema of the credentials.
Regenerates api key for agent.
Arguments:
- agent_id (str): The agent asked.
Returns:
Agent: Agent with the new api key.
Creates a new dataset for the agent.
Arguments:
- agent_id (str): The id of the agent.
- name (str): The name of the version.
Returns:
Dataset: The created dataset.
Sends feedback to the specified worker for its answer.
Arguments:
- agent_id (str): The agent receiving the feedback.
- payload (EventFeedbackData): The feedback payload.
- api_token (str): The API token of the application.
Returns:
None
Inherited Members
- superwise_api.entities.base.BaseApi
- api_client
- wrap_api_calls
- raise_exception
- get_by_id
- delete