Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -29,7 +29,8 @@ from langchain_huggingface import HuggingFaceEndpoint
|
|
29 |
from langchain_core.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
30 |
|
31 |
#logging.basicConfig(level=logging.DEBUG)
|
32 |
-
|
|
|
33 |
#HF_INFERENCE_ENDPOINT =
|
34 |
#BOOKING_ID = re.compile(r'\b[A-Z]{6}\d{6}\b')
|
35 |
|
@@ -98,7 +99,7 @@ api_response_prompt = PromptTemplate(
|
|
98 |
def setup_multiple_chains():
|
99 |
|
100 |
llm = OpenAI(model='gpt-3.5-turbo-instruct',
|
101 |
-
temperature=0.7)
|
102 |
|
103 |
#llm = HuggingFaceEndpoint(
|
104 |
#repo_id="google/gemma-2-2b", #"norallm/normistral-7b-warm-instruct",
|
@@ -111,9 +112,9 @@ def setup_multiple_chains():
|
|
111 |
#typical_p=0.95,
|
112 |
#temperature=0.7,
|
113 |
#repetition_penalty=1.03,
|
114 |
-
#huggingfacehub_api_token=
|
115 |
#task="text-generation"
|
116 |
-
|
117 |
|
118 |
#llm = HuggingFacePipeline.from_model_id(
|
119 |
#model_id="normistral-7b-warm-instruct",
|
@@ -171,6 +172,5 @@ async def handle_message(message: cl.Message):
|
|
171 |
|
172 |
|
173 |
response_key = "output" if "output" in response else "text"
|
174 |
-
logging.debug({response})
|
175 |
await cl.Message(response.get(response_key, "")).send()
|
176 |
return message.content
|
|
|
29 |
from langchain_core.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
30 |
|
31 |
#logging.basicConfig(level=logging.DEBUG)
|
32 |
+
HUGGINGFACEHUB_API_TOKEN = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
|
33 |
+
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
|
34 |
#HF_INFERENCE_ENDPOINT =
|
35 |
#BOOKING_ID = re.compile(r'\b[A-Z]{6}\d{6}\b')
|
36 |
|
|
|
99 |
def setup_multiple_chains():
|
100 |
|
101 |
llm = OpenAI(model='gpt-3.5-turbo-instruct',
|
102 |
+
temperature=0.7, openai_api_key=OPENAI_API_KEY)
|
103 |
|
104 |
#llm = HuggingFaceEndpoint(
|
105 |
#repo_id="google/gemma-2-2b", #"norallm/normistral-7b-warm-instruct",
|
|
|
112 |
#typical_p=0.95,
|
113 |
#temperature=0.7,
|
114 |
#repetition_penalty=1.03,
|
115 |
+
#huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN,
|
116 |
#task="text-generation"
|
117 |
+
)
|
118 |
|
119 |
#llm = HuggingFacePipeline.from_model_id(
|
120 |
#model_id="normistral-7b-warm-instruct",
|
|
|
172 |
|
173 |
|
174 |
response_key = "output" if "output" in response else "text"
|
|
|
175 |
await cl.Message(response.get(response_key, "")).send()
|
176 |
return message.content
|