class
ApplicationApi(superwise_api.entities.base.BaseApi):
This class provides methods to interact with the Application 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.
ApplicationApi(api_client: superwise_api.client.api_client.ApiClient)
Initializes the DatasetApi class.
Arguments:
- api_client (ApiClient): An instance of the SuperwiseApiClient to make requests.
def
create( self, name: str, agent_config: typing.Annotated[superwise_api.models.application.application.ReactAgentConfig | superwise_api.models.application.application.ContextChainConfig | superwise_api.models.application.application.BasicLLMConfig | superwise_api.models.application.application.FlowiseAppConfig, Discriminator(discriminator='type', custom_error_type=None, custom_error_message=None, custom_error_context=None)], **kwargs) -> superwise_api.models.application.application.Application:
Creates a new application.
Arguments:
- name (str): The name of the application.
- agent_config (AgentConfig): The type of the application and connected tools/context.
Returns:
Application: The created application.
def
put( self, application_id: str, *, name: str = None, agent_config: typing.Annotated[superwise_api.models.application.application.ReactAgentConfig | superwise_api.models.application.application.ContextChainConfig | superwise_api.models.application.application.BasicLLMConfig | superwise_api.models.application.application.FlowiseAppConfig, Discriminator(discriminator='type', custom_error_type=None, custom_error_message=None, custom_error_context=None)] = None, **kwargs) -> superwise_api.models.application.application.Application:
Updates an application.
Arguments:
- application_id (str): The id of the application.
- name (str): The name of the application.
- agent_config (AgentConfig): The type of the application and connected tools/context.
Returns:
Application: The updated application.
def
get( self, name: Optional[str] = None, created_by: Optional[str] = None, prompt: Optional[str] = None, dataset_id: Optional[str] = None, page: Optional[Annotated[int, Strict(strict=True), Interval(gt=None, ge=1, lt=None, le=None), None]] = None, size: Optional[Annotated[int, Strict(strict=True), Interval(gt=None, ge=1, lt=None, le=500), None]] = None, **kwargs) -> superwise_api.client.models.page.Page:
Gets applications. Filter if any of the parameters are provided.
Arguments:
- name (str, optional): The name of the application.
- created_by (str, optional): The creator of the application.
- prompt (str, optional): The prompt of the application.
- 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 applications.
@BaseApi.raise_exception
def
test_model_connection( self, llm_model: Annotated[Union[superwise_api.models.application.application.OpenAIModel, superwise_api.models.application.application.OpenAICompatibleModel, superwise_api.models.application.application.GoogleModel, superwise_api.models.application.application.AnthropicModel, superwise_api.models.application.application.VertexAIModelGardenModel], FieldInfo(annotation=NoneType, required=True, discriminator='provider')], **kwargs):
Tests the connection to the model. Raises exception on fail.
Arguments:
- llm_model (ModelLLM): The model to test.
@BaseApi.raise_exception
def
ask_playground( self, input: str, agent_config: typing.Annotated[superwise_api.models.application.application.ReactAgentConfig | superwise_api.models.application.application.ContextChainConfig | superwise_api.models.application.application.BasicLLMConfig | superwise_api.models.application.application.FlowiseAppConfig, Discriminator(discriminator='type', custom_error_type=None, custom_error_message=None, custom_error_context=None)], chat_history: Optional[Sequence[dict]] = None, **kwargs) -> superwise_api.models.application.playground.AskResponsePayload:
Performs ask request in playground mode.
Arguments:
- input (str): The input to the model.
- agent_config (AgentConfig): The type of the application and connected tools/context.
- chat_history (Sequence[dict], optional): The chat history.
Returns:
AskResponsePayload: The response payload.
@BaseApi.raise_exception
def
ask_worker( self, application_id: str, input: str, api_token: str | None = None, chat_history: Optional[Sequence[dict]] = None, **kwargs) -> superwise_api.models.application.playground.AskResponsePayload:
Performs ask request to the specified worker.
Arguments:
- application_id (str): The application asked.
- input (str): The input to the model.
- api_token (str): The API token of the application.
- chat_history (Sequence[dict], optional): The chat history.
Returns:
AskResponsePayload: The response payload.
def
get_flowise_credential_schema( self, url: str, api_key: str, flow_id, **kwargs) -> superwise_api.models.application.flowise.FlowiseCredentialUserInput:
Get credential schema.
Arguments:
- url (str): url to the flowise application.
- 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.
@BaseApi.raise_exception
def
regenerate_api_key( self, application_id: str, **kwargs) -> superwise_api.models.application.application.Application:
Regenerates api key for application.
Arguments:
- application_id (str): The application asked.
Returns:
Application: Application with the new api key.
@BaseApi.raise_exception
def
update_authentication_status( self, application_id: str, enabled: bool, **kwargs) -> superwise_api.models.application.application.Application:
Update the authentication status for application.
Arguments:
- application_id (str): The application asked.
- enabled (bool): Enable or disable authentication.
Returns:
Application: Application with the new (nullable) api key.
Inherited Members
- superwise_api.entities.base.BaseApi
- api_client
- wrap_api_calls
- raise_exception
- get_by_id
- delete