langroid 0.2.7__py3-none-any.whl → 0.2.10__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.
- langroid/agent/chat_agent.py +2 -1
- langroid/language_models/__init__.py +2 -0
- langroid/language_models/openai_gpt.py +18 -1
- {langroid-0.2.7.dist-info → langroid-0.2.10.dist-info}/METADATA +3 -1
- {langroid-0.2.7.dist-info → langroid-0.2.10.dist-info}/RECORD +8 -8
- pyproject.toml +1 -1
- {langroid-0.2.7.dist-info → langroid-0.2.10.dist-info}/LICENSE +0 -0
- {langroid-0.2.7.dist-info → langroid-0.2.10.dist-info}/WHEEL +0 -0
langroid/agent/chat_agent.py
CHANGED
@@ -540,8 +540,9 @@ class ChatAgent(Agent):
|
|
540
540
|
"""
|
541
541
|
if self.llm is None:
|
542
542
|
return None
|
543
|
-
|
544
543
|
hist, output_len = self._prep_llm_messages(message)
|
544
|
+
if len(hist) == 0:
|
545
|
+
return None
|
545
546
|
with StreamingIfAllowed(self.llm, self.llm.get_stream()):
|
546
547
|
response = await self.llm_response_messages_async(hist, output_len)
|
547
548
|
self.message_history.append(ChatDocument.to_LLMMessage(response))
|
@@ -16,6 +16,7 @@ from .base import (
|
|
16
16
|
)
|
17
17
|
from .openai_gpt import (
|
18
18
|
OpenAIChatModel,
|
19
|
+
AnthropicModel,
|
19
20
|
OpenAICompletionModel,
|
20
21
|
OpenAIGPTConfig,
|
21
22
|
OpenAIGPT,
|
@@ -39,6 +40,7 @@ __all__ = [
|
|
39
40
|
"LLMTokenUsage",
|
40
41
|
"LLMResponse",
|
41
42
|
"OpenAIChatModel",
|
43
|
+
"AnthropicModel",
|
42
44
|
"OpenAICompletionModel",
|
43
45
|
"OpenAIGPTConfig",
|
44
46
|
"OpenAIGPT",
|
@@ -65,6 +65,15 @@ OLLAMA_API_KEY = "ollama"
|
|
65
65
|
DUMMY_API_KEY = "xxx"
|
66
66
|
|
67
67
|
|
68
|
+
class AnthropicModel(str, Enum):
|
69
|
+
"""Enum for Anthropic models"""
|
70
|
+
|
71
|
+
CLAUDE_3_5_SONNET = "claude-3-5-sonnet-20240620"
|
72
|
+
CLAUDE_3_OPUS = "claude-3-opus-20240229"
|
73
|
+
CLAUDE_3_SONNET = "claude-3-sonnet-20240229"
|
74
|
+
CLAUDE_3_HAIKU = "claude-3-turbo-20240307"
|
75
|
+
|
76
|
+
|
68
77
|
class OpenAIChatModel(str, Enum):
|
69
78
|
"""Enum for OpenAI Chat models"""
|
70
79
|
|
@@ -90,6 +99,10 @@ _context_length: Dict[str, int] = {
|
|
90
99
|
OpenAIChatModel.GPT4_TURBO: 128_000,
|
91
100
|
OpenAIChatModel.GPT4o: 128_000,
|
92
101
|
OpenAICompletionModel.TEXT_DA_VINCI_003: 4096,
|
102
|
+
AnthropicModel.CLAUDE_3_5_SONNET: 200_000,
|
103
|
+
AnthropicModel.CLAUDE_3_OPUS: 200_000,
|
104
|
+
AnthropicModel.CLAUDE_3_SONNET: 200_000,
|
105
|
+
AnthropicModel.CLAUDE_3_HAIKU: 200_000,
|
93
106
|
}
|
94
107
|
|
95
108
|
_cost_per_1k_tokens: Dict[str, Tuple[float, float]] = {
|
@@ -99,6 +112,10 @@ _cost_per_1k_tokens: Dict[str, Tuple[float, float]] = {
|
|
99
112
|
OpenAIChatModel.GPT4: (0.03, 0.06), # 8K context
|
100
113
|
OpenAIChatModel.GPT4_TURBO: (0.01, 0.03), # 128K context
|
101
114
|
OpenAIChatModel.GPT4o: (0.005, 0.015), # 128K context
|
115
|
+
AnthropicModel.CLAUDE_3_5_SONNET: (0.003, 0.015),
|
116
|
+
AnthropicModel.CLAUDE_3_OPUS: (0.015, 0.075),
|
117
|
+
AnthropicModel.CLAUDE_3_SONNET: (0.003, 0.015),
|
118
|
+
AnthropicModel.CLAUDE_3_HAIKU: (0.00025, 0.00125),
|
102
119
|
}
|
103
120
|
|
104
121
|
|
@@ -285,7 +302,7 @@ class OpenAIGPTConfig(LLMConfig):
|
|
285
302
|
litellm.telemetry = False
|
286
303
|
litellm.drop_params = True # drop un-supported params without crashing
|
287
304
|
self.seed = None # some local mdls don't support seed
|
288
|
-
keys_dict = litellm.validate_environment(self.chat_model)
|
305
|
+
keys_dict = litellm.utils.validate_environment(self.chat_model)
|
289
306
|
missing_keys = keys_dict.get("missing_keys", [])
|
290
307
|
if len(missing_keys) > 0:
|
291
308
|
raise ValueError(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: langroid
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.10
|
4
4
|
Summary: Harness LLMs with Multi-Agent Programming
|
5
5
|
License: MIT
|
6
6
|
Author: Prasad Chalasani
|
@@ -522,6 +522,8 @@ with a postgres db, you will need to:
|
|
522
522
|
If this gives you an error, try `pip install psycopg2-binary` in your virtualenv.
|
523
523
|
</details>
|
524
524
|
|
525
|
+
:memo: If you get strange errors involving `mysqlclient`, try doing `pip uninstall mysqlclient` followed by `pip install mysqlclient`.
|
526
|
+
|
525
527
|
### Set up environment variables (API keys, etc)
|
526
528
|
|
527
529
|
To get started, all you need is an OpenAI API Key.
|
@@ -4,7 +4,7 @@ langroid/agent/base.py,sha256=eeYZ-NYbrepOjUVQS9K0nDhE8x2gKUNjgxFTA24mook,37560
|
|
4
4
|
langroid/agent/batch.py,sha256=feRA_yRG768ElOQjrKEefcRv6Aefd_yY7qktuYUQDwc,10040
|
5
5
|
langroid/agent/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
langroid/agent/callbacks/chainlit.py,sha256=UKG2_v4ktfkEaGvdouVRHEqQejEYya2Rli8jrP65TmA,22055
|
7
|
-
langroid/agent/chat_agent.py,sha256=
|
7
|
+
langroid/agent/chat_agent.py,sha256=bTQrIMbN8JxxtnVNC-xzODVLvH3SHmy5vijRjY3cCUE,41564
|
8
8
|
langroid/agent/chat_document.py,sha256=MwtNABK28tfSzqCeQlxoauT8uPn8oldU7dlnrX8aQ10,11232
|
9
9
|
langroid/agent/helpers.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
langroid/agent/junk,sha256=LxfuuW7Cijsg0szAzT81OjWWv1PMNI-6w_-DspVIO2s,339
|
@@ -62,12 +62,12 @@ langroid/embedding_models/protoc/embeddings_pb2.pyi,sha256=UkNy7BrNsmQm0vLb3NtGX
|
|
62
62
|
langroid/embedding_models/protoc/embeddings_pb2_grpc.py,sha256=9dYQqkW3JPyBpSEjeGXTNpSqAkC-6FPtBHyteVob2Y8,2452
|
63
63
|
langroid/embedding_models/remote_embeds.py,sha256=6_kjXByVbqhY9cGwl9R83ZcYC2km-nGieNNAo1McHaY,5151
|
64
64
|
langroid/exceptions.py,sha256=w_Cr41nPAmsa6gW5nNFaO9yDcBCWdQqRspL1jYvZf5w,2209
|
65
|
-
langroid/language_models/__init__.py,sha256=
|
65
|
+
langroid/language_models/__init__.py,sha256=1sUGobooTqq77XC7LxKsvME0RgSd5GGmeyrPo9SMh4U,940
|
66
66
|
langroid/language_models/azure_openai.py,sha256=ncRCbKooqLVOY-PWQUIo9C3yTuKEFbAwyngXT_M4P7k,5989
|
67
67
|
langroid/language_models/base.py,sha256=oAK2lXBqksMglqWqE2CjC03X3qPFXWgtjFWpH9hJ3C8,17500
|
68
68
|
langroid/language_models/config.py,sha256=9Q8wk5a7RQr8LGMT_0WkpjY8S4ywK06SalVRjXlfCiI,378
|
69
69
|
langroid/language_models/mock_lm.py,sha256=qdgj-wtbQBXlibo_0rIRfCt0hGTPRoxy1C4VjN6quI4,2707
|
70
|
-
langroid/language_models/openai_gpt.py,sha256=
|
70
|
+
langroid/language_models/openai_gpt.py,sha256=84oXRT6hyY_MiavmRw61Jtw67xCmzBQEt5NKuqsxnQo,51680
|
71
71
|
langroid/language_models/prompt_formatter/__init__.py,sha256=2-5cdE24XoFDhifOLl8yiscohil1ogbP1ECkYdBlBsk,372
|
72
72
|
langroid/language_models/prompt_formatter/base.py,sha256=eDS1sgRNZVnoajwV_ZIha6cba5Dt8xjgzdRbPITwx3Q,1221
|
73
73
|
langroid/language_models/prompt_formatter/hf_formatter.py,sha256=TFL6ppmeQWnzr6CKQzRZFYY810zE1mr8DZnhw6i85ok,5217
|
@@ -129,8 +129,8 @@ langroid/vector_store/meilisearch.py,sha256=6frB7GFWeWmeKzRfLZIvzRjllniZ1cYj3Hmh
|
|
129
129
|
langroid/vector_store/momento.py,sha256=QaPzUnTwlswoawGB-paLtUPyLRvckFXLfLDfvbTzjNQ,10505
|
130
130
|
langroid/vector_store/qdrant_cloud.py,sha256=3im4Mip0QXLkR6wiqVsjV1QvhSElfxdFSuDKddBDQ-4,188
|
131
131
|
langroid/vector_store/qdrantdb.py,sha256=wYOuu5c2vIKn9ZgvTXcAiZXMpV8AOXEWFAzI8S8UP-0,16828
|
132
|
-
pyproject.toml,sha256=
|
133
|
-
langroid-0.2.
|
134
|
-
langroid-0.2.
|
135
|
-
langroid-0.2.
|
136
|
-
langroid-0.2.
|
132
|
+
pyproject.toml,sha256=oi3hCFn2w4MIOnExcN_dpO7bg33HS-KJBPxd2cMGvzY,6958
|
133
|
+
langroid-0.2.10.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
|
134
|
+
langroid-0.2.10.dist-info/METADATA,sha256=A4KYwLzgEIcLOV10yvkYVlu30M1rd6K2u6fqgpuP24E,54087
|
135
|
+
langroid-0.2.10.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
136
|
+
langroid-0.2.10.dist-info/RECORD,,
|
pyproject.toml
CHANGED
File without changes
|
File without changes
|