Artin2009 commited on
Commit
423b205
1 Parent(s): 8b0c21b

Update chain_app.py

Browse files
Files changed (1) hide show
  1. chain_app.py +254 -2
chain_app.py CHANGED
@@ -140,6 +140,10 @@ async def chat_profile():
140
  name="Llama-3-70B",
141
  markdown_description="Meta Open Source model Llama-3 with 70B parameters",
142
  ),
 
 
 
 
143
  cl.ChatProfile(
144
  name='Aya-23B',
145
  markdown_description='Cohere open sourced AI model with 23B parameters'
@@ -148,7 +152,32 @@ async def chat_profile():
148
  nanm='Command-R-Plus',
149
  markdown_description='Cohere open sourced AI model named Command R +'
150
 
151
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  cl.ChatProfile(
153
  name="Llama-3-8B",
154
  markdown_description="Meta Open Source model Llama-2 with 7B parameters",
@@ -769,8 +798,31 @@ async def on_chat_start():
769
  ).send()
770
  await cl.Message(
771
  content='Im one of the best open source models that cohere released. i am configured by 2 iranian boys named Artin Daneshvar and Sadra Noadosut to help you out!'
772
- )
773
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
  if chat_profile == 'Command-R-Plus:
775
  await cl.ChatSettings(
776
  [
@@ -790,9 +842,124 @@ async def on_chat_start():
790
  ),
791
  ]
792
  ).send()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
