langroid 0.1.240__py3-none-any.whl → 0.1.243__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,6 +71,7 @@ class OpenAIChatModel(str, Enum):
71
71
  GPT4 = "gpt-4"
72
72
  GPT4_32K = "gpt-4-32k"
73
73
  GPT4_TURBO = "gpt-4-turbo"
74
+ GPT4o = "gpt-4o"
74
75
 
75
76
 
76
77
  class OpenAICompletionModel(str, Enum):
@@ -86,6 +87,7 @@ _context_length: Dict[str, int] = {
86
87
  OpenAIChatModel.GPT4: 8192,
87
88
  OpenAIChatModel.GPT4_32K: 32_768,
88
89
  OpenAIChatModel.GPT4_TURBO: 128_000,
90
+ OpenAIChatModel.GPT4o: 128_000,
89
91
  OpenAICompletionModel.TEXT_DA_VINCI_003: 4096,
90
92
  }
91
93
 
@@ -95,10 +97,12 @@ _cost_per_1k_tokens: Dict[str, Tuple[float, float]] = {
95
97
  OpenAIChatModel.GPT3_5_TURBO: (0.001, 0.002),
96
98
  OpenAIChatModel.GPT4: (0.03, 0.06), # 8K context
97
99
  OpenAIChatModel.GPT4_TURBO: (0.01, 0.03), # 128K context
100
+ OpenAIChatModel.GPT4o: (0.005, 0.015), # 128K context
98
101
  }
99
102
 
100
103
 
