Umang Chaudhry commited on
Commit
b32f76b
1 Parent(s): 8e04782

Merge pull request #97 from vanderbilt-data-science/return-db-texts

Browse files
free_speech_app/FreeSpeechPromptsResponses.py CHANGED
@@ -55,7 +55,10 @@ def query_retriever(db, query, num_results = 3):
55
  retriever = db.as_retriever(search_kwargs={"k": num_results})
56
  docs = retriever.get_relevant_documents(query)
57
 
58
- return docs
 
 
 
59
 
60
  # %% ../nbs/free-speech-prompts.ipynb 10
61
  def generate_custom_prompt(original_post, principles=None, writing_style=None, word_limit=None):
 
55
  retriever = db.as_retriever(search_kwargs={"k": num_results})
56
  docs = retriever.get_relevant_documents(query)
57
 
58
+ docs_as_text = [doc.page_content for doc in docs]
59
+ docs_as_one_string = ' '.join(str(i)+ "\n" for i in docs_as_text)
60
+
61
+ return docs_as_one_string
62
 
63
  # %% ../nbs/free-speech-prompts.ipynb 10
64
  def generate_custom_prompt(original_post, principles=None, writing_style=None, word_limit=None):