Docs
Routes
Openai.routes

OpenAI Routes

routes.openai_routes.delete_agent_route()

Deletes an agent from the OpenAI server based on the provided agent ID.

URL:

  • POST /openai/delete_agent
  • Parameters: agent_id (str) – The ID of the agent to be deleted.
  • Returns: A message indicating whether the agent was deleted successfully or an error occurred.
  • Return type: JSON response (dict)

Status Codes:

  • 200 OK: Agent deleted successfully.
  • 400 Bad Request: Invalid request payload or an error occurred.

routes.openai_routes.get_models()

Retrieves a list of currently available models from the OpenAI API, providing users with options for different levels of capabilities or specific functionalities.

URL:

  • GET /openai/get_models
  • Returns: A list of available models or an error message.
  • Return type: JSON response (dict)

Status Codes:

  • 200 OK: List of models retrieved successfully.
  • 400 Bad Request: An error occurred.

routes.openai_routes.initialize()

Initializes an OpenAI assistant (agent) using the specified ID. This is intended for setting up agents for specific tasks using the OpenAI assistant API.

URL:

  • POST /openai/initialize
  • Parameters: agent_id (str) – The ID of the agent to be initialized.
  • Returns: A message indicating successful initialization with a new thread ID and agent ID, : or an error message if the agent is not found.
  • Return type: JSON response (dict)

Status Codes:

  • 200 OK: Agent initialized successfully.
  • 404 Not Found: Agent with the specified ID not found.

routes.openai_routes.openai_chat()

Sends a user message to the specified OpenAI chat assistant and manages the conversation within a given thread.

URL:

  • POST /openai/chat
  • Parameters:
    • user_input (str) – The message to be sent to the OpenAI assistant.
    • agent_id (str) – The ID of the agent to use for the conversation.
    • thread_id (str) – The ID of the thread to use for the conversation, maintaining context across messages.
  • Returns: The chat response from the OpenAI assistant or an error message.
  • Return type: JSON response (dict)

Status Codes:

  • 200 OK: Chat response received successfully.
  • 400 Bad Request: Invalid request payload or an error occurred.