Update app.py
Browse files
app.py
CHANGED
|
@@ -44,7 +44,6 @@ def invoke(openai_api_key, prompt, rag_option):
|
|
| 44 |
rag = LlamaIndexRAG()
|
| 45 |
rag.ingestion(config)
|
| 46 |
|
| 47 |
-
prompt_template = ""
|
| 48 |
completion = ""
|
| 49 |
result = ""
|
| 50 |
callback = ""
|
|
@@ -54,17 +53,14 @@ def invoke(openai_api_key, prompt, rag_option):
|
|
| 54 |
start_time_ms = round(time.time() * 1000)
|
| 55 |
|
| 56 |
if (rag_option == RAG_LANGCHAIN):
|
| 57 |
-
prompt_template = os.environ["LANGCHAIN_TEMPLATE"]
|
| 58 |
rag = LangChainRAG()
|
| 59 |
completion, chain, callback = rag.rag_chain(config, prompt)
|
| 60 |
|
| 61 |
result = completion["result"]
|
| 62 |
elif (rag_option == RAG_LLAMAINDEX):
|
| 63 |
-
prompt_template = os.environ["LLAMAINDEX_TEMPLATE"]
|
| 64 |
rag = LlamaIndexRAG()
|
| 65 |
result = rag.retrieval(config, prompt)
|
| 66 |
else:
|
| 67 |
-
prompt_template = os.environ["TEMPLATE"]
|
| 68 |
rag = LangChainRAG()
|
| 69 |
completion, chain, callback = rag.llm_chain(config, prompt)
|
| 70 |
|
|
@@ -81,7 +77,6 @@ def invoke(openai_api_key, prompt, rag_option):
|
|
| 81 |
trace_wandb(
|
| 82 |
config,
|
| 83 |
rag_option,
|
| 84 |
-
prompt_template,
|
| 85 |
prompt,
|
| 86 |
completion,
|
| 87 |
result,
|
|
|
|
| 44 |
rag = LlamaIndexRAG()
|
| 45 |
rag.ingestion(config)
|
| 46 |
|
|
|
|
| 47 |
completion = ""
|
| 48 |
result = ""
|
| 49 |
callback = ""
|
|
|
|
| 53 |
start_time_ms = round(time.time() * 1000)
|
| 54 |
|
| 55 |
if (rag_option == RAG_LANGCHAIN):
|
|
|
|
| 56 |
rag = LangChainRAG()
|
| 57 |
completion, chain, callback = rag.rag_chain(config, prompt)
|
| 58 |
|
| 59 |
result = completion["result"]
|
| 60 |
elif (rag_option == RAG_LLAMAINDEX):
|
|
|
|
| 61 |
rag = LlamaIndexRAG()
|
| 62 |
result = rag.retrieval(config, prompt)
|
| 63 |
else:
|
|
|
|
| 64 |
rag = LangChainRAG()
|
| 65 |
completion, chain, callback = rag.llm_chain(config, prompt)
|
| 66 |
|
|
|
|
| 77 |
trace_wandb(
|
| 78 |
config,
|
| 79 |
rag_option,
|
|
|
|
| 80 |
prompt,
|
| 81 |
completion,
|
| 82 |
result,
|