jost commited on
Commit
1503035
·
verified ·
1 Parent(s): cfa7e2c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -57,7 +57,7 @@ def predict(
57
  manifesto_collection = client.get_or_create_collection(name="manifesto-database", embedding_function=multilingual_embeddings)
58
  retrieved_context = manifesto_collection.query(query_texts=[political_statement[3:]], n_results=num_contexts, where={"ideology": direct_steering_option})
59
  contexts = [context for context in retrieved_context['documents']]
60
- rag_template = f"\nHier sind Kontextinformationen:\n" + "\n".join([f"{context}" for context in contexts])
61
 
62
  prompt = prompt_template.format(impersonation_template=impersonation_template, answer_option_template=answer_option_template, statement=political_statement[3:], rag_template=rag_template)
63
  print(prompt)
@@ -83,7 +83,7 @@ def predict(
83
  impersonation_template = ""
84
  answer_option_template = f"{test_format[ideology_test]}"
85
  rag_template = ""
86
- prompt = prompt_template.format(impersonation_template=impersonation_template, answer_option_template=answer_option_template, statement=political_statement, rag_template=rag_template)
87
  print(prompt)
88
 
89
  client = OpenAI(base_url=togetherai_base_url, api_key=togetherai_api_key)
 
57
  manifesto_collection = client.get_or_create_collection(name="manifesto-database", embedding_function=multilingual_embeddings)
58
  retrieved_context = manifesto_collection.query(query_texts=[political_statement[3:]], n_results=num_contexts, where={"ideology": direct_steering_option})
59
  contexts = [context for context in retrieved_context['documents']]
60
+ rag_template = f"\nHier sind Kontextinformationen:\n" + "\n".join([f"{context}" for context in contexts[0]])
61
 
62
  prompt = prompt_template.format(impersonation_template=impersonation_template, answer_option_template=answer_option_template, statement=political_statement[3:], rag_template=rag_template)
63
  print(prompt)
 
83
  impersonation_template = ""
84
  answer_option_template = f"{test_format[ideology_test]}"
85
  rag_template = ""
86
+ prompt = prompt_template.format(impersonation_template=impersonation_template, answer_option_template=answer_option_template, statement=political_statement[3:], rag_template=rag_template)
87
  print(prompt)
88
 
89
  client = OpenAI(base_url=togetherai_base_url, api_key=togetherai_api_key)