Skip to content

Commit

Permalink
Merge pull request #46 from cs3216-a3-group-4/feat-add-point-generati…
Browse files Browse the repository at this point in the history
…on-and-recommendation-from-qn

Feat add point generation and recommendation from qn
  • Loading branch information
marcus-ny authored Sep 24, 2024
2 parents 0ecab69 + 7e048e4 commit 883c3b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 9 additions & 2 deletions backend/src/embeddings/vector_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,15 @@ def store_documents():
)
documents.append(document)

uuids = [str(uuid4()) for _ in range(len(documents))]
vector_store.add_documents(documents=documents, ids=uuids)
ids = [
str(document.metadata["id"])
+ "-"
+ str(document.metadata["event_id"])
+ "-"
+ str(document.metadata["category_id"])
for document in documents
]
vector_store.add_documents(documents=documents, ids=ids)

print(f"Stored {len(documents)} documents")

Expand Down
6 changes: 6 additions & 0 deletions backend/src/user_questions/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from src.notes.models import Note
from src.user_questions.models import Answer, Point, UserQuestion
from src.user_questions.schemas import CreateUserQuestion, UserQuestionMiniDTO
from src.lm.generate_points import get_relevant_analyses


router = APIRouter(prefix="/user-questions", tags=["user-questions"])
Expand Down Expand Up @@ -91,3 +92,8 @@ def create_user_question(
session.commit()
session.refresh(user_question)
return user_question


@router.get("/ask-gp-question")
def ask_gp_question(question: str):
return get_relevant_analyses(question)

0 comments on commit 883c3b9

Please sign in to comment.