Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat add point generation and recommendation from qn #46

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading