bstraehle commited on
Commit
5387890
·
verified ·
1 Parent(s): 27e748d

Rename openai_embedding.py to openai_.py

Browse files
Files changed (1) hide show
  1. openai_embedding.py → openai_.py +4 -4
openai_embedding.py → openai_.py RENAMED
@@ -21,9 +21,9 @@ def get_embedding(text):
21
  print(f"Error in get_embedding: {e}")
22
  return None
23
 
24
- def handle_user_query(query, db, collection):
25
  # Assuming vector_search returns a list of dictionaries with keys 'title' and 'plot'
26
- get_knowledge = vector_search(query, db, collection)
27
 
28
  # Check if there are any results
29
  if not get_knowledge:
@@ -47,7 +47,7 @@ def handle_user_query(query, db, collection):
47
  "content": "You are a airbnb listing recommendation system."},
48
  {
49
  "role": "user",
50
- "content": f"Answer this user query: {query} with the following context:\n{search_results_df}"
51
  }
52
  ]
53
  )
@@ -55,7 +55,7 @@ def handle_user_query(query, db, collection):
55
  system_response = completion.choices[0].message.content
56
 
57
  # Print User Question, System Response, and Source Information
58
- print(f"- User Question:\n{query}\n")
59
  print(f"- System Response:\n{system_response}\n")
60
 
61
  # Display the DataFrame as an HTML table
 
21
  print(f"Error in get_embedding: {e}")
22
  return None
23
 
24
+ def handle_user_prompt(prompt, db, collection):
25
  # Assuming vector_search returns a list of dictionaries with keys 'title' and 'plot'
26
+ get_knowledge = vector_search(prompt, db, collection)
27
 
28
  # Check if there are any results
29
  if not get_knowledge:
 
47
  "content": "You are a airbnb listing recommendation system."},
48
  {
49
  "role": "user",
50
+ "content": f"Answer this user prompt: {prompt} with the following context:\n{search_results_df}"
51
  }
52
  ]
53
  )
 
55
  system_response = completion.choices[0].message.content
56
 
57
  # Print User Question, System Response, and Source Information
58
+ print(f"- User Question:\n{prompt}\n")
59
  print(f"- System Response:\n{system_response}\n")
60
 
61
  # Display the DataFrame as an HTML table