Spaces:
Runtime error
Runtime error
Update chain_app.py
Browse files- chain_app.py +17 -15
chain_app.py
CHANGED
@@ -1907,6 +1907,8 @@ async def on_chat_start():
|
|
1907 |
@cl.on_message
|
1908 |
async def main(message: cl.Message):
|
1909 |
chat_profile = cl.user_session.get("chat_profile")
|
|
|
|
|
1910 |
res = await cl.AskActionMessage(
|
1911 |
content="Is that message correct and accurate ? check it and choose an option:",
|
1912 |
actions=[
|
@@ -1920,7 +1922,7 @@ async def main(message: cl.Message):
|
|
1920 |
completion = openai_client.chat.completions.create(
|
1921 |
model="ft:gpt-3.5-turbo-1106:nb:aria1:9UWDrLJK",
|
1922 |
messages=[
|
1923 |
-
{"role": "system", "content": "You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust"},
|
1924 |
{"role": "user", "content": message.content}
|
1925 |
]
|
1926 |
)
|
@@ -1932,7 +1934,7 @@ async def main(message: cl.Message):
|
|
1932 |
elif chat_profile == "Dorna-AI":
|
1933 |
result = hf_text_client.predict(
|
1934 |
message=message.content,
|
1935 |
-
request="
|
1936 |
param_3=512,
|
1937 |
param_4=0.7,
|
1938 |
param_5=0.95,
|
@@ -1946,7 +1948,7 @@ async def main(message: cl.Message):
|
|
1946 |
completion = openai_client.chat.completions.create(
|
1947 |
model="gpt-4o-mini",
|
1948 |
messages=[
|
1949 |
-
{"role": "system", "content": "You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust"},
|
1950 |
{"role": "user", "content": message.content}
|
1951 |
]
|
1952 |
)
|
@@ -1975,7 +1977,7 @@ async def main(message: cl.Message):
|
|
1975 |
completion = openai_client.chat.completions.create(
|
1976 |
model="gpt-4",
|
1977 |
messages=[
|
1978 |
-
{"role": "system", "content": "You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust"},
|
1979 |
{"role": "user", "content": message.content}
|
1980 |
]
|
1981 |
)
|
@@ -1988,7 +1990,7 @@ async def main(message: cl.Message):
|
|
1988 |
completion = openai_client.chat.completions.create(
|
1989 |
model="gpt-3.5-turbo",
|
1990 |
messages=[
|
1991 |
-
{"role": "system", "content": "You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust"},
|
1992 |
{"role": "user", "content": message.content}
|
1993 |
]
|
1994 |
)
|
@@ -2000,7 +2002,7 @@ async def main(message: cl.Message):
|
|
2000 |
completion = openai_client.chat.completions.create(
|
2001 |
model="GPT-3.5-turbo-0125",
|
2002 |
messages=[
|
2003 |
-
{"role": "system", "content": "You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust"},
|
2004 |
{"role": "user", "content": message.content}
|
2005 |
]
|
2006 |
)
|
@@ -2012,7 +2014,7 @@ async def main(message: cl.Message):
|
|
2012 |
completion = openai_client.chat.completions.create(
|
2013 |
model="gpt-3.5-turbo-1106",
|
2014 |
messages=[
|
2015 |
-
{"role": "system", "content": "You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust"},
|
2016 |
{"role": "user", "content": message.content}
|
2017 |
]
|
2018 |
)
|
@@ -2054,7 +2056,7 @@ async def main(message: cl.Message):
|
|
2054 |
client = Client("Qwen/Qwen2-57b-a14b-instruct-demo", hf_token=hf_token)
|
2055 |
result = client.predict(
|
2056 |
query=message.content,
|
2057 |
-
system="You are
|
2058 |
api_name="/model_chat"
|
2059 |
)
|
2060 |
await cl.Message(
|
@@ -2065,7 +2067,7 @@ async def main(message: cl.Message):
|
|
2065 |
client = Client("Qwen/Qwen2-7b-instruct-demo", hf_token=hf_token)
|
2066 |
result = client.predict(
|
2067 |
query=message.content,
|
2068 |
-
system="You are
|
2069 |
api_name="/model_chat"
|
2070 |
)
|
2071 |
await cl.Message(
|
@@ -2077,7 +2079,7 @@ async def main(message: cl.Message):
|
|
2077 |
client = Client("Qwen/Qwen2-1.5b-instruct-demo", hf_token=hf_token)
|
2078 |
result = client.predict(
|
2079 |
query=message.content,
|
2080 |
-
system="You are
|
2081 |
api_name="/model_chat"
|
2082 |
)
|
2083 |
await cl.Message(
|
@@ -2089,7 +2091,7 @@ async def main(message: cl.Message):
|
|
2089 |
client = Client("Qwen/Qwen2-0.5B-Instruct", hf_token=hf_token)
|
2090 |
result = client.predict(
|
2091 |
query=message.content,
|
2092 |
-
system="You are
|
2093 |
api_name="/model_chat"
|
2094 |
)
|
2095 |
await cl.Message(
|
@@ -2100,7 +2102,7 @@ async def main(message: cl.Message):
|
|
2100 |
client = Client("Qwen/Qwen1.5-110B-Chat-demo", hf_token=hf_token)
|
2101 |
result = client.predict(
|
2102 |
query=message.content,
|
2103 |
-
system="You are
|
2104 |
api_name="/model_chat"
|
2105 |
)
|
2106 |
await cl.Message(
|
@@ -2112,7 +2114,7 @@ async def main(message: cl.Message):
|
|
2112 |
client = Client("Qwen/Qwen1.5-32B-Chat-demo", hf_token=hf_token)
|
2113 |
result = client.predict(
|
2114 |
query=message.content,
|
2115 |
-
system="You are
|
2116 |
api_name="/model_chat"
|
2117 |
)
|
2118 |
await cl.Message(
|
@@ -2124,7 +2126,7 @@ async def main(message: cl.Message):
|
|
2124 |
client = Client("Qwen/qwen1.5-MoE-A2.7B-Chat-demo", hf_token=hf_token)
|
2125 |
result = client.predict(
|
2126 |
query=message.content,
|
2127 |
-
system="You are
|
2128 |
api_name="/model_chat"
|
2129 |
)
|
2130 |
await cl.Message(
|
@@ -2370,7 +2372,7 @@ async def main(message: cl.Message):
|
|
2370 |
elif chat_profile == "zephyr-7B":
|
2371 |
result = hf_text_client.predict(
|
2372 |
message=message.content,
|
2373 |
-
request="
|
2374 |
param_3=512,
|
2375 |
param_4=0.7,
|
2376 |
param_5=0.95,
|
|
|
1907 |
@cl.on_message
|
1908 |
async def main(message: cl.Message):
|
1909 |
chat_profile = cl.user_session.get("chat_profile")
|
1910 |
+
|
1911 |
+
name = await cl.AskUserMessage(content="What is your name?", timeout=10).send()
|
1912 |
res = await cl.AskActionMessage(
|
1913 |
content="Is that message correct and accurate ? check it and choose an option:",
|
1914 |
actions=[
|
|
|
1922 |
completion = openai_client.chat.completions.create(
|
1923 |
model="ft:gpt-3.5-turbo-1106:nb:aria1:9UWDrLJK",
|
1924 |
messages=[
|
1925 |
+
{"role": "system", "content": f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}"},
|
1926 |
{"role": "user", "content": message.content}
|
1927 |
]
|
1928 |
)
|
|
|
1934 |
elif chat_profile == "Dorna-AI":
|
1935 |
result = hf_text_client.predict(
|
1936 |
message=message.content,
|
1937 |
+
request=f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}",
|
1938 |
param_3=512,
|
1939 |
param_4=0.7,
|
1940 |
param_5=0.95,
|
|
|
1948 |
completion = openai_client.chat.completions.create(
|
1949 |
model="gpt-4o-mini",
|
1950 |
messages=[
|
1951 |
+
{"role": "system", "content": f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}"},
|
1952 |
{"role": "user", "content": message.content}
|
1953 |
]
|
1954 |
)
|
|
|
1977 |
completion = openai_client.chat.completions.create(
|
1978 |
model="gpt-4",
|
1979 |
messages=[
|
1980 |
+
{"role": "system", "content": f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}"},
|
1981 |
{"role": "user", "content": message.content}
|
1982 |
]
|
1983 |
)
|
|
|
1990 |
completion = openai_client.chat.completions.create(
|
1991 |
model="gpt-3.5-turbo",
|
1992 |
messages=[
|
1993 |
+
{"role": "system", "content": f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}"},
|
1994 |
{"role": "user", "content": message.content}
|
1995 |
]
|
1996 |
)
|
|
|
2002 |
completion = openai_client.chat.completions.create(
|
2003 |
model="GPT-3.5-turbo-0125",
|
2004 |
messages=[
|
2005 |
+
{"role": "system", "content": f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}"},
|
2006 |
{"role": "user", "content": message.content}
|
2007 |
]
|
2008 |
)
|
|
|
2014 |
completion = openai_client.chat.completions.create(
|
2015 |
model="gpt-3.5-turbo-1106",
|
2016 |
messages=[
|
2017 |
+
{"role": "system", "content": f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}"},
|
2018 |
{"role": "user", "content": message.content}
|
2019 |
]
|
2020 |
)
|
|
|
2056 |
client = Client("Qwen/Qwen2-57b-a14b-instruct-demo", hf_token=hf_token)
|
2057 |
result = client.predict(
|
2058 |
query=message.content,
|
2059 |
+
system=f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}",
|
2060 |
api_name="/model_chat"
|
2061 |
)
|
2062 |
await cl.Message(
|
|
|
2067 |
client = Client("Qwen/Qwen2-7b-instruct-demo", hf_token=hf_token)
|
2068 |
result = client.predict(
|
2069 |
query=message.content,
|
2070 |
+
system=f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}",
|
2071 |
api_name="/model_chat"
|
2072 |
)
|
2073 |
await cl.Message(
|
|
|
2079 |
client = Client("Qwen/Qwen2-1.5b-instruct-demo", hf_token=hf_token)
|
2080 |
result = client.predict(
|
2081 |
query=message.content,
|
2082 |
+
system=f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}",
|
2083 |
api_name="/model_chat"
|
2084 |
)
|
2085 |
await cl.Message(
|
|
|
2091 |
client = Client("Qwen/Qwen2-0.5B-Instruct", hf_token=hf_token)
|
2092 |
result = client.predict(
|
2093 |
query=message.content,
|
2094 |
+
system=f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}",
|
2095 |
api_name="/model_chat"
|
2096 |
)
|
2097 |
await cl.Message(
|
|
|
2102 |
client = Client("Qwen/Qwen1.5-110B-Chat-demo", hf_token=hf_token)
|
2103 |
result = client.predict(
|
2104 |
query=message.content,
|
2105 |
+
system=f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}",
|
2106 |
api_name="/model_chat"
|
2107 |
)
|
2108 |
await cl.Message(
|
|
|
2114 |
client = Client("Qwen/Qwen1.5-32B-Chat-demo", hf_token=hf_token)
|
2115 |
result = client.predict(
|
2116 |
query=message.content,
|
2117 |
+
system=f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}",
|
2118 |
api_name="/model_chat"
|
2119 |
)
|
2120 |
await cl.Message(
|
|
|
2126 |
client = Client("Qwen/qwen1.5-MoE-A2.7B-Chat-demo", hf_token=hf_token)
|
2127 |
result = client.predict(
|
2128 |
query=message.content,
|
2129 |
+
system=f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}",
|
2130 |
api_name="/model_chat"
|
2131 |
)
|
2132 |
await cl.Message(
|
|
|
2372 |
elif chat_profile == "zephyr-7B":
|
2373 |
result = hf_text_client.predict(
|
2374 |
message=message.content,
|
2375 |
+
request=f"You are neural nexus official chatbot, you are made by Artin Daneshvar and Sadra Noadoust and you are here to help miss or mr {name['output']}",
|
2376 |
param_3=512,
|
2377 |
param_4=0.7,
|
2378 |
param_5=0.95,
|