langroid 0.1.246__py3-none-any.whl → 0.1.248__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/base.py CHANGED
@@ -94,9 +94,16 @@ class Agent(ABC):
94
94
  self._indent = ""
95
95
  self.llm = LanguageModel.create(config.llm)
96
96
  self.vecdb = VectorStore.create(config.vecdb) if config.vecdb else None
97
+ # token_encoding_model is used to obtain the tokenizer,
98
+ # so we ensure that the tokenizer corresponding to the model is used.
99
+ if config.parsing is not None and self.config.llm is not None:
100
+ config.parsing.token_encoding_model = (
101
+ self.config.llm.chat_model or self.config.llm.completion_model
102
+ )
97
103
  self.parser: Optional[Parser] = (
98
104
  Parser(config.parsing) if config.parsing else None
99
105
  )
106
+
100
107
  self.callbacks = SimpleNamespace(
101
108
  start_llm_stream=lambda: noop_fn,
102
109
  cancel_llm_stream=noop_fn,
@@ -56,7 +56,10 @@ class ParsingConfig(BaseSettings):
56
56
  class Parser:
57
57
  def __init__(self, config: ParsingConfig):
58
58
  self.config = config
59
- self.tokenizer = tiktoken.encoding_for_model(config.token_encoding_model)
59
+ try:
60
+ self.tokenizer = tiktoken.encoding_for_model(config.token_encoding_model)
61
+ except Exception:
62
+ self.tokenizer = tiktoken.encoding_for_model("text-embedding-ada-002")
60
63
 
61
64
  def num_tokens(self, text: str) -> int:
62
65
  tokens = self.tokenizer.encode(text)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.1.246
3
+ Version: 0.1.248
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  License: MIT
6
6
  Author: Prasad Chalasani
@@ -99,7 +99,7 @@ Requires-Dist: sentence-transformers (==2.2.2) ; extra == "hf-embeddings"
99
99
  Requires-Dist: sqlalchemy (>=2.0.19,<3.0.0)
100
100
  Requires-Dist: tantivy (>=0.21.0,<0.22.0)
101
101
  Requires-Dist: thefuzz (>=0.20.0,<0.21.0)
102
- Requires-Dist: tiktoken (>=0.5.1,<0.6.0)
102
+ Requires-Dist: tiktoken (>=0.7.0,<0.8.0)
103
103
  Requires-Dist: torch (==2.0.0) ; extra == "hf-embeddings" or extra == "transformers"
104
104
  Requires-Dist: trafilatura (>=1.5.0,<2.0.0)
105
105
  Requires-Dist: transformers (>=4.40.1,<5.0.0) ; extra == "transformers"
@@ -236,6 +236,11 @@ teacher_task.run()
236
236
  <details>
237
237
  <summary> <b>Click to expand</b></summary>
238
238
 
239
+ - **May 2024:**
240
+ - `gpt-4o` is now the default LLM throughout; Update tests and examples to work
241
+ with this LLM; use tokenizer corresponding to the LLM.
242
+ - `gemini 1.5 pro` support via `litellm`
243
+ - `QdrantDB:` update to support learned sparse embeddings.
239
244
  - **Apr 2024:**
240
245
  - **0.1.236**: Support for open LLMs hosted on Groq, e.g. specify
241
246
  `chat_model="groq/llama3-8b-8192"`.
@@ -1,6 +1,6 @@
1
1
  langroid/__init__.py,sha256=zsYpGiAUsvyzZzjm964NUamsJImrXSJPVGz9a2jE_uY,1679
2
2
  langroid/agent/__init__.py,sha256=_D8dxnfdr92ch1CIrUkKjrB5HVvsQdn62b1Fb2kBxV8,785
3
- langroid/agent/base.py,sha256=H1Fk9kJKr-7I1GgbmaflumG7so6yGmwl7AVTgU7PyeM,35210
3
+ langroid/agent/base.py,sha256=Aa8e_dHibXfpOXnldGCrVvObFKhO0P05Is97AuVGFLo,35569
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=uIfdmoOKIfzBVeM2ce0V5SCfHjcvYyaz13dfjFXCEN4,21020
@@ -79,7 +79,7 @@ langroid/parsing/document_parser.py,sha256=sfyNhkIdAQkufOHb-tTv63EF51pGNzrnAl0DN
79
79
  langroid/parsing/image_text.py,sha256=sbLIQ5nHe2UnYUksBaQsmZGaX-X0qgEpPd7CEzi_z5M,910
80
80
  langroid/parsing/para_sentence_split.py,sha256=AJBzZojP3zpB-_IMiiHismhqcvkrVBQ3ZINoQyx_bE4,2000
81
81
  langroid/parsing/parse_json.py,sha256=tgB_oatcrgt6L9ZplC-xBBXjLzL1gjSQf1L2_W5kwFA,4230
82
- langroid/parsing/parser.py,sha256=vE5j1LVDeFQPmLrXCWBfvuoPsjjvVIGHcsIWCBR8HDM,10617
82
+ langroid/parsing/parser.py,sha256=2TT6YMgEe79Kz9bPIqI-1RIEK77V2H2gbpbX5DhNNrY,10743
83
83
  langroid/parsing/repo_loader.py,sha256=My5UIe-h1xr0I-6Icu0ZVwRHmGRRRW8SrJYMc9J1M9Q,29361
84
84
  langroid/parsing/search.py,sha256=plQtjarB9afGfJLB0CyPXPq3mM4m7kRsfd0_4brziEI,8846
85
85
  langroid/parsing/spider.py,sha256=w_mHR1B4KOmxsBLoVI8kMkMTEbwTzeK3ath9fOMJrTk,3043
@@ -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.246.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
125
- langroid-0.1.246.dist-info/METADATA,sha256=ZG2s9al3tSU4jkDPkjCySISHeNrThigZxy0jZ5vQlIs,49163
126
- langroid-0.1.246.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
127
- langroid-0.1.246.dist-info/RECORD,,
124
+ langroid-0.1.248.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
125
+ langroid-0.1.248.dist-info/METADATA,sha256=RkEwgd3nRozDym_Ey1aguztAAgRpTrzh6E4uOeHUDdo,49426
126
+ langroid-0.1.248.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
127
+ langroid-0.1.248.dist-info/RECORD,,