101
104
  openAIChatModelPreferenceList = [
105
+ OpenAIChatModel.GPT4o,
102
106
  OpenAIChatModel.GPT4_TURBO,
103
107
  OpenAIChatModel.GPT4,
104
108
  OpenAIChatModel.GPT3_5_TURBO,
@@ -670,23 +674,26 @@ class OpenAIGPT(LanguageModel):
670
674
  sys.stdout.write(Colors().GREEN)
671
675
  sys.stdout.flush()
672
676
  has_function = False
673
- for event in response:
674
- (
675
- is_break,
676
- has_function,
677
- function_name,
678
- function_args,
679
- completion,
680
- ) = self._process_stream_event(
681
- event,
682
- chat=chat,
683
- has_function=has_function,
684
- completion=completion,
685
- function_args=function_args,
686
- function_name=function_name,
687
- )
688
- if is_break:
689
- break
677
+ try:
678
+ for event in response:
679
+ (
680
+ is_break,
681
+ has_function,
682
+ function_name,
683
+ function_args,
684
+ completion,
685
+ ) = self._process_stream_event(
686
+ event,
687
+ chat=chat,
688
+ has_function=has_function,
689
+ completion=completion,
690
+ function_args=function_args,
691
+ function_name=function_name,
692
+ )
693
+ if is_break:
694
+ break
695
+ except Exception:
696
+ pass
690
697
 
691
698
  print("")
692
699
  # TODO- get usage info in stream mode (?)
@@ -722,23 +729,26 @@ class OpenAIGPT(LanguageModel):
722
729
  sys.stdout.write(Colors().GREEN)
723
730
  sys.stdout.flush()
724
731
  has_function = False
725
- async for event in response:
726
- (
727
- is_break,
728
- has_function,
729
- function_name,
730
- function_args,
731
- completion,
732
- ) = self._process_stream_event(
733
- event,
734
- chat=chat,
735
- has_function=has_function,
736
- completion=completion,
737
- function_args=function_args,
738
- function_name=function_name,
739
- )
740
- if is_break:
741
- break
732
+ try:
733
+ async for event in response:
734
+ (
735
+ is_break,
736
+ has_function,
737
+ function_name,
738
+ function_args,
739
+ completion,
740
+ ) = self._process_stream_event(
741
+ event,
742
+ chat=chat,
743
+ has_function=has_function,
744
+ completion=completion,
745
+ function_args=function_args,
746
+ function_name=function_name,
747
+ )
748
+ if is_break:
749
+ break
750
+ except Exception:
751
+ pass
742
752
 
743
753
  print("")
744
754
  # TODO- get usage info in stream mode (?)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.1.240
3
+ Version: 0.1.243
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  License: MIT
6
6
  Author: Prasad Chalasani
@@ -30,12 +30,13 @@ Requires-Dist: chainlit (>=1.0.400,<2.0.0) ; extra == "chainlit"
30
30
  Requires-Dist: chromadb (>=0.4.21,<=0.4.23) ; extra == "chromadb"
31
31
  Requires-Dist: colorlog (>=6.7.0,<7.0.0)
32
32
  Requires-Dist: docstring-parser (>=0.15,<0.16)
33
- Requires-Dist: duckduckgo-search (>=5.3.0,<6.0.0)
33
+ Requires-Dist: duckduckgo-search (>=6.0.0,<7.0.0)
34
34
  Requires-Dist: faker (>=18.9.0,<19.0.0)
35
35
  Requires-Dist: fakeredis (>=2.12.1,<3.0.0)
36
36
  Requires-Dist: fire (>=0.5.0,<0.6.0)
37
37
  Requires-Dist: flake8 (>=6.0.0,<7.0.0)
38
38
  Requires-Dist: google-api-python-client (>=2.95.0,<3.0.0)
39
+ Requires-Dist: google-generativeai (>=0.5.2,<0.6.0)
39
40
  Requires-Dist: groq (>=0.5.0,<0.6.0)
40
41
  Requires-Dist: grpcio (>=1.62.1,<2.0.0)
41
42
  Requires-Dist: halo (>=0.0.31,<0.0.32)
@@ -63,7 +63,7 @@ langroid/language_models/azure_openai.py,sha256=ncRCbKooqLVOY-PWQUIo9C3yTuKEFbAw
63
63
  langroid/language_models/base.py,sha256=B6dX43ZR65mIvjD95W4RcfpT-WpmiuEcstR3eMrr56Y,21029
64
64
  langroid/language_models/config.py,sha256=5UF3DzO1a-Dfsc3vghE0XGq7g9t_xDsRCsuRiU4dgBg,366
65
65
  langroid/language_models/openai_assistants.py,sha256=9K-DEAL2aSWHeXj2hwCo2RAlK9_1oCPtqX2u1wISCj8,36
66
- langroid/language_models/openai_gpt.py,sha256=BOZt2lOFViN3ct-jvfELRKeUkUaBOGhGxO7F6JQNCNY,50257
66
+ langroid/language_models/openai_gpt.py,sha256=Re7n8Vtb-03HktyxewCD9-gcgXyuN5tWjyW_TgJwees,50648
67
67
  langroid/language_models/prompt_formatter/__init__.py,sha256=9JXFF22QNMmbQV1q4nrIeQVTtA3Tx8tEZABLtLBdFyc,352
68
68
  langroid/language_models/prompt_formatter/base.py,sha256=eDS1sgRNZVnoajwV_ZIha6cba5Dt8xjgzdRbPITwx3Q,1221
69
69
  langroid/language_models/prompt_formatter/hf_formatter.py,sha256=TFL6ppmeQWnzr6CKQzRZFYY810zE1mr8DZnhw6i85ok,5217
@@ -121,7 +121,7 @@ langroid/vector_store/meilisearch.py,sha256=d2huA9P-NoYRuAQ9ZeXJmMKr7ry8u90RUSR2
121
121
  langroid/vector_store/momento.py,sha256=9cui31TTrILid2KIzUpBkN2Ey3g_CZWOQVdaFsA4Ors,10045
122
122
  langroid/vector_store/qdrant_cloud.py,sha256=3im4Mip0QXLkR6wiqVsjV1QvhSElfxdFSuDKddBDQ-4,188
123
123
  langroid/vector_store/qdrantdb.py,sha256=sk5Qb2ZNbooi0rorsMuqIMokF7WADw6PJ0D6goM2XBw,16802
124
- langroid-0.1.240.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
125
- langroid-0.1.240.dist-info/METADATA,sha256=TtWgv6ZQ_YhwWV3shb2zLkU_mC3jKVMud6VCFC8hztw,49111
126
- langroid-0.1.240.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
127
- langroid-0.1.240.dist-info/RECORD,,
124
+ langroid-0.1.243.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
125
+ langroid-0.1.243.dist-info/METADATA,sha256=ifxBHFsiI6V469lHlmNq18a6ZDcItx6JvA9KKhRVTyc,49163
126
+ langroid-0.1.243.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
127
+ langroid-0.1.243.dist-info/RECORD,,