langroid 0.1.32__py3-none-any.whl → 0.1.33__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.
@@ -15,7 +15,7 @@ logger = logging.getLogger(__name__)
15
15
 
16
16
 
17
17
  class MomentoCacheConfig(BaseModel):
18
- """Configuration model for RedisCache."""
18
+ """Configuration model for Momento Cache."""
19
19
 
20
20
  ttl: int = 60 * 60 * 24 * 7 # 1 week
21
21
  cachename: str = "langroid_momento_cache"
@@ -224,7 +224,7 @@ class OpenAIGPT(LanguageModel):
224
224
  hashed_key = hashlib.sha256(raw_key.encode()).hexdigest()
225
225
 
226
226
  if not settings.cache:
227
- # when cacheing disabled, return the hashed_key and none result
227
+ # when caching disabled, return the hashed_key and none result
228
228
  return hashed_key, None
229
229
  # Try to get the result from the cache
230
230
  return hashed_key, self.cache.retrieve(hashed_key)
@@ -96,7 +96,7 @@ class RepoLoader:
96
96
  json.dump({"junk": "ignore"}, f)
97
97
  with open(self.log_file, "r") as f:
98
98
  log = json.load(f)
99
- if self.url in log:
99
+ if self.url in log and os.path.exists(log[self.url]):
100
100
  logger.info(f"Repo Already downloaded in {log[self.url]}")
101
101
  self.clone_path = log[self.url]
102
102
 
@@ -1,9 +1,12 @@
1
1
  from typing import List
2
2
 
3
+ from dotenv import load_dotenv
3
4
  from pydantic import BaseSettings
4
5
 
5
6
 
6
7
  class Settings(BaseSettings):
8
+ # NOTE all of these can be overridden in your .env file with upper-case names,
9
+ # for example CACHE_TYPE=momento
7
10
  debug: bool = False # show debug messages?
8
11
  progress: bool = False # show progress spinners/bars?
9
12
  stream: bool = True # stream output?
@@ -17,6 +20,7 @@ class Settings(BaseSettings):
17
20
  extra = "forbid"
18
21
 
19
22
 
23
+ load_dotenv() # get settings from .env file
20
24
  settings = Settings()
21
25
 
22
26
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.1.32
3
+ Version: 0.1.33
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  License: MIT
6
6
  Author: Prasad Chalasani
@@ -227,14 +227,16 @@ All of the below are optional and not strictly needed to run any of the examples
227
227
  If you skip setting up these, Langroid will use Qdrant in local-storage mode.
