Spaces:
Paused
Paused
Pavol Liška commited on
Commit ·
b11dd45
1
Parent(s): 593b823
cleanup requirements, fix api
Browse files- api.py +2 -1
- conversation/conversation_store.py +3 -2
- requirements.txt +7 -7
api.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from fastapi import FastAPI, Response, Body, Security
|
| 2 |
from fastapi.security import APIKeyHeader
|
| 3 |
from pydantic import BaseModel, model_validator
|
|
@@ -85,7 +86,7 @@ async def qa(api_key: str = Security(api_key_header), data: QModel = Body(...)):
|
|
| 85 |
"rewrite_prompt_id": rewrite_prompt_id,
|
| 86 |
"check_result": check_result,
|
| 87 |
"temperature": data.temperature,
|
| 88 |
-
"retrieve_document_count": data.retrieval_count,
|
| 89 |
}
|
| 90 |
)
|
| 91 |
|
|
|
|
| 1 |
+
from bson import ObjectId
|
| 2 |
from fastapi import FastAPI, Response, Body, Security
|
| 3 |
from fastapi.security import APIKeyHeader
|
| 4 |
from pydantic import BaseModel, model_validator
|
|
|
|
| 86 |
"rewrite_prompt_id": rewrite_prompt_id,
|
| 87 |
"check_result": check_result,
|
| 88 |
"temperature": data.temperature,
|
| 89 |
+
"retrieve_document_count": str(data.retrieval_count),
|
| 90 |
}
|
| 91 |
)
|
| 92 |
|
conversation/conversation_store.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
|
|
|
|
| 3 |
from dotenv import load_dotenv
|
| 4 |
from pymongo import MongoClient
|
| 5 |
|
|
@@ -52,7 +53,7 @@ class ConversationStore:
|
|
| 52 |
|
| 53 |
storage = ConversationStorage(URI, DB_NAME, COLLECTION_NAME)
|
| 54 |
|
| 55 |
-
def save_content(self, q, a=None, sources: list[str] = None, params: dict[str, str] = None):
|
| 56 |
return self.storage.store_document_mongodb(
|
| 57 |
Conversation(
|
| 58 |
conversation=[
|
|
@@ -64,7 +65,7 @@ class ConversationStore:
|
|
| 64 |
],
|
| 65 |
params=params
|
| 66 |
)
|
| 67 |
-
)
|
| 68 |
|
| 69 |
def get_all(self):
|
| 70 |
return self.storage.get_all()
|
|
|
|
| 1 |
import os
|
| 2 |
|
| 3 |
+
from bson import ObjectId
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
from pymongo import MongoClient
|
| 6 |
|
|
|
|
| 53 |
|
| 54 |
storage = ConversationStorage(URI, DB_NAME, COLLECTION_NAME)
|
| 55 |
|
| 56 |
+
def save_content(self, q, a=None, sources: list[str] = None, params: dict[str, str] = None) -> ObjectId:
|
| 57 |
return self.storage.store_document_mongodb(
|
| 58 |
Conversation(
|
| 59 |
conversation=[
|
|
|
|
| 65 |
],
|
| 66 |
params=params
|
| 67 |
)
|
| 68 |
+
).__str__()
|
| 69 |
|
| 70 |
def get_all(self):
|
| 71 |
return self.storage.get_all()
|
requirements.txt
CHANGED
|
@@ -8,14 +8,14 @@ langchain-google-genai
|
|
| 8 |
langchain-together
|
| 9 |
langchain-mongodb
|
| 10 |
|
| 11 |
-
fitz
|
| 12 |
-
pypdf
|
| 13 |
-
tools
|
| 14 |
python-dotenv
|
| 15 |
pymongo
|
| 16 |
pydantic
|
| 17 |
-
chromadb
|
| 18 |
-
bs4
|
| 19 |
fastapi
|
| 20 |
gptcache
|
| 21 |
|
|
@@ -23,5 +23,5 @@ fastapi
|
|
| 23 |
requests
|
| 24 |
uvicorn[standard]
|
| 25 |
|
| 26 |
-
sentence-transformers
|
| 27 |
-
text_generation
|
|
|
|
| 8 |
langchain-together
|
| 9 |
langchain-mongodb
|
| 10 |
|
| 11 |
+
#fitz
|
| 12 |
+
#pypdf
|
| 13 |
+
#tools
|
| 14 |
python-dotenv
|
| 15 |
pymongo
|
| 16 |
pydantic
|
| 17 |
+
#chromadb
|
| 18 |
+
#bs4
|
| 19 |
fastapi
|
| 20 |
gptcache
|
| 21 |
|
|
|
|
| 23 |
requests
|
| 24 |
uvicorn[standard]
|
| 25 |
|
| 26 |
+
#sentence-transformers
|
| 27 |
+
#text_generation
|