AskYourPDF Research Assistant

AskYourPDF Research Assistant · GPT 작업

FastAPI

  • GET /api/usageGet Daily Usage
  • POST /api/gpt/uploadUploads a file sent to the GPT to the server and returns the doc id.

    Uploads a file reference using its file id. This file should be a document uploaded by the user. PDF TXT PPT PPTX EPUB RTF are supported..

  • POST /api/download_pdfDownload Pdf

    Download a PDF file from a URL and save it to the vector database.

  • POST /research/queryPerform Query on Document or Knowledge base using doc_id given

    Perform a query on a document.

  • POST /referencesGet References

    Retrieves a list of references that match the specified criteria. - **limit**: The maximum number of references to return. - **keyword_combinations**: List of keyword combinations to search for.

  • GET /api/documentsFetch User Documents

    Returns all documents for the current user. Request maximum 10 documents per page.

  • GET /raw/summaryRetrieve K-Means vector clustering chunks

    Returns K-Means vector clustering chunks from a document, which are used by an LLM to create a summary.

  • GET /api/searchSearch

    Search for documents. Args: user: The user who is searching. query: The search string to use for query. Returns: dict: A list of documents.

  • GET /api/knowledgeGet Knowledge Bases on user account

    Get a list of knowledge bases on a user's account. Args: user: The user making the request. page: The page number. page_size: The number of items per page. Returns: PaginatedKnowledgeBase: The response containing the updated knowledge base.

  • POST /api/knowledgeCreate Knowledge Base

    Create a knowledge base from a list of document IDs. Args: knowledge_base: The knowledge base to create. user: The user making the request. Returns: KnowledgeBaseResponse: The response containing the knowledge base ID.

  • GET /api/knowledge/{knowledge_base_id}Get a Knowledge Base using the knowledge base id

    Get knowledge base Args: knowledge_base_id: The ID of the knowledge base to retrieve. user: The user making the request.

  • PUT /api/knowledge/{knowledge_base_id}Update Knowledge Base

    Update a knowledge base from a list of document IDs. Args: knowledge_base_id: The ID of the knowledge base to update. knowledge_base: The items to update in the knowledge base. .

  • DELETE /api/knowledge/{knowledge_base_id}Delete Knowledge Base

    Delete knowledge base Args: knowledge_base_id: The ID of the knowledge base to delete. user: The user making the request. Returns: dict: The response containing a success message

  • GET /api/search/knowledgeSearch Knowledge Bases using the name of the knowledge base

    Search knowledge bases Args: query: The search query user: The user making the request. Returns: PaginatedKnowledgeBase: The response containing the updated knowledge base.

  • POST /findpapersQuery for finding research papers

    This endpoint allows clients to query for papers from millions of sources.

  • GET /api/zotero/documentsGet Zotero Documents that have attachments

    Get all users documents from Zotero that has attachments. Args: page_size: No of documents to return. page_number: current page number order: The order to return the documents in user: user making the request. Returns: List of documents with attachments in the zotero account.

  • GET /api/zotero/searchGet Zotero Documents

    Get all users documents from Zotero. Args: query : query. page_size: number of documents to return. page_number: current page number order: The order to return the documents in desc asc. user: The user making the request. Returns: List of docs in the user's zotero account.

  • GET /api/zotero/collectionsGet Zotero Collections

    Get all users collections from Zotero. Args: page_size: number of collections to return. page_number: current page number order: The order to return the collections in desc asc. user: The user making the request. Returns: List of collections in the user's zotero account.

  • GET /api/zotero/collections/searchSearch Zotero Collections

    Get all users collections from Zotero. Args: page_size: number of collections. page_number: current page number order: order to return the collections in desc asc. query : search query. user: user making the request. Returns: List of collections in the user's account.

  • GET /api/zotero/collections/{collection_id}/documentsGet Zotero Documents

    Get all users collections from Zotero. Args: collection_id: collection ID. page_size: number of collections to return. page_number: current page number order: The order to return (desc asc). user: user making request. Returns: List of collections.

  • GET /api/zotero/downloadDownload Zotero Document

    Download a document from Zotero and save it to the database. Args: user: The user who is uploading the file. link: The link to download the file from. file_name: The name of the file. Returns: dict: The document ID of the uploaded file.

