Spaces:
Runtime error
Runtime error
Update chain_app.py
Browse files- chain_app.py +64 -63
chain_app.py
CHANGED
@@ -15,13 +15,13 @@ hf_text_client = Client("Artin2009/text-generation", hf_token=hf_token)
|
|
15 |
openai_client = OpenAI(api_key=openai_api_key)
|
16 |
groq_client = Groq(api_key=groq_api_key)
|
17 |
|
18 |
-
API_URL = "https://api-inference.huggingface.co/models/PartAI/TookaBERT-Large"
|
19 |
-
headers = {"Authorization": f"Bearer {hf_token}"}
|
20 |
|
21 |
|
22 |
-
def query(payload):
|
23 |
-
|
24 |
-
|
25 |
|
26 |
@cl.set_chat_profiles
|
27 |
async def chat_profile():
|
@@ -50,10 +50,10 @@ async def chat_profile():
|
|
50 |
name="gpt-3.5-turbo",
|
51 |
markdown_description="OpenAI's GPT-3.5 Turbo model",
|
52 |
),
|
53 |
-
cl.ChatProfile(
|
54 |
-
|
55 |
-
|
56 |
-
),
|
57 |
cl.ChatProfile(
|
58 |
name="gpt-3.5-turbo-1106",
|
59 |
markdown_description="OpenAI's GPT-3.5 Turbo 1106 model",
|
@@ -86,10 +86,10 @@ async def chat_profile():
|
|
86 |
name='mistral-7B',
|
87 |
markdown_description = 'mistral open source LLM with 7B parameters'
|
88 |
),
|
89 |
-
cl.ChatProfile(
|
90 |
-
|
91 |
-
|
92 |
-
)
|
93 |
]
|
94 |
|
95 |
@cl.on_chat_start
|
@@ -198,28 +198,28 @@ async def on_chat_start():
|
|
198 |
await cl.Message(
|
199 |
content="Im one of the OpenAI's models. one of the best models. i was configured by Artin Daneshvar and Sadra Noadoust, 2 iranian students to help you, how can i assist you today ? "
|
200 |
).send()
|
201 |
-
if chat_profile == 'GPT-3.5-turbo-0125':
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
await cl.Message(
|
221 |
-
|
222 |
-
).send()
|
223 |
|
224 |
if chat_profile == 'gpt-3.5-turbo-1106':
|
225 |
await cl.ChatSettings(
|
@@ -380,29 +380,28 @@ async def on_chat_start():
|
|
380 |
await cl.Message(
|
381 |
content="Im Mistral. the small version of Mistral Family. i was configured by Artin Daneshvar and Sadra Noadoust, 2 iranian students to help you, how can i assist you today ? "
|
382 |
).send()
|
383 |
-
if chat_profile == 'Toka-353M':
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
|
407 |
@cl.on_message
|
408 |
async def main(message: cl.Message):
|
@@ -665,11 +664,13 @@ async def main(message: cl.Message):
|
|
665 |
|
666 |
await cl.Message(content=complete_content).send()
|
667 |
|
668 |
-
elif chat_profile == 'Toka-353M':
|
669 |
-
|
670 |
-
|
671 |
-
})
|
672 |
-
|
|
|
|
|
673 |
|
674 |
@cl.on_settings_update
|
675 |
async def setup_agent(settings):
|
|
|
15 |
openai_client = OpenAI(api_key=openai_api_key)
|
16 |
groq_client = Groq(api_key=groq_api_key)
|
17 |
|
18 |
+
# API_URL = "https://api-inference.huggingface.co/models/PartAI/TookaBERT-Large"
|
19 |
+
# headers = {"Authorization": f"Bearer {hf_token}"}
|
20 |
|
21 |
|
22 |
+
# def query(payload):
|
23 |
+
# response = requests.post(API_URL, headers=headers, json=payload)
|
24 |
+
# return response.json()
|
25 |
|
26 |
@cl.set_chat_profiles
|
27 |
async def chat_profile():
|
|
|
50 |
name="gpt-3.5-turbo",
|
51 |
markdown_description="OpenAI's GPT-3.5 Turbo model",
|
52 |
),
|
53 |
+
# cl.ChatProfile(
|
54 |
+
# name="GPT-3.5-turbo-0125",
|
55 |
+
# markdown_description="OpenAI's GPT-3.5 Turbo 0125 model",
|
56 |
+
# ),
|
57 |
cl.ChatProfile(
|
58 |
name="gpt-3.5-turbo-1106",
|
59 |
markdown_description="OpenAI's GPT-3.5 Turbo 1106 model",
|
|
|
86 |
name='mistral-7B',
|
87 |
markdown_description = 'mistral open source LLM with 7B parameters'
|
88 |
),
|
89 |
+
# cl.ChatProfile(
|
90 |
+
# name="Toka-353M",
|
91 |
+
# markdown_description="PartAI Open Source model Toka with 353M parameters",
|
92 |
+
# )
|
93 |
]
|
94 |
|
95 |
@cl.on_chat_start
|
|
|
198 |
await cl.Message(
|
199 |
content="Im one of the OpenAI's models. one of the best models. i was configured by Artin Daneshvar and Sadra Noadoust, 2 iranian students to help you, how can i assist you today ? "
|
200 |
).send()
|
201 |
+
# if chat_profile == 'GPT-3.5-turbo-0125':
|
202 |
+
# await cl.ChatSettings(
|
203 |
+
# [
|
204 |
+
# Select(
|
205 |
+
# id="OpenAI-Model",
|
206 |
+
# label="OpenAI - Model",
|
207 |
+
# values=["gpt-3.5-turbo-0125"],
|
208 |
+
# initial_index=0,
|
209 |
+
# ),
|
210 |
+
# Slider(
|
211 |
+
# id="Temperature",
|
212 |
+
# label="Model Temperature",
|
213 |
+
# initial=0.7,
|
214 |
+
# min=0,
|
215 |
+
# max=1,
|
216 |
+
# step=0.1,
|
217 |
+
# ),
|
218 |
+
# ]
|
219 |
+
# ).send()
|
220 |
+
# await cl.Message(
|
221 |
+
# content="Im one of the OpenAI's models. one of the best models. i was configured by Artin Daneshvar and Sadra Noadoust, 2 iranian students to help you, how can i assist you today ? "
|
222 |
+
# ).send()
|
223 |
|
224 |
if chat_profile == 'gpt-3.5-turbo-1106':
|
225 |
await cl.ChatSettings(
|
|
|
380 |
await cl.Message(
|
381 |
content="Im Mistral. the small version of Mistral Family. i was configured by Artin Daneshvar and Sadra Noadoust, 2 iranian students to help you, how can i assist you today ? "
|
382 |
).send()
|
383 |
+
# if chat_profile == 'Toka-353M':
|
384 |
+
# await cl.ChatSettings(
|
385 |
+
# [
|
386 |
+
# Select(
|
387 |
+
# id="PartAI-Model",
|
388 |
+
# label="PartAI - Model",
|
389 |
+
# values=["TokaBert-353M"],
|
390 |
+
# initial_index=0,
|
391 |
+
# ),
|
392 |
+
# Slider(
|
393 |
+
# id="Temperature",
|
394 |
+
# label="Model Temperature",
|
395 |
+
# initial=0.7,
|
396 |
+
# min=0,
|
397 |
+
# max=1,
|
398 |
+
# step=0.1,
|
399 |
+
# ),
|
400 |
+
# ]
|
401 |
+
# ).send()
|
402 |
+
# await cl.Message(
|
403 |
+
# content="Im Toka. An opens source persian LLM . i was configured by Artin Daneshvar and Sadra Noadoust, 2 iranian students to help you, how can i assist you today ? you should ask me your questions like : the capital of england is <mask> "
|
404 |
+
# ).send()
|
|
|
405 |
|
406 |
@cl.on_message
|
407 |
async def main(message: cl.Message):
|
|
|
664 |
|
665 |
await cl.Message(content=complete_content).send()
|
666 |
|
667 |
+
# elif chat_profile == 'Toka-353M':
|
668 |
+
# output = query({
|
669 |
+
# "inputs": message.content,
|
670 |
+
# })
|
671 |
+
# await cl.Message(
|
672 |
+
# content=output[0]['sequence']
|
673 |
+
# ).send()
|
674 |
|
675 |
@cl.on_settings_update
|
676 |
async def setup_agent(settings):
|