228
228
  Alternatively [Chroma](https://docs.trychroma.com/) is also currently supported.
229
229
  We use the local-storage version of Chroma, so there is no need for an API key.
230
+ Langroid uses Qdrant by default.
230
231
  - **Redis** Password, host, port: This is optional, and only needed to cache LLM API responses
231
232
  using Redis Cloud. Redis [offers](https://redis.com/try-free/) a free 30MB Redis account
232
233
  which is more than sufficient to try out Langroid and even beyond.
233
234
  If you don't set up these, Langroid will use a pure-python
234
235
  Redis in-memory cache via the [Fakeredis](https://fakeredis.readthedocs.io/en/latest/) library.
235
236
  - **Momento** Serverless Caching of LLM API responses (as an alternative to Redis).
236
- To use Momento instead of Redis, simply enter your Momento Token in the `.env` file,
237
- as the value of `MOMENTO_AUTH_TOKEN` (see example file below).
237
+ To use Momento instead of Redis:
238
+ - enter your Momento Token in the `.env` file, as the value of `MOMENTO_AUTH_TOKEN` (see example file below),
239
+ - in the `.env` file set `CACHE_TYPE=momento` (instead of `CACHE_TYPE=redis` which is the default).
238
240
  - **GitHub** Personal Access Token (required for apps that need to analyze git
239
241
  repos; token-based API calls are less rate-limited). See this
240
242
  [GitHub page](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens).
@@ -243,6 +245,7 @@ If you add all of these optional variables, your `.env` file should look like th
243
245
  ```bash
244
246
  OPENAI_API_KEY=your-key-here-without-quotes
245
247
  GITHUB_ACCESS_TOKEN=your-personal-access-token-no-quotes
248
+ CACHE_TYPE=redis # or momento
246
249
  REDIS_PASSWORD=your-redis-password-no-quotes
247
250
  REDIS_HOST=your-redis-hostname-no-quotes
248
251
  REDIS_PORT=your-redis-port-no-quotes
@@ -15,7 +15,7 @@ langroid/agent/tool_message.py,sha256=7OdVcV7UyOZD2ihYgV1C_1fIwiWM-2pR8FFxoA1IgO
15
15
  langroid/agent_config.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  langroid/cachedb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  langroid/cachedb/base.py,sha256=F-QSDlRXrC0tBRbxL397MX8hulfBMAnZNs1e9zH71OQ,790
18
- langroid/cachedb/momento_cachedb.py,sha256=TG_6sYhKvgl2b7t1bAQHDs9pXvkS6iPCwo-9_pMHwhs,2339
18
+ langroid/cachedb/momento_cachedb.py,sha256=mfLnAJO3-mPucHjwwgHeU7HQzE_jmUxca2qt3RUHVC0,2342
19
19
  langroid/cachedb/redis_cachedb.py,sha256=xuQ96FAqcHTfK8PEt1tjrh1BkMWUjojFHIgjDfF3SnU,2369
20
20
  langroid/embedding_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  langroid/embedding_models/base.py,sha256=176jDrjEAAhNzdFCG8pfossd8SAhvHR8Q5Y8pOOm0LI,983
@@ -23,7 +23,7 @@ langroid/embedding_models/clustering.py,sha256=tZWElUqXl9Etqla0FAa7og96iDKgjqWju
23
23
  langroid/embedding_models/models.py,sha256=1xcv9hqmCTsbUbS8v7XeZRsf25Tu79JUoSipIYpvNoo,2765
24
24
  langroid/language_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  langroid/language_models/base.py,sha256=7FMiUyJ3Kf9Uiqvjh-lNGfwnCibY0SbnK4jdORCv3SM,12657
26
- langroid/language_models/openai_gpt.py,sha256=NQYQqTj5OqsFtOxq9LBsJktEldbpeEKQTj_Jd-G7_XM,17974
26
+ langroid/language_models/openai_gpt.py,sha256=TuertCPkjJzz35YYGHTwX2E5gevENEPdPoFVyGl8M6k,17973
27
27
  langroid/language_models/utils.py,sha256=rmnSn-sJ3aKl_wBdeLPkck0Li4Ed6zkCxZYYl7n1V34,4668
28
28
  langroid/mytypes.py,sha256=YA42IJcooJnTxAwk-B4FmZ1hqzIIF1ZZKcpUKzBTGGo,1537
29
29
  langroid/parsing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -34,7 +34,7 @@ langroid/parsing/json.py,sha256=d56BDPjs7mC4Dc6aqm3pfNkTnA0Pq15tAJT7YkeQc0s,981
34
34
  langroid/parsing/para_sentence_split.py,sha256=2wa2_BWGhZx_Uh9TF8VsCOvn1TfLfQJcHmffJVtBtMg,1829
35
35
  langroid/parsing/parser.py,sha256=2qPjFfVjFI4jmt-21gYJTCyhYGv4HvssQj0aAGEz9ZY,7350
36
36
  langroid/parsing/pdf_parser.py,sha256=RFrck50VvqYl37xzUp-cj4uSC4FDIvJqTwv100Dilgg,1432
37
- langroid/parsing/repo_loader.py,sha256=_Wlv123kdvRMcVXll-VArRpciBHS2sGOUJRcBe8p6bo,26983
37
+ langroid/parsing/repo_loader.py,sha256=ILlvBH-wSvfdLLQKHklAzuxU980_ajts_bz7_9IwtLY,27017
38
38
  langroid/parsing/table_loader.py,sha256=4nK5QzQkwNwwzKRpg40pVLGarQp8HA9JqBQoRsGqDHA,1080
39
39
  langroid/parsing/url_loader.py,sha256=tdYPMC2V9zI_B207LFdU4aroZzJW4sY9y794XePFAVg,1824
40
40
  langroid/parsing/url_loader_cookies.py,sha256=Lg4sNpRz9MByWq2mde6T0hKv68VZSV3mtMjNEHuFeSU,2327
@@ -47,7 +47,7 @@ langroid/prompts/templates.py,sha256=4OAujKJzKIhqt4SQL2GE1aPahlZuDotlT_dZAKx0bqE
47
47
  langroid/prompts/transforms.py,sha256=GsQo1klGxUy0fACh6j0lTblk6XEl2erRnhRWlN2M4-c,2706
48
48
  langroid/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
49
  langroid/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
- langroid/utils/configuration.py,sha256=ApAAL8w3TRtAolEl-nHy5fegLwA4WffsytbEbbWl0Tg,1564
50
+ langroid/utils/configuration.py,sha256=ZTKzE9hRx7QgoSiaAXMUJreWB5E-vOsU9MtPOKTzphY,1760
51
51
  langroid/utils/constants.py,sha256=_keF-e-GIwEFvBxKJbC1Ry0u3SVWQBk4HRX0NpV2Qq8,485
52
52
  langroid/utils/docker.py,sha256=kJQOLTgM0x9j9pgIIqp0dZNZCTvoUDhp6i8tYBq1Jr0,1105
53
53
  langroid/utils/llms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -64,7 +64,7 @@ langroid/vector_store/base.py,sha256=QZx3NUNwf2I0r3A7iuoUHIRGbqt_pFGD0hq1R-Yg8iM
64
64
  langroid/vector_store/chromadb.py,sha256=s5pQkKjaMP-Tt5A8M10EInFzttaALPbJAq7q4gf0TKg,5235
65
65
  langroid/vector_store/qdrant_cloud.py,sha256=3im4Mip0QXLkR6wiqVsjV1QvhSElfxdFSuDKddBDQ-4,188
66
66
  langroid/vector_store/qdrantdb.py,sha256=KRvIIj1IZG2zFqejofMnRs2hT86B-27LgBEnuczdqOU,9072
67
- langroid-0.1.32.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
68
- langroid-0.1.32.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
69
- langroid-0.1.32.dist-info/METADATA,sha256=skkZhrrXbN0tu1EqHMWnD7qMVFT5QRrhwLUyPXOlZDo,25029
70
- langroid-0.1.32.dist-info/RECORD,,
67
+ langroid-0.1.33.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
68
+ langroid-0.1.33.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
69
+ langroid-0.1.33.dist-info/METADATA,sha256=gGIWKbaKr2cNtJbwrH6rZvsx0GUKQJKyWLeUbADs3u0,25190
70
+ langroid-0.1.33.dist-info/RECORD,,