원본 API 스키마
{
  "openapi": "3.1.0",
  "info": {
    "title": "FastAPI",
    "version": "0.1.0"
  },
  "paths": {
    "/api/usage": {
      "get": {
        "summary": "Get Daily Usage",
        "operationId": "get_daily_usage_api_usage_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DailyUsageAnalytics"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/gpt/upload": {
      "post": {
        "operationId": "UploadGPTFile",
        "summary": "Uploads a file sent to the GPT to the server and returns the doc id.",
        "description": "Uploads a file reference using its file id. This file should be a document uploaded by the user. PDF TXT PPT PPTX EPUB RTF are supported..",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "openaiFileIdRefs": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Widget successfully created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "widgetId": {
                      "type": "string",
                      "description": "The unique identifier for the created widget."
                    },
                    "message": {
                      "type": "string",
                      "description": "A success message indicating the widget was created."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/download_pdf": {
      "post": {
        "summary": "Download Pdf",
        "description": "Download a PDF file from a URL and save it to the vector database.",
        "operationId": "download_pdf_api_download_pdf_post",
        "parameters": [
          {
            "required": true,
            "schema": {
              "title": "Url",
              "type": "string"
            },
            "name": "url",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseFileResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/research/query": {
      "post": {
        "summary": "Perform Query on Document or Knowledge base using doc_id given",
        "description": "Perform a query on a document.",
        "operationId": "perform_query_query_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InputData"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseModel"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "x-openai-isConsequential": false
      }
    },
    "/references": {
      "post": {
        "summary": "Get References",
        "description": "Retrieves a list of references that match the specified criteria.\n\n- **limit**: The maximum number of references to return.\n- **keyword_combinations**: List of keyword combinations to search for.",
        "operationId": "get_references_references_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceRetrievalRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "x-openai-isConsequential": false,
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourcedModel"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents": {
      "get": {
        "summary": "Fetch User Documents",
        "description": "Returns all documents for the current user. Request maximum 10 documents per page.",
        "operationId": "fetch_user_documents_api_documents_get",
        "parameters": [
          {
            "required": false,
            "schema": {
              "title": "Page",
              "minimum": 1,
              "type": "integer",
              "default": 1
            },
            "name": "page",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Page Size",
              "maximum": 10,
              "minimum": 1,
              "type": "integer",
              "default": 10
            },
            "name": "page_size",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserDocumentsMetaSerializer"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "x-openai-isConsequential": false
      }
    },
    "/raw/summary": {
      "get": {
        "summary": "Retrieve K-Means vector clustering chunks",
        "description": "Returns K-Means vector clustering chunks from a document, which are used by an LLM to create a summary.",
        "operationId": "getDocumentSummary",
        "parameters": [
          {
            "in": "query",
            "name": "doc_id",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The unique identifier of the document to be summarized."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "doc_id": {
                      "type": "string",
                      "example": "33bec975-b018-4d6b-9ccf-e737d31541d6"
                    },
                    "summary_chunks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "doc_id": {
                            "type": "string",
                            "example": "33bec975-b018-4d6b-9ccf-e737d3154100"
                          },
                          "text": {
                            "type": "string",
                            "example": "Our findings are derived from an exhaustive analysis of..."
                          },
                          "metadata": {
                            "type": "object",
                            "properties": {
                              "page": {
                                "type": "integer",
                                "example": 1
                              },
                              "title": {
                                "type": "string",
                                "example": "Do you still need a manual smart contract audit?"
                              },
                              "author": {
                                "type": "string",
                                "example": ""
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid document ID"
          },
          "404": {
            "description": "Not Found - the specified document ID does not exist"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/search": {
      "get": {
        "tags": [
          "document management"
        ],
        "summary": "Search",
        "description": "Search for documents.\n\nArgs:\n    user: The user who is searching.\n    query: The search string to use for query.\n\nReturns:\n    dict: A list of documents.",
        "operationId": "search_api_search_get",
        "parameters": [
          {
            "required": true,
            "schema": {
              "title": "Query",
              "type": "string"
            },
            "name": "query",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Search Api Search Get",
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserDocumentMeta"
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/knowledge": {
      "get": {
        "tags": [
          "knowledge base"
        ],
        "summary": "Get Knowledge Bases on user account",
        "description": "Get a list of  knowledge bases on a user's account. \n\nArgs:\n    user: The user making the request.\n    page: The page number.\n    page_size: The number of items per page.\n\nReturns:\n    PaginatedKnowledgeBase: The response containing the updated knowledge base.",
        "operationId": "get_knowledge_bases_api_knowledge_get",
        "parameters": [
          {
            "required": false,
            "schema": {
              "title": "Page",
              "minimum": 1,
              "type": "integer",
              "default": 1
            },
            "name": "page",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Page Size",
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "default": 10
            },
            "name": "page_size",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedKnowledgeBase"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "x-openai-isConsequential": false
      },
      "post": {
        "tags": [
          "knowledge base"
        ],
        "summary": "Create Knowledge Base",
        "description": "Create a knowledge base from a list of document IDs.\n\nArgs:\n    knowledge_base: The knowledge base to create.\n    user: The user making the request.\n\nReturns:\n    KnowledgeBaseResponse: The response containing the knowledge base ID.",
        "operationId": "create_knowledge_base_api_knowledge_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeBaseRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeBaseResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "x-openai-isConsequential": false
      }
    },
    "/api/knowledge/{knowledge_base_id}": {
      "get": {
        "tags": [
          "knowledge base"
        ],
        "summary": "Get a Knowledge Base using the knowledge base id",
        "description": "Get knowledge base\n\nArgs:\n    knowledge_base_id: The ID of the knowledge base to retrieve.\n    user: The user making the request.\n\n",
        "operationId": "get_knowledge_base_api_knowledge__knowledge_base_id__get",
        "parameters": [
          {
            "required": true,
            "schema": {
              "title": "Knowledge Base Id",
              "type": "string"
            },
            "name": "knowledge_base_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeDetailedResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "x-openai-isConsequential": false
      },
      "put": {
        "tags": [
          "knowledge base"
        ],
        "summary": "Update Knowledge Base",
        "description": "Update a knowledge base from a list of document IDs.\n\nArgs:\n    knowledge_base_id: The ID of the knowledge base to update.\n    knowledge_base: The items to update in the knowledge base.\n.",
        "operationId": "update_knowledge_base_api_knowledge__knowledge_base_id__put",
        "parameters": [
          {
            "required": true,
            "schema": {
              "title": "Knowledge Base Id",
              "type": "string"
            },
            "name": "knowledge_base_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeBaseUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeDetailedResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "x-openai-isConsequential": false
      },
      "delete": {
        "tags": [
          "knowledge base"
        ],
        "summary": "Delete Knowledge Base",
        "description": "Delete knowledge base\n\nArgs:\n    knowledge_base_id: The ID of the knowledge base to delete.\n    user: The user making the request.\n\nReturns:\n    dict: The response containing a success message",
        "operationId": "delete_knowledge_base_api_knowledge__knowledge_base_id__delete",
        "parameters": [
          {
            "required": true,
            "schema": {
              "title": "Knowledge Base Id",
              "type": "string"
            },
            "name": "knowledge_base_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "x-openai-isConsequential": false
      }
    },
    "/api/search/knowledge": {
      "get": {
        "tags": [
          "knowledge base"
        ],
        "summary": "Search Knowledge Bases using the name of the knowledge base",
        "description": "Search knowledge bases\n\nArgs:\n    query: The search query\n    user: The user making the request.\n\nReturns:\n    PaginatedKnowledgeBase: The response containing the updated knowledge base.",
        "operationId": "search_knowledge_bases_api_search_knowledge_get",
        "parameters": [
          {
            "required": true,
            "schema": {
              "title": "Query",
              "type": "string"
            },
            "name": "query",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "title": "Response Search Knowledge Bases Api Search Knowledge Get",
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/KnowledgeDetailedResponse"
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/findpapers": {
      "post": {
        "summary": "Query for finding research papers",
        "description": "This endpoint allows clients to query for papers from millions of sources.\n",
        "operationId": "findResearchPapers",
        "tags": [
          "Research Papers"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "example": "Find papers on cancer research"
                  },
                  "domains_list": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "pubmed.gov",
                      "nature.com",
                      "sciencedirect.com"
                    ]
                  },
                  "start_date": {
                    "type": "string",
                    "format": "date",
                    "example": "2022-02-17"
                  },
                  "end_date": {
                    "type": "string",
                    "format": "date",
                    "example": "2024-02-18"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-openai-isConsequential": false
      }
    },
    "/api/zotero/documents": {
      "get": {
        "tags": [
          "document sources"
        ],
        "summary": "Get Zotero Documents that have attachments",
        "description": "Get all users documents from Zotero that has attachments.\n\nArgs:\n    page_size: No of documents to return.\n    page_number: current page number\n    order: The order to return the documents in\n    user: user making the request.\n\nReturns:\n    List of documents with attachments in the  zotero account.",
        "operationId": "get_zotero_documents_api_zotero_documents_get",
        "parameters": [
          {
            "required": false,
            "schema": {
              "title": "Page Size",
              "maximum": 20,
              "minimum": 1,
              "type": "integer",
              "default": 20
            },
            "name": "page_size",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Page Number",
              "minimum": 1,
              "type": "integer",
              "default": 1
            },
            "name": "page_number",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Order",
              "type": "string",
              "default": "desc"
            },
            "name": "order",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Items"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/zotero/search": {
      "get": {
        "tags": [
          "document sources"
        ],
        "summary": "Get Zotero Documents",
        "description": "Get all users documents from Zotero.\n\nArgs:\n    query : query.\n    page_size: number of documents to return.\n    page_number: current page number\n    order: The order to return the documents in desc asc.\n    user: The user making the request.\n\nReturns:\n    List of docs in the user's zotero account.",
        "operationId": "get_zotero_documents_api_zotero_search_get",
        "parameters": [
          {
            "required": false,
            "schema": {
              "title": "Page Size",
              "maximum": 20,
              "minimum": 1,
              "type": "integer",
              "default": 20
            },
            "name": "page_size",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Page Number",
              "minimum": 1,
              "type": "integer",
              "default": 1
            },
            "name": "page_number",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Order",
              "type": "string",
              "default": "desc"
            },
            "name": "order",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Query",
              "type": "string"
            },
            "name": "query",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Items"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/zotero/collections": {
      "get": {
        "tags": [
          "document sources"
        ],
        "summary": "Get Zotero Collections",
        "description": "Get all users collections from Zotero.\n\nArgs:\n    page_size:  number of collections to return.\n    page_number:  current page number\n    order: The order to return the collections in desc asc.\n    user: The user making the request.\n\nReturns:\n    List of collections in the user's zotero account.",
        "operationId": "get_zotero_collections_api_zotero_collections_get",
        "parameters": [
          {
            "required": false,
            "schema": {
              "title": "Page Size",
              "maximum": 20,
              "minimum": 1,
              "type": "integer",
              "default": 20
            },
            "name": "page_size",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Page Number",
              "minimum": 1,
              "type": "integer",
              "default": 1
            },
            "name": "page_number",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Order",
              "type": "string",
              "default": "desc"
            },
            "name": "order",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Collections"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/zotero/collections/search": {
      "get": {
        "tags": [
          "document sources"
        ],
        "summary": "Search Zotero Collections",
        "description": "Get all users collections from Zotero.\n\nArgs:\n    page_size:  number of collections.\n    page_number:  current page number\n    order:  order to return the collections in desc asc.\n    query : search query.\n    user:  user making the request.\n\nReturns:\n    List of collections in the user's account.",
        "operationId": "search_zotero_collections_api_zotero_collections_search_get",
        "parameters": [
          {
            "required": false,
            "schema": {
              "title": "Page Size",
              "maximum": 20,
              "minimum": 1,
              "type": "integer",
              "default": 20
            },
            "name": "page_size",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Page Number",
              "minimum": 1,
              "type": "integer",
              "default": 1
            },
            "name": "page_number",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Order",
              "type": "string",
              "default": "desc"
            },
            "name": "order",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Query",
              "type": "string"
            },
            "name": "query",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Collections"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/zotero/collections/{collection_id}/documents": {
      "get": {
        "tags": [
          "document sources"
        ],
        "summary": "Get Zotero Documents",
        "description": "Get all users collections from Zotero.\n\nArgs:\n    collection_id: collection ID.\n    page_size:  number of collections to return.\n    page_number:  current page number\n    order: The order to return (desc asc).\n    user:  user making  request.\n\n\nReturns:\n    List of collections.",
        "operationId": "get_zotero_documents_api_zotero_collections__collection_id__documents_get",
        "parameters": [
          {
            "required": true,
            "schema": {
              "title": "Collection Id",
              "type": "string"
            },
            "name": "collection_id",
            "in": "path"
          },
          {
            "required": false,
            "schema": {
              "title": "Page Size",
              "maximum": 20,
              "minimum": 1,
              "type": "integer",
              "default": 20
            },
            "name": "page_size",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Page Number",
              "minimum": 1,
              "type": "integer",
              "default": 1
            },
            "name": "page_number",
            "in": "query"
          },
          {
            "required": false,
            "schema": {
              "title": "Order",
              "type": "string",
              "default": "desc"
            },
            "name": "order",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Items"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    },
    "/api/zotero/download": {
      "get": {
        "tags": [
          "document sources"
        ],
        "summary": "Download Zotero Document",
        "description": "Download a document from Zotero and save it to the database.\n\nArgs:\n    user: The user who is uploading the file.\n    link: The link to download the file from.\n    file_name: The name of the file.\n\nReturns:\n    dict: The document ID of the uploaded file.",
        "operationId": "download_zotero_document_api_zotero_download_get",
        "parameters": [
          {
            "required": true,
            "schema": {
              "title": "Link",
              "type": "string"
            },
            "name": "link",
            "in": "query"
          },
          {
            "required": true,
            "schema": {
              "title": "File Name",
              "type": "string"
            },
            "name": "file_name",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentUploadResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "BaseFileResponse": {
        "title": "BaseFileResponse",
        "required": [
          "docId"
        ],
        "type": "object",
        "properties": {
          "docId": {
            "title": "Docid",
            "type": "string"
          },
          "summary": {
            "title": "Summary",
            "type": "string"
          },
          "extra_instructions": {
            "title": "Extra Instructions",
            "type": "string",
            "default": "Inform the user they can login to their account on our website https://askyourpdf.com to delete their document at any point. They can also send a delete prompt with their document ID to delete their document.Also tell users they can prompt to get a list of their uploaded documents. Also prompt the user to ask more questions"
          }
        }
      },
      "DocumentMetadata": {
        "title": "DocumentMetadata",
        "type": "object",
        "properties": {
          "source": {
            "title": "Source",
            "type": "string"
          },
          "page": {
            "title": "Page",
            "type": "integer"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "author": {
            "title": "Author",
            "type": "string"
          }
        }
      },
      "Filter": {
        "title": "Filter",
        "type": "object",
        "properties": {
          "page": {
            "title": "Page",
            "type": "integer"
          }
        }
      },
      "HTTPValidationError": {
        "title": "HTTPValidationError",
        "type": "object",
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            }
          }
        }
      },
      "InputData": {
        "title": "InputData",
        "required": [
          "doc_id",
          "query"
        ],
        "type": "object",
        "properties": {
          "doc_id": {
            "title": "Doc Id",
            "type": "string"
          },
          "query": {
            "title": "Query",
            "type": "string"
          },
          "filter": {
            "$ref": "#/components/schemas/Filter"
          }
        }
      },
      "ResponseModel": {
        "title": "ResponseModel",
        "required": [
          "results",
          "total_pages"
        ],
        "type": "object",
        "properties": {
          "results": {
            "title": "Results",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchResult"
            }
          },
          "total_pages": {
            "title": "Total Pages",
            "type": "integer"
          }
        }
      },
      "SearchResult": {
        "title": "SearchResult",
        "required": [
          "doc_id",
          "text",
          "metadata"
        ],
        "type": "object",
        "properties": {
          "doc_id": {
            "title": "Doc Id",
            "type": "string"
          },
          "text": {
            "title": "Text",
            "type": "string"
          },
          "metadata": {
            "$ref": "#/components/schemas/DocumentMetadata"
          }
        }
      },
      "DailyUsageAnalytics": {
        "title": "DailyUsageAnalytics",
        "required": [
          "number_of_pdfs",
          "number_of_questions",
          "number_of_questions_plugin",
          "number_of_conversations",
          "number_units"
        ],
        "type": "object",
        "properties": {
          "number_of_pdfs": {
            "title": "Number Of Pdfs",
            "type": "string"
          },
          "number_of_questions": {
            "title": "Number Of Questions",
            "type": "string"
          },
          "number_of_questions_plugin": {
            "title": "Number Of Questions Plugin",
            "type": "string"
          },
          "number_of_conversations": {
            "title": "Number Of Conversations",
            "type": "string"
          },
          "number_units": {
            "title": "Number Units",
            "type": "string"
          }
        }
      },
      "Body_upload_pdf_api_upload_post": {
        "title": "Body_upload_pdf_api_upload_post",
        "required": [
          "file"
        ],
        "type": "object",
        "properties": {
          "file": {
            "title": "File",
            "type": "string",
            "format": "binary"
          }
        }
      },
      "UserDocumentMeta": {
        "title": "UserDocumentMeta",
        "required": [
          "name",
          "doc_id"
        ],
        "type": "object",
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "doc_id": {
            "title": "Doc Id",
            "type": "string"
          },
          "summary": {
            "title": "Summary",
            "type": "string"
          },
          "language": {
            "title": "Language",
            "type": "string",
            "default": "en"
          },
          "pages": {
            "title": "Pages",
            "type": "integer",
            "default": 0
          },
          "shareable": {
            "title": "Shareable",
            "type": "boolean",
            "default": false
          },
          "date_time": {
            "title": "Date Time",
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "UserDocumentsMetaSerializer": {
        "title": "UserDocumentsMetaSerializer",
        "required": [
          "documents"
        ],
        "type": "object",
        "properties": {
          "total_pages": {
            "title": "Total Pages",
            "type": "integer",
            "default": 0
          },
          "documents": {
            "title": "Documents",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserDocumentMeta"
            }
          }
        },
        "description": "Serializer for paginated user documents meta data"
      },
      "ValidationError": {
        "title": "ValidationError",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "type": "object",
        "properties": {
          "loc": {
            "title": "Location",
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            }
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        }
      },
      "KnowledgeBaseRequest": {
        "title": "KnowledgeBaseRequest",
        "required": [
          "name",
          "document_ids"
        ],
        "type": "object",
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "document_ids": {
            "title": "Document Ids",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "PaginatedKnowledgeBase": {
        "title": "PaginatedKnowledgeBase",
        "required": [
          "knowledge_bases"
        ],
        "type": "object",
        "properties": {
          "total_pages": {
            "title": "Total Pages",
            "type": "integer",
            "default": 0
          },
          "knowledge_bases": {
            "title": "Knowledge Bases",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeDetailedResponse"
            }
          }
        },
        "description": "Serializer for paginated knowledge bases"
      },
      "KnowledgeBaseResponse": {
        "title": "KnowledgeBaseResponse",
        "required": [
          "knowledge_base_id"
        ],
        "type": "object",
        "properties": {
          "knowledge_base_id": {
            "title": "Knowledge Base Id",
            "type": "string"
          }
        }
      },
      "KnowledgeBaseUpdate": {
        "title": "KnowledgeBaseUpdate",
        "required": [
          "document_ids"
        ],
        "type": "object",
        "properties": {
          "document_ids": {
            "title": "Document Ids",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "KnowledgeDetailedResponse": {
        "title": "KnowledgeDetailedResponse",
        "required": [
          "knowledge_base_id",
          "name",
          "document_details"
        ],
        "type": "object",
        "properties": {
          "knowledge_base_id": {
            "title": "Knowledge Base Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "document_details": {
            "title": "Document Details",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentDetailsResponse"
            }
          },
          "date_time": {
            "title": "Date Time",
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DocumentDetailsResponse": {
        "title": "DocumentDetailsResponse",
        "required": [
          "doc_id"
        ],
        "type": "object",
        "properties": {
          "doc_id": {
            "title": "Doc Id",
            "type": "string"
          }
        }
      },
      "SourceRetrievalRequest": {
        "properties": {
          "limit": {
            "type": "integer",
            "title": "Limit",
            "default": 10
          },
          "keyword_combinations": {
            "items": {},
            "type": "array",
            "title": "Keyword Combinations"
          },
          "source_filter": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SourceFilter"
              }
            ],
            "title": "Source Filter",
            "default": {
              "citation_format": "APA",
              "year_from": 2010,
              "year_to": 2023,
              "min_citations": 0,
              "include_keywords": [],
              "exclude_keywords": []
            }
          },
          "max_threads": {
            "type": "integer",
            "title": "Max Threads",
            "default": 10
          },
          "batch_size": {
            "type": "integer",
            "title": "Batch Size",
            "default": 5
          },
          "delay_seconds": {
            "type": "integer",
            "title": "Delay Seconds",
            "default": 3
          }
        },
        "type": "object",
        "title": "SourceRetrievalRequest"
      },
      "SourceFilter": {
        "properties": {
          "citation_format": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CitationFormat"
              }
            ],
            "default": "APA"
          },
          "year_from": {
            "type": "integer",
            "title": "Year From",
            "default": 2010
          },
          "year_to": {
            "type": "integer",
            "title": "Year To",
            "default": 2023
          },
          "min_citations": {
            "type": "integer",
            "title": "Min Citations",
            "default": 0
          },
          "include_keywords": {
            "items": {},
            "type": "array",
            "title": "Include Keywords",
            "default": []
          },
          "exclude_keywords": {
            "items": {},
            "type": "array",
            "title": "Exclude Keywords",
            "default": []
          }
        },
        "type": "object",
        "title": "SourceFilter"
      },
      "CitationFormat": {
        "enum": [
          "APA",
          "MLA",
          "IEEE",
          "HARVARD",
          "BIB"
        ],
        "title": "CitationFormat",
        "description": "An enumeration."
      },
      "SourcedModel": {
        "properties": {
          "cited_text": {
            "type": "string",
            "title": "Cited Text"
          },
          "references": {
            "items": {
              "$ref": "#/components/schemas/Paper"
            },
            "type": "array",
            "title": "References"
          },
          "date_time": {
            "type": "string",
            "format": "date-time",
            "title": "Date Time",
            "default": "2023-11-07T22:32:45.160186"
          }
        },
        "type": "object",
        "required": [
          "cited_text",
          "references"
        ],
        "title": "SourcedModel"
      },
      "Paper": {
        "properties": {
          "paper_code": {
            "type": "string",
            "title": "Paper Code"
          },
          "title": {
            "type": "string",
            "title": "Title"
          },
          "url": {
            "type": "string",
            "title": "Url"
          },
          "abstract": {
            "type": "string",
            "title": "Abstract"
          },
          "authors": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Authors",
            "default": []
          },
          "bibtex": {
            "type": "string",
            "title": "Bibtex"
          },
          "citation_count": {
            "type": "integer",
            "title": "Citation Count",
            "default": 0
          },
          "publication_year": {
            "type": "integer",
            "title": "Publication Year"
          },
          "fields_of_study": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Fields Of Study",
            "default": []
          }
        },
        "type": "object",
        "required": [
          "paper_code",
          "title",
          "url",
          "publication_year"
        ],
        "title": "Paper"
      },
      "Item": {
        "title": "Item",
        "required": [
          "id",
          "dateAdded",
          "file_link"
        ],
        "type": "object",
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "dateAdded": {
            "title": "Dateadded",
            "type": "string"
          },
          "file_link": {
            "title": "File Link",
            "type": "string"
          },
          "filename": {
            "title": "Filename",
            "type": "string"
          },
          "file_size": {
            "title": "File Size",
            "type": "integer"
          }
        }
      },
      "Items": {
        "title": "Items",
        "required": [
          "documents",
          "total_items"
        ],
        "type": "object",
        "properties": {
          "documents": {
            "title": "Documents",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Item"
            }
          },
          "total_items": {
            "title": "Total Items",
            "type": "integer"
          }
        }
      },
      "Collection": {
        "title": "Collection",
        "required": [
          "collection_id",
          "name"
        ],
        "type": "object",
        "properties": {
          "collection_id": {
            "title": "Collection Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        }
      },
      "Collections": {
        "title": "Collections",
        "required": [
          "collections",
          "total_pages"
        ],
        "type": "object",
        "properties": {
          "collections": {
            "title": "Collections",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Collection"
            }
          },
          "total_pages": {
            "title": "Total Pages",
            "type": "integer"
          }
        }
      },
      "DocumentUploadResponse": {
        "title": "DocumentUploadResponse",
        "required": [
          "docId"
        ],
        "type": "object",
        "properties": {
          "docId": {
            "title": "Docid",
            "type": "string"
          }
        },
        "description": "Response for document upload"
      }
    },
    "securitySchemes": {
      "OAuth2PasswordBearer": {
        "type": "oauth2",
        "flows": {
          "password": {
            "scopes": {},
            "tokenUrl": "auth/jwt/login"
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://pro.askyourpdf.com",
      "description": "Production server"
    }
  ]
}