793
  await cl.Message(
794
  content='Im one of the best open source models that cohere released. i am configured by 2 iranian boys named Artin Daneshvar and Sadra Noadosut to help you out!'
795
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
796
 
797
  if chat_profile == 'gemma2-9B':
798
  await cl.ChatSettings(
@@ -1414,6 +1581,22 @@ async def main(message: cl.Message):
1414
  complete_content += event.text
1415
  await cl.Message(content=complete_content).send()
1416
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1417
  elif chat_profile == 'Command-R-Plus':
1418
  stream = co.chat_stream(
1419
  model='command-r-plus',
@@ -1428,6 +1611,75 @@ async def main(message: cl.Message):
1428
  complete_content += event.text
1429
  await cl.Message(content=complete_content).send()
1430
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1431
 
1432
  @cl.on_settings_update
1433
  async def setup_agent(settings):
 
140
  name="Llama-3-70B",
141
  markdown_description="Meta Open Source model Llama-3 with 70B parameters",
142
  ),
143
+ cl.ChatProfile(
144
+ name='Aya-35B',
145
+ markdown_description='Cohere open sourced AI model with 35B parameters'
146
+ ),
147
  cl.ChatProfile(
148
  name='Aya-23B',
149
  markdown_description='Cohere open sourced AI model with 23B parameters'
 
152
  nanm='Command-R-Plus',
153
  markdown_description='Cohere open sourced AI model named Command R +'
154
 
155
+ ),
156
+ cl.ChatProfile(
157
+ nanm='Command-R',
158
+ markdown_description='Cohere open sourced AI model named Command R'
159
+
160
+ ),
161
+ cl.ChatProfile(
162
+ nanm='Command-Light',
163
+ markdown_description='Cohere open sourced AI model named Command R'
164
+
165
+ ),
166
+ cl.ChatProfile(
167
+ nanm='Command-Light-Nightly',
168
+ markdown_description='Cohere open sourced AI model named Command R'
169
+
170
+ ),
171
+ cl.ChatProfile(
172
+ nanm='Command-Nightly',
173
+ markdown_description='Cohere open sourced AI model named Command R'
174
+
175
+ ),
176
+ cl.ChatProfile(
177
+ nanm='Command',
178
+ markdown_description='Cohere open sourced AI model named Command R'
179
+
180
+ ),
181
  cl.ChatProfile(
182
  name="Llama-3-8B",
183
  markdown_description="Meta Open Source model Llama-2 with 7B parameters",
 
798
  ).send()
799
  await cl.Message(
800
  content='Im one of the best open source models that cohere released. i am configured by 2 iranian boys named Artin Daneshvar and Sadra Noadosut to help you out!'
801
+ ).send()
802
 
803
+ if chat_profile == 'Aya-35B':
804
+ await cl.ChatSettings(
805
+ [
806
+ Select(
807
+ id="Cohere-Model",
808
+ label="Cohere - Model",
809
+ values=["Aya-35B"],
810
+ initial_index=0,
811
+ ),
812
+ Slider(
813
+ id="Temperature",
814
+ label="Model Temperature",
815
+ initial=0.7,
816
+ min=0,
817
+ max=1,
818
+ step=0.1,
819
+ ),
820
+ ]
821
+ ).send()
822
+ await cl.Message(
823
+ content='Im one of the best open source models that cohere released. i am configured by 2 iranian boys named Artin Daneshvar and Sadra Noadosut to help you out!'
824
+ ).send()
825
+
826
  if chat_profile == 'Command-R-Plus:
827
  await cl.ChatSettings(
828
  [
 
842
  ),
843
  ]
844
  ).send()
845
+ await cl.Message(
846
+ content='Im one of the best open source models that cohere released. i am configured by 2 iranian boys named Artin Daneshvar and Sadra Noadosut to help you out!'
847
+ ).send()
848
+
849
+ if chat_profile == 'Command-Nigtly:
850
+ await cl.ChatSettings(
851
+ [
852
+ Select(
853
+ id="Cohere-Model",
854
+ label="Cohere - Model",
855
+ values=["Command-Nigtly"],
856
+ initial_index=0,
857
+ ),
858
+ Slider(
859
+ id="Temperature",
860
+ label="Model Temperature",
861
+ initial=0.7,
862
+ min=0,
863
+ max=1,
864
+ step=0.1,
865
+ ),
866
+ ]
867
+ ).send()
868
+ await cl.Message(
869
+ content='Im one of the best open source models that cohere released. i am configured by 2 iranian boys named Artin Daneshvar and Sadra Noadosut to help you out!'
870
+ ).send()
871
+
872
+ if chat_profile == 'Command-Light-Nigtly:
873
+ await cl.ChatSettings(
874
+ [
875
+ Select(
876
+ id="Cohere-Model",
877
+ label="Cohere - Model",
878
+ values=["Command-Light-Nigtly"],
879
+ initial_index=0,
880
+ ),
881
+ Slider(
882
+ id="Temperature",
883
+ label="Model Temperature",
884
+ initial=0.7,
885
+ min=0,
886
+ max=1,
887
+ step=0.1,
888
+ ),
889
+ ]
890
+ ).send()
891
+ await cl.Message(
892
+ content='Im one of the best open source models that cohere released. i am configured by 2 iranian boys named Artin Daneshvar and Sadra Noadosut to help you out!'
893
+ ).send()
894
+
895
+ if chat_profile == 'Command-Light:
896
+ await cl.ChatSettings(
897
+ [
898
+ Select(
899
+ id="Cohere-Model",
900
+ label="Cohere - Model",
901
+ values=["Command-Light"],
902
+ initial_index=0,
903
+ ),
904
+ Slider(
905
+ id="Temperature",
906
+ label="Model Temperature",
907
+ initial=0.7,
908
+ min=0,
909
+ max=1,
910
+ step=0.1,
911
+ ),
912
+ ]
913
+ ).send()
914
  await cl.Message(
915
  content='Im one of the best open source models that cohere released. i am configured by 2 iranian boys named Artin Daneshvar and Sadra Noadosut to help you out!'
916
  )
917
+
918
+ if chat_profile == 'Command-R:
919
+ await cl.ChatSettings(
920
+ [
921
+ Select(
922
+ id="Cohere-Model",
923
+ label="Cohere - Model",
924
+ values=["Command-R"],
925
+ initial_index=0,
926
+ ),
927
+ Slider(
928
+ id="Temperature",
929
+ label="Model Temperature",
930
+ initial=0.7,
931
+ min=0,
932
+ max=1,
933
+ step=0.1,
934
+ ),
935
+ ]
936
+ ).send()
937
+ await cl.Message(
938
+ content='Im one of the best open source models that cohere released. i am configured by 2 iranian boys named Artin Daneshvar and Sadra Noadosut to help you out!'
939
+ ).send()
940
+
941
+ if chat_profile == 'Command:
942
+ await cl.ChatSettings(
943
+ [
944
+ Select(
945
+ id="Cohere-Model",
946
+ label="Cohere - Model",
947
+ values=["Command"],
948
+ initial_index=0,
949
+ ),
950
+ Slider(
951
+ id="Temperature",
952
+ label="Model Temperature",
953
+ initial=0.7,
954
+ min=0,
955
+ max=1,
956
+ step=0.1,
957
+ ),
958
+ ]
959
+ ).send()
960
+ await cl.Message(
961
+ content='Im one of the best open source models that cohere released. i am configured by 2 iranian boys named Artin Daneshvar and Sadra Noadosut to help you out!'
962
+ ).send()
963
 
964
  if chat_profile == 'gemma2-9B':
965
  await cl.ChatSettings(
 
1581
  complete_content += event.text
1582
  await cl.Message(content=complete_content).send()
1583
 
1584
+ elif chat_profile == 'Aya-35B':
1585
+ stream = co.chat_stream(
1586
+ model='c4ai-aya-23',
1587
+ message=message.content,
1588
+ temperature=0.3,
1589
+ # chat_history=[{"role": "User", "message": "Hello"}, {"role": "Chatbot", "message": "Hello! How can I help you today?"}, {"role": "User", "message": "Hi"}, {"role": "User", "message": "hello"}],
1590
+ prompt_truncation='OFF',
1591
+ connectors=[],
1592
+ )
1593
+
1594
+ complete_content = ''
1595
+ for event in stream:
1596
+ if event.event_type == 'text-generation':
1597
+ complete_content += event.text
1598
+ await cl.Message(content=complete_content).send()
1599
+
1600
  elif chat_profile == 'Command-R-Plus':
1601
  stream = co.chat_stream(
1602
  model='command-r-plus',
 
1611
  complete_content += event.text
1612
  await cl.Message(content=complete_content).send()
1613
 
1614
+ elif chat_profile == 'Command-R':
1615
+ stream = co.chat_stream(
1616
+ model='command-r',
1617
+ message=message.content,
1618
+ temperature=0.3,
1619
+ chat_history=[],
1620
+ prompt_truncation='AUTO',
1621
+ )
1622
+ complete_content = ''
1623
+ for event in stream:
1624
+ if event.event_type == 'text-generation':
1625
+ complete_content += event.text
1626
+ await cl.Message(content=complete_content).send()
1627
+
1628
+ elif chat_profile == 'Command':
1629
+ stream = co.chat_stream(
1630
+ model='command',
1631
+ message=message.content,
1632
+ temperature=0.3,
1633
+ chat_history=[],
1634
+ prompt_truncation='AUTO',
1635
+ )
1636
+ complete_content = ''
1637
+ for event in stream:
1638
+ if event.event_type == 'text-generation':
1639
+ complete_content += event.text
1640
+ await cl.Message(content=complete_content).send()
1641
+
1642
+ elif chat_profile == 'Command-Light':
1643
+ stream = co.chat_stream(
1644
+ model='command-light',
1645
+ message=message.content,
1646
+ temperature=0.3,
1647
+ chat_history=[],
1648
+ prompt_truncation='AUTO',
1649
+ )
1650
+ complete_content = ''
1651
+ for event in stream:
1652
+ if event.event_type == 'text-generation':
1653
+ complete_content += event.text
1654
+ await cl.Message(content=complete_content).send()
1655
+
1656
+ elif chat_profile == 'Command-Light-Nightly':
1657
+ stream = co.chat_stream(
1658
+ model='command-light-nightly',
1659
+ message=message.content,
1660
+ temperature=0.3,
1661
+ chat_history=[],
1662
+ prompt_truncation='AUTO',
1663
+ )
1664
+ complete_content = ''
1665
+ for event in stream:
1666
+ if event.event_type == 'text-generation':
1667
+ complete_content += event.text
1668
+ await cl.Message(content=complete_content).send()
1669
+
1670
+ elif chat_profile == 'Command-Nightly':
1671
+ stream = co.chat_stream(
1672
+ model='command-light-nightly',
1673
+ message=message.content,
1674
+ temperature=0.3,
1675
+ chat_history=[],
1676
+ prompt_truncation='AUTO',
1677
+ )
1678
+ complete_content = ''
1679
+ for event in stream:
1680
+ if event.event_type == 'text-generation':
1681
+ complete_content += event.text
1682
+ await cl.Message(content=complete_content).send()
1683
 
1684
  @cl.on_settings_update
1685
  async def setup_agent(settings):