complete doc string for chat
Browse files
app.py
CHANGED
|
@@ -29,7 +29,20 @@ retrieve_giec = EmbeddingRetriever(
|
|
| 29 |
)
|
| 30 |
|
| 31 |
|
| 32 |
-
def chat(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
retriever = retrieve_all if report_type == "All available" else retrieve_giec
|
| 34 |
docs = retriever.retrieve(query=query, top_k=10)
|
| 35 |
|
|
|
|
| 29 |
)
|
| 30 |
|
| 31 |
|
| 32 |
+
def chat(
|
| 33 |
+
query: str, history: list = [system_template], report_type: str = "All available", threshold: float = 0.56
|
| 34 |
+
) -> tuple:
|
| 35 |
+
"""retrieve relevant documents in the document store then query gpt-turbo
|
| 36 |
+
|
| 37 |
+
Args:
|
| 38 |
+
query (str): user message.
|
| 39 |
+
history (list, optional): history of the conversation. Defaults to [system_template].
|
| 40 |
+
report_type (str, optional): should be "All available" or "IPCC only". Defaults to "All available".
|
| 41 |
+
threshold (float, optional): similarity threshold, don't increase more than 0.568. Defaults to 0.56.
|
| 42 |
+
|
| 43 |
+
Yields:
|
| 44 |
+
tuple: chat gradio format, chat openai format, sources used.
|
| 45 |
+
"""
|
| 46 |
retriever = retrieve_all if report_type == "All available" else retrieve_giec
|
| 47 |
docs = retriever.retrieve(query=query, top_k=10)
|
| 48 |
|