{
  "openapi": "3.1.0",
  "info": {
    "title": "CodeGPT API Beta",
    "description": "This is the documentation for the new version of the CodeGPT API. This version is currently in beta and is subject to change.",
    "version": "2.0.0"
  },
  "paths": {
    "/api/v1/user": {
      "get": {
        "tags": ["User"],
        "summary": "Get my user data",
        "operationId": "get_info_me_v1_user",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FullUserData"
                }
              }
            }
          },
          "400": {
            "description": "Missing Api Key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": ["User"],
        "summary": "Update my user data",
        "operationId": "update_info_me_v1_user",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUserData"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserData"
                }
              }
            }
          },
          "400": {
            "description": "Missing Api Key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/user/avatar": {
      "patch": {
        "tags": ["User"],
        "summary": "Update my user avatar",
        "operationId": "update_avatar_me_v1_user",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_updateUserAvatar_v1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserData"
                }
              }
            }
          },
          "400": {
            "description": "Missing Api Key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent/marketplace-favorites": {
      "get": {
        "tags": ["Marketplace Favorite Agents"],
        "summary": "List Marketplace Favorite Agents",
        "operationId": "list_agent_v1_agent_get_marketplace_favorites",
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/GetAgentList"
                  },
                  "type": "array",
                  "title": "Response List Agent V1 Agent Get"
                }
              }
            }
          },
          "400": {
            "description": "Missing Api Key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestError"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "examples": ["No agents found"]
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/agent": {
      "get": {
        "tags": ["Agents"],
        "summary": "List Agents",
        "operationId": "list_agent_v1_agent_get",
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/GetAgentList"
                  },
                  "type": "array",
                  "title": "Response List Agent V1 Agent Get"
                }
              }
            }
          },
          "400": {
            "description": "Missing Api Key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestError"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "examples": ["No agents found"]
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "tags": ["Agents"],
        "summary": "Create Agent",
        "operationId": "create_agent_v1_agent_post",
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAgentData"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/BadRequestError"
                    },
                    {
                      "$ref": "#/components/schemas/HTTPValidationError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/agent/{id}": {
      "get": {
        "tags": ["Agents"],
        "summary": "Get Agent",
        "operationId": "get_agent_v1_agent__id__get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Id"
            }
          },
          {
            "name": "populate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["agent_documents"],
              "title": "Populate Documents",
              "description": "When set to 'agent_documents', the response will include the 'agent_documents' property."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAgentData"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestError"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "message": {
                    "type": "string",
                    "examples": ["Agent not found"]
                  }
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": ["Agents"],
        "summary": "Update Agent",
        "operationId": "update_agent_v1_agent__id__patch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAgentData"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAgentData"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/BadRequestError"
                    },
                    {
                      "$ref": "#/components/schemas/HTTPValidationError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "message": {
                    "type": "string",
                    "examples": ["Agent not found"]
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["Agents"],
        "summary": "Delete Agent",
        "operationId": "delete_agent_v1_agent__id__delete",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/schemas/BadRequestError"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "message": {
                    "type": "string",
                    "examples": ["Agent not found"]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent/{id}/image": {
      "patch": {
        "tags": ["Agents"],
        "summary": "Update Agent Image",
        "operationId": "update_agent_image_v1_agent__id__image_patch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_updateAgentImage_v1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "$ref": "#/components/schemas/BadRequestError"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "message": {
                    "type": "string",
                    "examples": ["Agent not found"]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent/{id}/documents": {
      "patch": {
        "tags": ["Agents"],
        "summary": "Update Agent Documents",
        "operationId": "update_agent_documents_v1_agent__id__documents_patch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAgentDocumentsData"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "message": {
                    "type": "string",
                    "examples": ["Agent documents set successfully"]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/BadRequestError"
                    },
                    {
                      "$ref": "#/components/schemas/HTTPValidationError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "message": {
                    "type": "string",
                    "examples": ["Agent not found"]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/chat/completions": {
      "post": {
        "tags": ["Chat"],
        "summary": "Chat",
        "operationId": "completion_v1_completion_post",
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Chat"
                  },
                  {
                    "$ref": "#/components/schemas/ChatLegacy"
                  }
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/StreamOpenAIFormat"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompletionOpenAIFormat"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string",
                  "title": "Completion response"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/document": {
      "get": {
        "tags": ["Documents"],
        "summary": "List Document",
        "operationId": "list_document_v1_document_get",
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/GetDocumentData"
                  },
                  "type": "array",
                  "title": "Response List Document V1 Document Get"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "tags": ["Documents"],
        "summary": "Load",
        "operationId": "load_v1_document_load_post",
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_load_v1_document_load_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "file": {
                      "type": "string",
                      "title": "File",
                      "description": "File name",
                      "examples": ["example.txt"]
                    },
                    "documentId": {
                      "type": "string",
                      "title": "Document Id",
                      "description": "Document id",
                      "examples": ["0000-0000-0000-0000"]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/document/{id}": {
      "get": {
        "tags": ["Documents"],
        "summary": "Get Document",
        "operationId": "get_document_v1_document__id__get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetDocumentDataWithContent"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["Documents"],
        "summary": "Delete",
        "operationId": "delete_v1_document__id__delete",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "examples": ["Document deleted succesfully"]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestError"
                }
              }
            }
          },
          "404": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "examples": ["Document not found"]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/document/{id}/metadata": {
      "patch": {
        "tags": ["Documents"],
        "summary": "Update Document Metadata",
        "operationId": "update_document_metadata_v1_document__id__metadata_patch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgIdHeader"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Metadata"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "message": {
                    "type": "string",
                    "examples": ["Document metadata updated successfully"]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/BadRequestError"
                    },
                    {
                      "$ref": "#/components/schemas/HTTPValidationError"
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/document/metadata": {
      "post": {
        "tags": ["Documents"],
        "summary": "Get Document Metadata",
        "operationId": "get_document_metadata_v1_document_metadata_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_getDocumentMetadata_v1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Metadata"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/": {
      "get": {
        "tags": ["Info"],
        "summary": "Read Root",
        "operationId": "read_root__get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string",
                  "enum": ["<h1>CodeGPT API</h1>"]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "OrgIdHeader": {
        "name": "CodeGPT-Org-Id",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string"
        },
        "description": "Organization ID that agents and documents belong to."
      }
    },
    "schemas": {
      "BadRequestError": {
        "properties": {
          "message": {
            "type": "string",
            "title": "Message",
            "description": "Error message",
            "examples": [
              "Missing access token",
              "Invalid access token",
              "Invalid org id",
              "Invalid Agent Id",
              "Invalid Document Id"
            ]
          }
        }
      },
      "Body_getDocumentMetadata_v1": {
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "title": "File",
            "description": "Text file to get metadata from. Only .txt files are supported.",
            "examples": ["example.txt"]
          }
        },
        "type": "object",
        "required": ["file"],
        "title": "Body_getDocumentMetadata_v1"
      },
      "Body_updateUserAvatar_v1": {
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "title": "Avatar File",
            "description": "New avatar image in format jpeg/png/webp. Limit: 5MB."
          }
        },
        "type": "object",
        "required": ["file"],
        "title": "Body_updateUserAvatar_v1"
      },
      "Body_updateAgentImage_v1": {
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "title": "Agent Image File",
            "description": "New agent image in format jpeg/png/webp. Limit: 5MB."
          }
        },
        "type": "object",
        "required": ["file"],
        "title": "Body_updateAgentImage_v1"
      },
      "Body_load_v1_document_load_post": {
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "title": "File"
          }
        },
        "type": "object",
        "required": ["file"],
        "title": "Body_load_v1_document_load_post"
      },
      "Chat": {
        "properties": {
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "description": "Stream Output",
            "default": true,
            "examples": ["false"]
          },
          "agentId": {
            "type": "string",
            "title": "Agent Id",
            "description": "Id of the agent to use for the completion",
            "examples": ["0000-0000-0000-0000"],
            "required": true
          },
          "messages": {
            "items": {
              "$ref": "#/components/schemas/Message"
            },
            "type": "array",
            "title": "Messages",
            "description": "List of messages with a role and content",
            "examples": [
              {
                "content": "What is the meaning of life?",
                "role": "user"
              }
            ]
          },
          "format": {
            "type": "boolean",
            "enum": ["text", "json"],
            "title": "Output Format",
            "description": "Format of the response",
            "default": "json",
            "examples": ["json"]
          }
        },
        "type": "object",
        "required": ["agentId", "messages"],
        "title": "Completion",
        "description": "Our completion model request"
      },
      "ChatLegacy": {
        "properties": {
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "description": "Stream Output",
            "default": true,
            "examples": ["false"]
          },
          "agent": {
            "type": "string",
            "title": "Agent Id",
            "description": "Id of the agent to use for the completion",
            "examples": ["0000-0000-0000-0000"],
            "required": true
          },
          "messages": {
            "items": {
              "$ref": "#/components/schemas/Message"
            },
            "type": "array",
            "title": "Messages",
            "description": "List of messages with a role and content",
            "examples": [
              {
                "content": "What is the meaning of life?",
                "role": "user"
              }
            ]
          }
        },
        "type": "object",
        "required": ["agent", "messages"],
        "title": "Legacy Completion",
        "description": "Our old completion model request"
      },
      "CreateAgentData": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Name of the agent",
            "examples": ["Agent 1"],
            "required": true
          },
          "topk": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Topk",
            "description": "Number of elements to retrieve from the documents",
            "examples": [3]
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature",
            "description": "Temperature of the agent",
            "examples": [0.7]
          },
          "model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model",
            "description": "Model of the agent",
            "examples": ["gpt-3.5-turbo"]
          },
          "prompt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt",
            "description": "Agent prompt",
            "examples": [
              "I want you to act like a helpful assistant and answer the following questions."
            ]
          },
          "welcome": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Welcome",
            "description": "Welcome message of the agent",
            "examples": ["Hello, how can I help you?"]
          }
        },
        "type": "object",
        "required": ["name"],
        "title": "CreateAgentData"
      },
      "CompletionOpenAIFormat": {
        "properties": {
          "agentName": {
            "type": "string",
            "title": "Agent's Name",
            "description": "Name of the agent",
            "example": "Agent P"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "object",
                  "$ref": "#/components/schemas/Message"
                }
              }
            },
            "title": "Choices",
            "description": "Array of choices with a single item"
          }
        },
        "type": "object",
        "required": ["agentName", "choices"],
        "title": "CompletionOpenAI",
        "description": "Chat completion model response"
      },
      "StreamOpenAIFormat": {
        "properties": {
          "agentName": {
            "type": "string",
            "title": "Agent's Name",
            "description": "Name of the agent",
            "example": "Agent P"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "delta": {
                  "type": "object",
                  "$ref": "#/components/schemas/Message"
                }
              }
            },
            "title": "Choices",
            "description": "Array of choices with a single item"
          }
        },
        "type": "object",
        "required": ["agentName", "choices"],
        "title": "CompletionOpenAI",
        "description": "Chat completion model response"
      },
      "FileValidationError": {
        "properties": {
          "error": {
            "type": "string",
            "title": "Error",
            "description": "Error message",
            "examples": [
              "Missing file",
              "Invalid file",
              "Invalid file type. Please upload a .txt file",
              "File size exceeds 2MB limit"
            ]
          }
        }
      },
      "FullUserData": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string",
            "title": "User Name",
            "examples": ["user1"]
          },
          "full_name": {
            "type": "string",
            "title": "Full Name",
            "examples": ["John Doe"]
          },
          "avatar": {
            "type": "string",
            "title": "Avatar",
            "examples": ["https://example.com/avatar.png"]
          },
          "organization_user": {
            "type": "array",
            "title": "Organization User",
            "examples": [["0000-0000-0000-0000"]]
          }
        }
      },
      "GetAgentData": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "Agent id",
            "examples": ["0000-0000-0000-0000"]
          },
          "org_id": {
            "type": "string",
            "title": "Organization ID",
            "description": "ID of the Organization the agent belongs to",
            "examples": ["0000-0000-0000-0000"]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At",
            "description": "Date when the agent was created",
            "examples": ["2023-01-01T12:00:00.000Z"]
          },
          "agent_type": {
            "type": "string",
            "enum": ["qa", "other"],
            "title": "Agent Type",
            "description": "Type of the agent",
            "examples": ["other", "qa"]
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "Name of the agent",
            "examples": ["Agent 1"]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Description of the agent",
            "examples": ["Description of the agent"]
          },
          "image": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Image",
            "description": "Image of the agent in chat",
            "examples": ["null"]
          },
          "prompt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt",
            "description": "Prompt of the agent",
            "examples": ["You are a helpful assistant"]
          },
          "topk": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Topk",
            "description": "Number of elements to retrieve from the documents",
            "examples": [3]
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature",
            "description": "Temperature of the agent",
            "examples": [0.7]
          },
          "model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model",
            "description": "Model of the agent",
            "examples": ["gpt-3.5-turbo"]
          },
          "welcome": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Welcome",
            "description": "Welcome message of the agent",
            "examples": ["Hello, how can I help you?"]
          },
          "is_public": {
            "type": "boolean",
            "title": "Is Public",
            "description": "Whether the agent can be seen and used by any user or not",
            "examples": ["false"]
          },
          "pincode": {
            "type": "string",
            "title": "Pin Code",
            "description": "Code required for using a shared agent",
            "examples": ["false"]
          },
          "agent_documents": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Documentid",
            "description": "List of document ids",
            "default": [],
            "examples": [["0000-0000-0000-0000"]]
          }
        },
        "type": "object",
        "title": "GetAgentData"
      },
      "GetAgentList": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "Agent id",
            "examples": ["0000-0000-0000-0000"]
          },
          "org_id": {
            "type": "string",
            "title": "Organization ID",
            "description": "ID of the Organization the agent belongs to",
            "examples": ["0000-0000-0000-0000"]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At",
            "description": "Date when the agent was created",
            "examples": ["2023-01-01T12:00:00.000Z"]
          },
          "agent_type": {
            "type": "string",
            "enum": ["qa", "other"],
            "title": "Agent Type",
            "description": "Type of the agent",
            "examples": ["other", "qa"]
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "Name of the agent",
            "examples": ["Agent 1"]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Description of the agent",
            "examples": ["Description of the agent"]
          },
          "image": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Image",
            "description": "Image of the agent in chat",
            "examples": ["null"]
          },
          "prompt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt",
            "description": "Prompt of the agent",
            "examples": ["You are a helpful assistant"]
          },
          "topk": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Topk",
            "description": "Number of elements to retrieve from the documents",
            "examples": [3]
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature",
            "description": "Temperature of the agent",
            "examples": [0.7]
          },
          "model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model",
            "description": "Model of the agent",
            "examples": ["gpt-3.5-turbo"]
          },
          "welcome": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Welcome",
            "description": "Welcome message of the agent",
            "examples": ["Hello, how can I help you?"]
          },
          "is_public": {
            "type": "boolean",
            "title": "Is Public",
            "description": "Whether the agent can be seen and used by any user or not",
            "examples": ["false"]
          },
          "pincode": {
            "type": "string",
            "title": "Pin Code",
            "description": "Code required for using a shared agent",
            "examples": ["false"]
          }
        },
        "type": "object",
        "title": "GetAgentList"
      },
      "GetDocumentData": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "Document id",
            "examples": ["0000-0000-0000-0000"]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At",
            "description": "Date when the document was created",
            "examples": ["2023-01-01T12:00:00.000Z"]
          },
          "file_id": {
            "type": "string",
            "title": "File Id",
            "description": "File id",
            "examples": ["0000-0000-0000-0000"]
          },
          "user_id": {
            "type": "string",
            "title": "User Id",
            "description": "User id",
            "examples": ["0000-0000-0000-0000"]
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Name of the document",
            "examples": ["La metamorfosis"]
          },
          "org_id": {
            "type": "string",
            "title": "Organization ID",
            "description": "ID of the Organization the document belongs to",
            "examples": ["0000-0000-0000-0000"]
          },
          "file_type": {
            "type": "string",
            "enum": ["txt"],
            "title": "File Type",
            "description": "Type of the file",
            "examples": ["txt"]
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "tokens": {
            "type": "integer",
            "title": "Tokens",
            "description": "Number of tokens in the document",
            "examples": [1000]
          },
          "chunk_count": {
            "type": "integer",
            "title": "Chunk Count",
            "description": "Number of chunks in the document",
            "examples": [1]
          }
        }
      },
      "GetDocumentDataWithContent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GetDocumentData"
          },
          {
            "properties": {
              "content": {
                "type": "string",
                "title": "Content",
                "description": "Content of the document",
                "examples": ["Este es el contenido del documento."]
              }
            }
          }
        ]
      },
      "HTTPValidationError": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Indicates if the request was successful",
            "examples": [false]
          },
          "error": {
            "type": "object",
            "properties": {
              "issues": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "description": "Error code",
                      "examples": ["invalid_type"]
                    },
                    "expected": {
                      "type": "string",
                      "description": "Expected data type",
                      "examples": ["string"]
                    },
                    "received": {
                      "type": "string",
                      "description": "Received data type",
                      "examples": ["integer"]
                    },
                    "path": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Path to the field that caused the error",
                      "examples": [["name"]]
                    },
                    "message": {
                      "type": "string",
                      "description": "Error message",
                      "examples": ["Required"]
                    }
                  },
                  "required": [
                    "code",
                    "expected",
                    "received",
                    "path",
                    "message"
                  ]
                },
                "description": "List of issues that caused the error"
              },
              "name": {
                "type": "string",
                "description": "Name of the error"
              }
            },
            "required": ["issues", "name"]
          }
        },
        "required": ["success", "error"]
      },
      "Message": {
        "properties": {
          "role": {
            "type": "string",
            "enum": ["system", "user", "assistant"],
            "title": "Role",
            "description": "Role of the message",
            "examples": ["assistant"]
          },
          "content": {
            "type": "string",
            "title": "Content",
            "description": "Content of the message",
            "examples": ["Hello, how can I help you?"]
          }
        },
        "type": "object",
        "required": ["role", "content"],
        "title": "Message"
      },
      "Metadata": {
        "properties": {
          "title": {
            "type": "string",
            "title": "Title",
            "description": "Title of the document",
            "examples": ["La metamorfosis"],
            "required": true
          },
          "description": {
            "type": "string",
            "title": "Description",
            "description": "Description of the document",
            "examples": [
              "La metamorfosis es una novela escrita por Franz Kafka y publicada en 1915."
            ]
          },
          "summary": {
            "type": "string",
            "title": "Summary",
            "description": "Summary of the document",
            "examples": [
              "Cuenta la historia de Gregorio Samsa, un comerciante de telas que vive con su familia a la que él mantiene con su sueldo, quien un día amanece convertido en un insecto."
            ],
            "required": true
          },
          "keywords": {
            "type": "string",
            "title": "Keywords",
            "description": "Keywords of the document",
            "examples": ["metamorfosis, insecto"],
            "required": true
          },
          "language": {
            "type": "string",
            "title": "Language",
            "description": "Language of the document",
            "examples": ["es"],
            "required": true
          }
        }
      },
      "UpdateAgentData": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "Name of the agent",
            "examples": ["Agent 1"]
          },
          "model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model",
            "description": "Model of the agent",
            "examples": ["gpt-3.5-turbo"]
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature",
            "description": "Temperature of the agent",
            "examples": [0.7]
          },
          "prompt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt",
            "description": "Prompt of the agent",
            "examples": ["You are a helpful assistant"]
          },
          "topk": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Topk",
            "description": "Number of elements to retrieve from the documents",
            "examples": [3]
          },
          "welcome": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Welcome",
            "description": "Welcome message of the agent",
            "examples": ["Hello, how can I help you?"]
          },
          "is_public": {
            "type": "boolean",
            "title": "Is Public",
            "description": "Whether the agent can be seen and used by any user or not",
            "examples": ["false"]
          },
          "pincode": {
            "type": "string",
            "title": "Pin Code",
            "description": "Code required for using a shared agent",
            "examples": ["false"]
          }
        },
        "type": "object",
        "title": "UpdateAgentData"
      },
      "UpdateAgentDocumentsData": {
        "properties": {
          "agent_documents": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Documentid",
            "description": "List of document ids",
            "default": [],
            "examples": [["0000-0000-0000-0000"]]
          }
        }
      },
      "UpdateUserData": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string",
            "title": "User Name",
            "examples": ["user1"]
          },
          "full_name": {
            "type": "string",
            "title": "Full Name",
            "examples": ["John Doe"]
          }
        }
      },
      "UserData": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string",
            "title": "User Name",
            "examples": ["user1"]
          },
          "full_name": {
            "type": "string",
            "title": "Full Name",
            "examples": ["John Doe"]
          },
          "avatar": {
            "type": "string",
            "title": "Avatar",
            "examples": ["https://example.com/avatar.png"]
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "tags": [
    {
      "name": "Agents",
      "description": "Endpoints related to Agents"
    },
    {
      "name": "Chat",
      "description": "Endpoints related to Chat and Completions"
    },
    {
      "name": "User",
      "description": "Endpoints related to the User"
    },
    {
      "name": "Documents",
      "description": "Endpoints related to Documents"
    }
  ]
}
