Cheselle commited on
Commit
e8dada5
·
verified ·
1 Parent(s): a39d706

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -45,7 +45,7 @@ combined_documents = recursive_framework_document + recursive_blueprint_document
45
  #embeddings = AutoModel.from_pretrained("Cheselle/finetuned-arctic-sentence")
46
 
47
  from sentence_transformers import SentenceTransformer
48
- embeddings = SentenceTransformer("Cheselle/finetuned-arctic-sentence")
49
 
50
  vectorstore = Qdrant.from_documents(
51
  documents=combined_documents,
@@ -53,7 +53,7 @@ vectorstore = Qdrant.from_documents(
53
  location=":memory:",
54
  collection_name="ai_policy"
55
  )
56
- alt_retriever = vectorstore.as_retriever()
57
 
58
  ## Generation LLM
59
  llm = ChatOpenAI(model="gpt-4o-mini")
@@ -73,7 +73,7 @@ retrieval_augmented_qa_chain = (
73
  # INVOKE CHAIN WITH: {"question" : "<<SOME USER QUESTION>>"}
74
  # "question" : populated by getting the value of the "question" key
75
  # "context" : populated by getting the value of the "question" key and chaining it into the base_retriever
76
- {"context": itemgetter("question") | alt_retriever, "question": itemgetter("question")}
77
  # "context" : is assigned to a RunnablePassthrough object (will not be called or considered in the next step)
78
  # by getting the value of the "context" key from the previous step
79
  | RunnablePassthrough.assign(context=itemgetter("context"))
 
45
  #embeddings = AutoModel.from_pretrained("Cheselle/finetuned-arctic-sentence")
46
 
47
  from sentence_transformers import SentenceTransformer
48
+ embeddings = SentenceTransformer("Cheselle/finetuned-arctic-sentence", from_flax=True)
49
 
50
  vectorstore = Qdrant.from_documents(
51
  documents=combined_documents,
 
53
  location=":memory:",
54
  collection_name="ai_policy"
55
  )
56
+ retriever = vectorstore.as_retriever()
57
 
58
  ## Generation LLM
59
  llm = ChatOpenAI(model="gpt-4o-mini")
 
73
  # INVOKE CHAIN WITH: {"question" : "<<SOME USER QUESTION>>"}
74
  # "question" : populated by getting the value of the "question" key
75
  # "context" : populated by getting the value of the "question" key and chaining it into the base_retriever
76
+ {"context": itemgetter("question") | retriever, "question": itemgetter("question")}
77
  # "context" : is assigned to a RunnablePassthrough object (will not be called or considered in the next step)
78
  # by getting the value of the "context" key from the previous step
79
  | RunnablePassthrough.assign(context=itemgetter("context"))