Update app.py
Browse files
app.py
CHANGED
|
@@ -286,10 +286,19 @@ def invoke (prompt, history, rag_option, openai_api_key, temperature=0.9, max_n
|
|
| 286 |
#LLM auswählen (OpenAI oder HF)
|
| 287 |
###########################
|
| 288 |
#Anfrage an OpenAI
|
| 289 |
-
llm = ChatOpenAI(model_name = MODEL_NAME, openai_api_key = openai_api_key, temperature=temperature)#, top_p = top_p)
|
| 290 |
#oder an Hugging Face
|
| 291 |
#llm = HuggingFaceHub(repo_id=repo_id, model_kwargs={"temperature": 0.5, "max_length": 64})
|
| 292 |
#llm = HuggingFaceHub(url_??? = "https://wdgsjd6zf201mufn.us-east-1.aws.endpoints.huggingface.cloud", model_kwargs={"temperature": 0.5, "max_length": 64})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
|
| 294 |
#zusätzliche Dokumenten Splits aus DB zum Prompt hinzufügen (aus VektorDB - Chroma oder Mongo DB)
|
| 295 |
if (rag_option == "An"):
|
|
|
|
| 286 |
#LLM auswählen (OpenAI oder HF)
|
| 287 |
###########################
|
| 288 |
#Anfrage an OpenAI
|
| 289 |
+
#llm = ChatOpenAI(model_name = MODEL_NAME, openai_api_key = openai_api_key, temperature=temperature)#, top_p = top_p)
|
| 290 |
#oder an Hugging Face
|
| 291 |
#llm = HuggingFaceHub(repo_id=repo_id, model_kwargs={"temperature": 0.5, "max_length": 64})
|
| 292 |
#llm = HuggingFaceHub(url_??? = "https://wdgsjd6zf201mufn.us-east-1.aws.endpoints.huggingface.cloud", model_kwargs={"temperature": 0.5, "max_length": 64})
|
| 293 |
+
llm = HuggingFaceTextGenInference(
|
| 294 |
+
inference_server_url="https://wdgsjd6zf201mufn.us-east-1.aws.endpoints.huggingface.cloud", #"http://localhost:8010/",
|
| 295 |
+
max_new_tokens=max_new_tokens,
|
| 296 |
+
top_k=10,
|
| 297 |
+
top_p=top_p,
|
| 298 |
+
typical_p=0.95,
|
| 299 |
+
temperature=temperature,
|
| 300 |
+
repetition_penalty=repetition_penalty,
|
| 301 |
+
)
|
| 302 |
|
| 303 |
#zusätzliche Dokumenten Splits aus DB zum Prompt hinzufügen (aus VektorDB - Chroma oder Mongo DB)
|
| 304 |
if (rag_option == "An"):
|