Spaces:
Running
Running
ryanrwatkins
commited on
Commit
•
02de959
1
Parent(s):
4e61c8c
Update app.py
Browse files
app.py
CHANGED
@@ -41,6 +41,12 @@ from langchain_core.runnables import RunnableLambda, RunnableParallel, RunnableP
|
|
41 |
from langchain.schema import Document, format_document
|
42 |
from langchain_core.messages import AIMessage, HumanMessage, get_buffer_string
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
# OutputParser
|
45 |
from langchain_core.output_parsers import StrOutputParser
|
46 |
|
@@ -464,28 +470,14 @@ def instantiate_LLM(LLM_provider,api_key,temperature=0.5,top_p=0.95,model_name=N
|
|
464 |
temperature=temperature,
|
465 |
top_p=top_p,
|
466 |
convert_system_message_to_human=True,
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
},
|
476 |
-
{
|
477 |
-
"category": "HARM_CATEGORY_HATE_SPEECH",
|
478 |
-
"threshold": "BLOCK_NONE",
|
479 |
-
},
|
480 |
-
{
|
481 |
-
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
482 |
-
"threshold": "BLOCK_NONE",
|
483 |
-
},
|
484 |
-
{
|
485 |
-
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
|
486 |
-
"threshold": "BLOCK_NONE",
|
487 |
-
},
|
488 |
-
]
|
489 |
)
|
490 |
if LLM_provider == "HuggingFace":
|
491 |
llm = HuggingFaceHub(
|
|
|
41 |
from langchain.schema import Document, format_document
|
42 |
from langchain_core.messages import AIMessage, HumanMessage, get_buffer_string
|
43 |
|
44 |
+
from langchain_google_genai import (
|
45 |
+
ChatGoogleGenerativeAI,
|
46 |
+
HarmBlockThreshold,
|
47 |
+
HarmCategory,
|
48 |
+
)
|
49 |
+
|
50 |
# OutputParser
|
51 |
from langchain_core.output_parsers import StrOutputParser
|
52 |
|
|
|
470 |
temperature=temperature,
|
471 |
top_p=top_p,
|
472 |
convert_system_message_to_human=True,
|
473 |
+
safety_settings=[
|
474 |
+
{HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_NONE,},
|
475 |
+
{HarmCategory.HARM_CATEGORY_HARASSMENT: HarmBlockThreshold.BLOCK_NONE,},
|
476 |
+
{HarmCategory.HARM_CATEGORY_HATE_SPEECH: HarmBlockThreshold.BLOCK_NONE,},
|
477 |
+
{HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT: HarmBlockThreshold.BLOCK_NONE,},
|
478 |
+
{HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_NONE,},
|
479 |
+
],
|
480 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
)
|
482 |
if LLM_provider == "HuggingFace":
|
483 |
llm = HuggingFaceHub(
|