langroid 0.1.256__py3-none-any.whl → 0.1.258__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
@@ -284,7 +284,7 @@ class Agent(ABC):
284
284
  enabled_classes: List[Type[ToolMessage]] = list(self.llm_tools_map.values())
285
285
  # use at most 2 sample conversations, no need to be exhaustive;
286
286
  sample_convo = [
287
- msg_cls().usage_example() # type: ignore
287
+ msg_cls().usage_examples(random=True) # type: ignore
288
288
  for i, msg_cls in enumerate(enabled_classes)
289
289
  if i < 2
290
290
  ]
@@ -270,9 +270,9 @@ class ChatAgent(Agent):
270
270
  ):
271
271
  # example will be shown in json_format_rules() when using TOOLs,
272
272
  # so we don't need to show it here.
273
- example = "" if self.config.use_tools else (msg_cls.usage_example())
273
+ example = "" if self.config.use_tools else (msg_cls.usage_examples())
274
274
  if example != "":
275
- example = "EXAMPLE: " + example
275
+ example = "EXAMPLES:\n" + example
276
276
  class_instructions = msg_cls.instructions()
277
277
  guidance = (
278
278
  ""
langroid/agent/task.py CHANGED
@@ -525,9 +525,11 @@ class Task:
525
525
  ):
526
526
  raise InfiniteLoopException(
527
527
  """Possible infinite loop detected!
528
- You can adjust infinite loop detection by changing the params
529
- in the TaskConfig passed to the Task constructor:
530
- e.g. set inf_loop_cycle_len=0 to disable loop detection."""
528
+ You can adjust infinite loop detection (or turn it off)
529
+ by changing the params in the TaskConfig passed to the Task
530
+ constructor; see here:
531
+ https://langroid.github.io/langroid/reference/agent/task/#langroid.agent.task.TaskConfig
532
+ """
531
533
  )
532
534
 
533
535
  final_result = self.result()
@@ -620,9 +622,11 @@ class Task:
620
622
  ):
621
623
  raise InfiniteLoopException(
622
624
  """Possible infinite loop detected!
623
- You can adjust infinite loop detection by changing the params
624
- in the TaskConfig passed to the Task constructor:
625
- e.g. set inf_loop_cycle_len=0 to disable loop detection."""
625
+ You can adjust infinite loop detection (or turn it off)
626
+ by changing the params in the TaskConfig passed to the Task
627
+ constructor; see here:
628
+ https://langroid.github.io/langroid/reference/agent/task/#langroid.agent.task.TaskConfig
629
+ """
626
630
  )
627
631
 
628
632
  final_result = self.result()
@@ -80,21 +80,34 @@ class ToolMessage(ABC, BaseModel):
80
80
  return []
81
81
 
82
82
  @classmethod
83
- def usage_example(cls) -> str:
83
+ def usage_examples(cls, random: bool = False) -> str:
84
84
  """
85
- Instruction to the LLM showing an example of how to use the message.
85
+ Instruction to the LLM showing examples of how to use the tool-message.
86
+
87
+ Args:
88
+ random (bool): whether to pick a random example from the list of examples.
89
+ Set to `true` when using this to illustrate a dialog between LLM and
90
+ user.
91
+ (if false, use ALL examples)
86
92
  Returns:
87
- str: example of how to use the message
93
+ str: examples of how to use the tool/function-call
88
94
  """
89
95
  # pick a random example of the fields
90
96
  if len(cls.examples()) == 0:
91
97
  return ""
92
- ex = choice(cls.examples())
93
- if isinstance(ex, tuple):
94
- # (description, example_instance)
95
- return f"{ex[0]} => {ex[1].json_example()}"
98
+ if random:
99
+ examples = [choice(cls.examples())]
96
100
  else:
97
- return ex.json_example()
101
+ examples = cls.examples()
102
+ examples_jsons = [
103
+ (
104
+ f"EXAMPLE {i}: (THOUGHT: {ex[0]}) => \n{ex[1].json_example()}"
105
+ if isinstance(ex, tuple)
106
+ else f"EXAMPLE {i}:\n {ex.json_example()}"
107
+ )
108
+ for i, ex in enumerate(examples, 1)
109
+ ]
110
+ return "\n\n".join(examples_jsons)
98
111
 
99
112
  def to_json(self) -> str:
100
113
  return self.json(indent=4, exclude={"result", "purpose"})
@@ -139,6 +152,9 @@ class ToolMessage(ABC, BaseModel):
139
152
  # cls.simple_schema() if tool else
140
153
  cls.llm_function_schema(request=True).parameters
141
154
  )
155
+ examples_str = ""
156
+ if cls.examples():
157
+ examples_str = "EXAMPLES:\n" + cls.usage_examples()
142
158
  return textwrap.dedent(
143
159
  f"""
144
160
  TOOL: {cls.default_value("request")}
@@ -146,7 +162,7 @@ class ToolMessage(ABC, BaseModel):
146
162
  JSON FORMAT: {
147
163
  json.dumps(param_dict, indent=4)
148
164
  }
149
- {"EXAMPLE: " + cls.usage_example() if cls.examples() else ""}
165
+ {examples_str}
150
166
  """.lstrip()
151
167
  )
152
168
 
@@ -26,7 +26,12 @@ class SegmentExtractTool(ToolMessage):
26
26
 
27
27
  @classmethod
28
28
  def examples(cls) -> List["ToolMessage" | Tuple[str, "ToolMessage"]]:
29
- return [cls(segment_list="1,3,5-7")]
29
+ return [
30
+ (
31
+ "I want to extract segments 1, 3, and 5 thru 7",
32
+ cls(segment_list="1,3,5-7"),
33
+ )
34
+ ]
30
35
 
31
36
  @classmethod
32
37
  def instructions(cls) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.1.256
3
+ Version: 0.1.258
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  License: MIT
6
6
  Author: Prasad Chalasani
@@ -10,13 +10,14 @@ Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
+ Provides-Extra: all
13
14
  Provides-Extra: chainlit
14
15
  Provides-Extra: chromadb
15
16
  Provides-Extra: db
16
17
  Provides-Extra: doc-chat
17
18
  Provides-Extra: docx
18
- Provides-Extra: embeddings
19
19
  Provides-Extra: hf-embeddings
20
+ Provides-Extra: hf-transformers
20
21
  Provides-Extra: lancedb
21
22
  Provides-Extra: litellm
22
23
  Provides-Extra: meilisearch
@@ -31,11 +32,12 @@ Provides-Extra: scrapy
31
32
  Provides-Extra: sql
32
33
  Provides-Extra: transformers
33
34
  Provides-Extra: unstructured
35
+ Provides-Extra: vecdbs
34
36
  Requires-Dist: aiohttp (>=3.9.1,<4.0.0)
35
37
  Requires-Dist: async-generator (>=1.10,<2.0)
36
38
  Requires-Dist: bs4 (>=0.0.1,<0.0.2)
37
- Requires-Dist: chainlit (>=1.0.400,<2.0.0) ; extra == "chainlit"
38
- Requires-Dist: chromadb (>=0.4.21,<=0.4.23) ; extra == "chromadb"
39
+ Requires-Dist: chainlit (>=1.0.400,<2.0.0) ; extra == "all" or extra == "chainlit"
40
+ Requires-Dist: chromadb (>=0.4.21,<=0.4.23) ; extra == "vecdbs" or extra == "all" or extra == "chromadb"
39
41
  Requires-Dist: colorlog (>=6.7.0,<7.0.0)
40
42
  Requires-Dist: docstring-parser (>=0.15,<0.16)
41
43
  Requires-Dist: duckduckgo-search (>=6.0.0,<7.0.0)
@@ -47,47 +49,38 @@ Requires-Dist: google-generativeai (>=0.5.2,<0.6.0)
47
49
  Requires-Dist: groq (>=0.5.0,<0.6.0)
48
50
  Requires-Dist: grpcio (>=1.62.1,<2.0.0)
49
51
  Requires-Dist: halo (>=0.0.31,<0.0.32)
50
- Requires-Dist: huggingface-hub (>=0.21.2,<0.22.0) ; extra == "embeddings" or extra == "transformers"
52
+ Requires-Dist: huggingface-hub (>=0.21.2,<0.22.0) ; extra == "hf-transformers" or extra == "all" or extra == "transformers"
51
53
  Requires-Dist: jinja2 (>=3.1.2,<4.0.0)
52
- Requires-Dist: lancedb (>=0.6.2,<0.7.0) ; extra == "lancedb"
53
- Requires-Dist: litellm (>=1.30.1,<2.0.0) ; extra == "litellm"
54
+ Requires-Dist: lancedb (>=0.6.2,<0.7.0) ; extra == "vecdbs" or extra == "all" or extra == "lancedb"
55
+ Requires-Dist: litellm (>=1.30.1,<2.0.0) ; extra == "all" or extra == "litellm"
54
56
  Requires-Dist: lxml (>=4.9.3,<5.0.0)
55
57
  Requires-Dist: meilisearch (>=0.28.3,<0.29.0) ; extra == "meilisearch"
56
58
  Requires-Dist: meilisearch-python-sdk (>=2.2.3,<3.0.0) ; extra == "meilisearch"
57
- Requires-Dist: metaphor-python (>=0.1.23,<0.2.0) ; extra == "metaphor"
58
- Requires-Dist: mkdocs (>=1.4.2,<2.0.0) ; extra == "mkdocs"
59
- Requires-Dist: mkdocs-awesome-pages-plugin (>=2.8.0,<3.0.0) ; extra == "mkdocs"
60
- Requires-Dist: mkdocs-gen-files (>=0.4.0,<0.5.0) ; extra == "mkdocs"
61
- Requires-Dist: mkdocs-jupyter (>=0.24.1,<0.25.0) ; extra == "mkdocs"
62
- Requires-Dist: mkdocs-literate-nav (>=0.6.0,<0.7.0) ; extra == "mkdocs"
63
- Requires-Dist: mkdocs-material (>=9.1.5,<10.0.0) ; extra == "mkdocs"
64
- Requires-Dist: mkdocs-rss-plugin (>=1.8.0,<2.0.0) ; extra == "mkdocs"
65
- Requires-Dist: mkdocs-section-index (>=0.3.5,<0.4.0) ; extra == "mkdocs"
66
- Requires-Dist: mkdocstrings[python] (>=0.21.2,<0.22.0) ; extra == "mkdocs"
59
+ Requires-Dist: metaphor-python (>=0.1.23,<0.2.0) ; extra == "all" or extra == "metaphor"
67
60
  Requires-Dist: momento (>=1.10.2,<2.0.0) ; extra == "momento"
68
- Requires-Dist: neo4j (>=5.14.1,<6.0.0) ; extra == "neo4j"
61
+ Requires-Dist: neo4j (>=5.14.1,<6.0.0) ; extra == "all" or extra == "neo4j"
69
62
  Requires-Dist: nest-asyncio (>=1.6.0,<2.0.0)
70
63
  Requires-Dist: nltk (>=3.8.1,<4.0.0)
71
64
  Requires-Dist: onnxruntime (>=1.16.1,<2.0.0)
72
65
  Requires-Dist: openai (>=1.14.0,<2.0.0)
73
66
  Requires-Dist: pandas (>=2.0.3,<3.0.0)
74
- Requires-Dist: pdf2image (>=1.17.0,<2.0.0) ; extra == "doc-chat" or extra == "pdf-parsers"
75
- Requires-Dist: pdfplumber (>=0.10.2,<0.11.0) ; extra == "doc-chat" or extra == "pdf-parsers"
67
+ Requires-Dist: pdf2image (>=1.17.0,<2.0.0) ; extra == "doc-chat" or extra == "all" or extra == "pdf-parsers"
68
+ Requires-Dist: pdfplumber (>=0.10.2,<0.11.0) ; extra == "doc-chat" or extra == "all" or extra == "pdf-parsers"
76
69
  Requires-Dist: prettytable (>=3.8.0,<4.0.0)
77
- Requires-Dist: psycopg2 (>=2.9.7,<3.0.0) ; extra == "db" or extra == "postgres" or extra == "sql"
78
- Requires-Dist: pyarrow (==15.0.0) ; extra == "lancedb"
70
+ Requires-Dist: psycopg2 (>=2.9.7,<3.0.0) ; extra == "db" or extra == "all" or extra == "postgres" or extra == "sql"
71
+ Requires-Dist: pyarrow (==15.0.0) ; extra == "vecdbs" or extra == "all" or extra == "lancedb"
79
72
  Requires-Dist: pydantic (==1.10.13)
80
73
  Requires-Dist: pygithub (>=1.58.1,<2.0.0)
81
74
  Requires-Dist: pygments (>=2.15.1,<3.0.0)
82
- Requires-Dist: pymupdf (>=1.23.3,<2.0.0) ; extra == "doc-chat" or extra == "pdf-parsers"
83
- Requires-Dist: pymysql (>=1.1.0,<2.0.0) ; extra == "db" or extra == "mysql" or extra == "sql"
75
+ Requires-Dist: pymupdf (>=1.23.3,<2.0.0) ; extra == "doc-chat" or extra == "all" or extra == "pdf-parsers"
76
+ Requires-Dist: pymysql (>=1.1.0,<2.0.0) ; extra == "db" or extra == "all" or extra == "mysql" or extra == "sql"
84
77
  Requires-Dist: pyparsing (>=3.0.9,<4.0.0)
85
- Requires-Dist: pypdf (>=3.12.2,<4.0.0) ; extra == "doc-chat" or extra == "pdf-parsers"
86
- Requires-Dist: pytesseract (>=0.3.10,<0.4.0) ; extra == "doc-chat" or extra == "pdf-parsers"
87
- Requires-Dist: python-docx (>=1.1.0,<2.0.0) ; extra == "doc-chat" or extra == "docx"
78
+ Requires-Dist: pypdf (>=3.12.2,<4.0.0) ; extra == "doc-chat" or extra == "all" or extra == "pdf-parsers"
79
+ Requires-Dist: pytesseract (>=0.3.10,<0.4.0) ; extra == "doc-chat" or extra == "all" or extra == "pdf-parsers"
80
+ Requires-Dist: python-docx (>=1.1.0,<2.0.0) ; extra == "doc-chat" or extra == "all" or extra == "docx"
88
81
  Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
89
82
  Requires-Dist: python-magic (>=0.4.27,<0.5.0)
90
- Requires-Dist: python-socketio (>=5.11.0,<6.0.0) ; extra == "chainlit"
83
+ Requires-Dist: python-socketio (>=5.11.0,<6.0.0) ; extra == "all" or extra == "chainlit"
91
84
  Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
92
85
  Requires-Dist: qdrant-client (>=1.8.0,<2.0.0)
93
86
  Requires-Dist: rank-bm25 (>=0.2.2,<0.3.0)
@@ -96,16 +89,16 @@ Requires-Dist: requests (>=2.31.0,<3.0.0)
96
89
  Requires-Dist: requests-oauthlib (>=1.3.1,<2.0.0)
97
90
  Requires-Dist: rich (>=13.3.4,<14.0.0)
98
91
  Requires-Dist: scrapy (>=2.11.0,<3.0.0) ; extra == "scrapy"
99
- Requires-Dist: sentence-transformers (==2.2.2) ; extra == "embeddings" or extra == "hf-embeddings"
100
- Requires-Dist: sqlalchemy (>=2.0.19,<3.0.0) ; extra == "db" or extra == "sql"
101
- Requires-Dist: tantivy (>=0.21.0,<0.22.0) ; extra == "lancedb"
92
+ Requires-Dist: sentence-transformers (==2.2.2) ; extra == "hf-transformers" or extra == "all" or extra == "hf-embeddings"
93
+ Requires-Dist: sqlalchemy (>=2.0.19,<3.0.0) ; extra == "db" or extra == "all" or extra == "sql"
94
+ Requires-Dist: tantivy (>=0.21.0,<0.22.0) ; extra == "vecdbs" or extra == "all" or extra == "lancedb"
102
95
  Requires-Dist: thefuzz (>=0.20.0,<0.21.0)
103
96
  Requires-Dist: tiktoken (>=0.7.0,<0.8.0)
104
- Requires-Dist: torch (==2.0.0) ; extra == "embeddings" or extra == "hf-embeddings" or extra == "transformers"
97
+ Requires-Dist: torch (==2.0.0) ; extra == "hf-transformers" or extra == "all" or extra == "hf-embeddings" or extra == "transformers"
105
98
  Requires-Dist: trafilatura (>=1.5.0,<2.0.0)
106
- Requires-Dist: transformers (>=4.40.1,<5.0.0) ; extra == "embeddings" or extra == "transformers"
99
+ Requires-Dist: transformers (>=4.40.1,<5.0.0) ; extra == "hf-transformers" or extra == "all" or extra == "transformers"
107
100
  Requires-Dist: typer (>=0.9.0,<0.10.0)
108
- Requires-Dist: unstructured[docx,pdf,pptx] (>=0.10.16,<0.10.18) ; extra == "doc-chat" or extra == "unstructured"
101
+ Requires-Dist: unstructured[docx,pdf,pptx] (>=0.10.16,<0.10.18) ; extra == "doc-chat" or extra == "all" or extra == "unstructured"
109
102
  Requires-Dist: wget (>=3.2,<4.0)
110
103
  Description-Content-Type: text/markdown
111
104
 
@@ -234,12 +227,22 @@ teacher_task.run()
234
227
  <summary> <b>Click to expand</b></summary>
235
228
 
236
229
  - **May 2024:**
230
+ - **Slimmer langroid**: All document-parsers (i.e. pdf, doc, docx) and most
231
+ vector-databases (except qdrant)
232
+ are now optional/extra dependencies, which helps reduce build size, script
233
+ start-up time, and install time. For convenience various grouping of "extras" are
234
+ provided, e.g. `doc-chat`, `db` (for database-related dependencies). See updated
235
+ install instructions below and in the docs.
236
+ - **Few-shot examples** for tools: when defining a [ToolMessage](https://langroid.github.io/langroid/quick-start/chat-agent-tool/#example-find-the-smallest-number-in-a-list), previously you were able to include a classmethod named `examples`,
237
+ and a random example from this list would be used to generate a 1-shot example
238
+ for the LLM. This has been improved so you can now supply a list of examples
239
+ where each example is either a tool instance, or a tuple of (description,
240
+ tool instance), where the description is a "thought" that leads the LLM to use
241
+ the tool (see example in the [docs](https://langroid.github.io/langroid/quick-start/chat-agent-tool/#example-find-the-smallest-number-in-a-list)). In some scenarios this can improve LLM tool
242
+ generation accuracy. Also, now instead of a random example, ALL examples are used to generate few-shot
243
+ examples.
237
244
  - [Infinite loop detection](https://github.com/langroid/langroid/blob/0ed30eb467b00d5eaf2933b577a4b2cc37de1aa1/langroid/agent/task.py#L1121) for task loops of cycle-length <= 10 (configurable
238
- in [`TaskConfig`](https://github.
239
- com/langroid/langroid/blob/0ed30eb467b00d5eaf2933b577a4b2cc37de1aa1/langroid/agent
240
- /task.py#L61). Only detects _exact_ loops, rather than
241
- _approximate_ loops where the entities are saying essentially similar (but not
242
- exactly the same) things repeatedly.
245
+ in [`TaskConfig`](https://langroid.github.io/langroid/reference/agent/task/#langroid.agent.task.TaskConfig). Only detects _exact_ loops, rather than _approximate_ loops where the entities are saying essentially similar (but not exactly the same) things repeatedly.
243
246
  - "@"-addressing: any entity can address any other by name, which can be the name
244
247
  of an agent's responder ("llm", "user", "agent") or a sub-task name. This is a
245
248
  simpler alternative to the `RecipientTool` mechanism, with the tradeoff that
@@ -489,7 +492,10 @@ For many practical scenarios, you may need additional optional dependencies:
489
492
  ```bash
490
493
  pip install "langroid[doc-chat,db]"
491
494
  ```
492
-
495
+ - To simply install _all_ optional dependencies, use the `all` extra (but note that this will result in longer load/startup times and a larger install size):
496
+ ```bash
497
+ pip install "langroid[all]"
498
+ ```
493
499
  <details>
494
500
  <summary><b>Optional Installs for using SQL Chat with a PostgreSQL DB </b></summary>
495
501
 
@@ -1,10 +1,10 @@
1
1
  langroid/__init__.py,sha256=z_fCOLQJPOw3LLRPBlFB5-2HyCjpPgQa4m4iY5Fvb8Y,1800
2
2
  langroid/agent/__init__.py,sha256=ll0Cubd2DZ-fsCMl7e10hf9ZjFGKzphfBco396IKITY,786
3
- langroid/agent/base.py,sha256=6EznAMa4zeRdouo3U3_UzOI_cblvdpNH4v5CAM-fgbA,37171
3
+ langroid/agent/base.py,sha256=aSwWmOBg0d3QQHUSauscMNfnl8Wkv6nrk2nngKa9DjM,37183
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=XWih3UkHsYgPIaBQ1cZ-8H2VU_URh-sSfw8fcq1hfMo,20841
7
- langroid/agent/chat_agent.py,sha256=_xsBfGBkwcHd8IRErsW7tKNz7qn0h2oKSg_BFleOPCs,39475
7
+ langroid/agent/chat_agent.py,sha256=hnmeOxdi4i5w8WaL2kPjQOEpenoRW_hG5EfeMWuuVsQ,39478
8
8
  langroid/agent/chat_document.py,sha256=uwCq53SHRyxQw6qyhjzPYuJG48VHBgOf2122Ew3fk6c,9316
9
9
  langroid/agent/helpers.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  langroid/agent/junk,sha256=LxfuuW7Cijsg0szAzT81OjWWv1PMNI-6w_-DspVIO2s,339
@@ -32,8 +32,8 @@ langroid/agent/special/sql/utils/populate_metadata.py,sha256=1J22UsyEPKzwK0XlJZt
32
32
  langroid/agent/special/sql/utils/system_message.py,sha256=qKLHkvQWRQodTtPLPxr1GSLUYUFASZU8x-ybV67cB68,1885
33
33
  langroid/agent/special/sql/utils/tools.py,sha256=6uB2424SLtmapui9ggcEr0ZTiB6_dL1-JRGgN8RK9Js,1332
34
34
  langroid/agent/special/table_chat_agent.py,sha256=d9v2wsblaRx7oMnKhLV7uO_ujvk9gh59pSGvBXyeyNc,9659
35
- langroid/agent/task.py,sha256=J4GIvbPMlL9uXKr7J-bSPHGvFK5tI2R0INgbnbFRmqk,59265
36
- langroid/agent/tool_message.py,sha256=okhIK0M2ZIGTlQF3h6UGkYk6ibH17mzm0ypDeczlWc0,9137
35
+ langroid/agent/task.py,sha256=8f65p79ID17mCT8l2F7VuldL7uEWOavLTOkX0B29sbo,59465
36
+ langroid/agent/tool_message.py,sha256=7t-UGEbykosKHAvaLI0Rm59sgxvN31IO3-P7bg7gLug,9730
37
37
  langroid/agent/tools/__init__.py,sha256=8Pc9BlGCB5FQ2IDGKS_WPpHCoWp5jblMU8EHJwwikAY,303
38
38
  langroid/agent/tools/duckduckgo_search_tool.py,sha256=NhsCaGZkdv28nja7yveAhSK_w6l_Ftym8agbrdzqgfo,1935
39
39
  langroid/agent/tools/extract_tool.py,sha256=u5lL9rKBzaLBOrRyLnTAZ97pQ1uxyLP39XsWMnpaZpw,3789
@@ -43,7 +43,7 @@ langroid/agent/tools/metaphor_search_tool.py,sha256=qj4gt453cLEX3EGW7nVzVu6X7LCd
43
43
  langroid/agent/tools/recipient_tool.py,sha256=NrLxIeQT-kbMv7AeYX0uqvGeMK4Q3fIDvG15OVzlgk8,9624
44
44
  langroid/agent/tools/retrieval_tool.py,sha256=2q2pfoYbZNfbWQ0McxrtmfF0ekGglIgRl-6uF26pa-E,871
45
45
  langroid/agent/tools/run_python_code.py,sha256=BvoxYzzHijU-p4703n2iVlt5BCieR1oMSy50w0tQZAg,1787
46
- langroid/agent/tools/segment_extract_tool.py,sha256=WOwZdTTOqKaJUDIqI0jWDV126VM1UjJzIUandHsnC-g,1320
46
+ langroid/agent/tools/segment_extract_tool.py,sha256=__srZ_VGYLVOdPrITUM8S0HpmX4q7r5FHWMDdHdEv8w,1440
47
47
  langroid/agent_config.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
48
  langroid/cachedb/__init__.py,sha256=icAT2s7Vhf-ZGUeqpDQGNU6ob6o0aFEyjwcxxUGRFjg,225
49
49
  langroid/cachedb/base.py,sha256=LKiJyOFQUN1NRzPIynfbYKGFfSanA6auDfBNEedBK7Y,1342
@@ -126,7 +126,8 @@ langroid/vector_store/meilisearch.py,sha256=6frB7GFWeWmeKzRfLZIvzRjllniZ1cYj3Hmh
126
126
  langroid/vector_store/momento.py,sha256=QaPzUnTwlswoawGB-paLtUPyLRvckFXLfLDfvbTzjNQ,10505
127
127
  langroid/vector_store/qdrant_cloud.py,sha256=3im4Mip0QXLkR6wiqVsjV1QvhSElfxdFSuDKddBDQ-4,188
128
128
  langroid/vector_store/qdrantdb.py,sha256=sk5Qb2ZNbooi0rorsMuqIMokF7WADw6PJ0D6goM2XBw,16802
129
- langroid-0.1.256.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
130
- langroid-0.1.256.dist-info/METADATA,sha256=W7Daa9ruwJoQrUJqJc4g0Ios64ifd0w1LFYGHUOhuKo,51001
131
- langroid-0.1.256.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
132
- langroid-0.1.256.dist-info/RECORD,,
129
+ pyproject.toml,sha256=fDctkmdTjKOSWnSdsYxFKf-Ud0ESk7f4DI_0vE47dpk,7026
130
+ langroid-0.1.258.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
131
+ langroid-0.1.258.dist-info/METADATA,sha256=vtecA1CocyelLpV30tpccSfGuwVCRtW8nMAIxH2Vkyg,52414
132
+ langroid-0.1.258.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
133
+ langroid-0.1.258.dist-info/RECORD,,
pyproject.toml ADDED
@@ -0,0 +1,233 @@
1
+ [tool.poetry]
2
+ name = "langroid"
3
+ version = "0.1.258"
4
+ description = "Harness LLMs with Multi-Agent Programming"
5
+ authors = ["Prasad Chalasani <pchalasani@gmail.com>"]
6
+ readme = "README.md"
7
+ license = "MIT"
8
+ include = ["pyproject.toml"]
9
+
10
+
11
+ # =============== MAIN DEPS ==============
12
+ [tool.poetry.dependencies]
13
+ python = ">=3.10,<3.12"
14
+
15
+ # =========== OPTIONALS ==============================
16
+ chromadb = {version=">=0.4.21, <=0.4.23", optional=true}
17
+ momento = {version="^1.10.2", optional=true}
18
+ unstructured = {extras = ["docx", "pptx", "pdf"], version = ">=0.10.16,<0.10.18", optional=true}
19
+ sentence-transformers = {version="2.2.2", optional=true}
20
+ torch = {version="2.0.0", optional=true}
21
+ psycopg2 = {version="^2.9.7", optional=true}
22
+ pymysql = {version = "^1.1.0", optional = true}
23
+ meilisearch = {version="^0.28.3", optional=true}
24
+ meilisearch-python-sdk = {version="^2.2.3", optional=true}
25
+ litellm = {version = "^1.30.1", optional = true}
26
+ metaphor-python = {version = "^0.1.23", optional = true}
27
+ chainlit = {version = "^1.0.400", optional = true}
28
+ python-socketio = {version="^5.11.0", optional=true}
29
+ neo4j = {version = "^5.14.1", optional = true}
30
+ huggingface-hub = {version="^0.21.2", optional=true}
31
+ transformers = {version="^4.40.1", optional=true}
32
+ lancedb = {version="^0.6.2", optional=true}
33
+ tantivy = {version="^0.21.0", optional=true}
34
+ pypdf = {version="^3.12.2", optional=true}
35
+ pymupdf = {version="^1.23.3", optional=true}
36
+ pdf2image = {version="^1.17.0", optional=true}
37
+ pytesseract = {version="^0.3.10", optional=true}
38
+ sqlalchemy = {version="^2.0.19", optional=true}
39
+ pyarrow = {version="15.0.0", optional=true}
40
+ pdfplumber = {version="^0.10.2", optional=true}
41
+ python-docx = {version="^1.1.0", optional=true}
42
+ scrapy = {version="^2.11.0", optional=true}
43
+
44
+ # ====CORE================================
45
+ pyyaml = "^6.0.1"
46
+ onnxruntime = "^1.16.1"
47
+ fire = "^0.5.0"
48
+ bs4 = "^0.0.1"
49
+ python-dotenv = "^1.0.0"
50
+ wget = "^3.2"
51
+ rich = "^13.3.4"
52
+ requests-oauthlib = "^1.3.1"
53
+ trafilatura = "^1.5.0"
54
+ halo = "^0.0.31"
55
+ typer = "^0.9.0"
56
+ colorlog = "^6.7.0"
57
+ openai = "^1.14.0"
58
+ tiktoken = "^0.7.0"
59
+ pygithub = "^1.58.1"
60
+ pygments = "^2.15.1"
61
+ redis = "^5.0.1"
62
+ fakeredis = "^2.12.1"
63
+ faker = "^18.9.0"
64
+ requests = "^2.31.0"
65
+ pyparsing = "^3.0.9"
66
+ nltk = "^3.8.1"
67
+ qdrant-client = "^1.8.0"
68
+ pydantic = "1.10.13"
69
+ pandas = "^2.0.3"
70
+ prettytable = "^3.8.0"
71
+
72
+ google-api-python-client = "^2.95.0"
73
+ lxml = "^4.9.3"
74
+
75
+ rank-bm25 = "^0.2.2"
76
+ thefuzz = "^0.20.0"
77
+
78
+ jinja2 = "^3.1.2"
79
+ docstring-parser = "^0.15"
80
+
81
+ aiohttp = "^3.9.1"
82
+ grpcio = "^1.62.1"
83
+ duckduckgo-search = "^6.0.0"
84
+
85
+ google-generativeai = "^0.5.2"
86
+ groq = "^0.5.0"
87
+ nest-asyncio = "^1.6.0"
88
+ async-generator = "^1.10"
89
+
90
+ python-magic = "^0.4.27"
91
+
92
+ [tool.poetry.extras]
93
+ # install these using, e.g.,
94
+ # `poetry install -E [...]` where [...] is one of the extras below
95
+ # or install multiple extras using, e.g., `poetry install -E "litellm mysql"
96
+
97
+ # Groupings for common use-cases
98
+ doc-chat = [
99
+ "unstructured", "python-docx", "pdfplumber", "pypdf",
100
+ "pymupdf", "pdf2image", "pytesseract"
101
+ ]
102
+ db = ["postgres", "mysql", "sqlalchemy", "psycopg2", "pymysql"]
103
+ hf-transformers = ["sentence-transformers", "torch", "transformers", "huggingface-hub"]
104
+ vecdbs = ["lancedb", "tantivy", "pyarrow", "chromadb"]
105
+ all = [
106
+ "unstructured", "python-docx", "pdfplumber", "pypdf",
107
+ "pymupdf", "pdf2image", "pytesseract",
108
+ "postgres", "mysql", "sqlalchemy", "psycopg2", "pymysql",
109
+ "sentence-transformers", "torch", "transformers", "huggingface-hub",
110
+ "lancedb", "tantivy", "pyarrow", "chromadb",
111
+ "metaphor-python", "neo4j",
112
+ "litellm",
113
+ "chainlit", "python-socketio",
114
+ ]
115
+ # more granular groupings
116
+ lancedb = ["lancedb", "tantivy", "pyarrow"]
117
+ pdf-parsers = ["pdfplumber", "pypdf", "pymupdf", "pdf2image", "pytesseract"]
118
+ docx = ["python-docx"]
119
+ scrapy = ["scrapy"]
120
+ hf-embeddings = ["sentence-transformers", "torch"]
121
+ transformers = ["transformers", "huggingface-hub", "torch"]
122
+ unstructured = ["unstructured"]
123
+ postgres = ["psycopg2"]
124
+ mysql = ["pymysql"]
125
+ sql = ["sqlalchemy", "pymysql", "psycopg2"]
126
+ litellm = ["litellm"]
127
+ neo4j = ["neo4j"]
128
+ metaphor = ["metaphor-python"]
129
+ chainlit = ["chainlit", "python-socketio"]
130
+ chromadb = ["chromadb"]
131
+ mkdocs = [
132
+ "mkdocs", "mkdocs-material", "mkdocstrings", "mkdocs-awesome-pages-plugin",
133
+ "mkdocs-gen-files", "mkdocs-literate-nav",
134
+ "mkdocs-section-index", "mkdocs-jupyter", "mkdocs-rss-plugin"
135
+ ]
136
+ meilisearch = ["meilisearch", "meilisearch-python-sdk"]
137
+ momento = ["momento"]
138
+
139
+
140
+ # ================= DEV DEPS =================
141
+ [tool.poetry.group.dev.dependencies]
142
+ black = {extras = ["jupyter"], version = "^24.3.0"}
143
+ flake8 = "^6.0.0"
144
+ mypy = "^1.7.0"
145
+ ruff = "^0.2.2"
146
+ pre-commit = "^3.3.2"
147
+ autopep8 = "^2.0.2"
148
+
149
+ types-redis = "^4.5.5.2"
150
+ types-requests = "^2.31.0.1"
151
+ types-pyyaml = "^6.0.12.20240311"
152
+ types-pillow = "^10.2.0.20240406"
153
+
154
+ pytest = "^7.3.1"
155
+ pytest-redis = "^3.0.2"
156
+ pytest-asyncio = "^0.21.1"
157
+ pytest-postgresql = "^5.0.0"
158
+ pytest-mysql = "^2.4.2"
159
+ coverage = "^7.2.5"
160
+
161
+ [tool.poetry.group.docs]
162
+ optional = true
163
+
164
+ [tool.poetry.group.docs.dependencies]
165
+
166
+ mkdocs = "^1.4.2"
167
+ mkdocs-material = "^9.1.5"
168
+ mkdocstrings = {extras = ["python"], version = "^0.21.2"}
169
+ mkdocs-awesome-pages-plugin = "^2.8.0"
170
+ mkdocs-rss-plugin = "^1.8.0"
171
+ mkdocs-gen-files = "^0.4.0"
172
+ mkdocs-literate-nav = "^0.6.0"
173
+ mkdocs-section-index = "^0.3.5"
174
+ mkdocs-jupyter = "^0.24.1"
175
+
176
+
177
+
178
+ # ========================================
179
+ [build-system]
180
+ requires = ["poetry-core"]
181
+ build-backend = "poetry.core.masonry.api"
182
+
183
+ [tool.black]
184
+ line-length = 88
185
+ include = '\.pyi?$'
186
+ # extend-exclude = '.*pyi$'
187
+ # exclude = '^stubs/'
188
+
189
+ [tool.pytype]
190
+ inputs = ["langroid"]
191
+
192
+ [tool.mypy]
193
+ python_version = "3.11"
194
+ #mypy_path = ["stubs"]
195
+
196
+ #follow_imports = "skip"
197
+ #check_untyped_defs = "True"
198
+ disallow_untyped_defs = "True"
199
+ ignore_missing_imports = "True"
200
+ warn_unused_ignores = "False"
201
+ strict = true
202
+ exclude = [
203
+ "docs", ".venv", "venv", "examples", "examples_dev", "langroid/utils/web",
204
+ "notebooks",
205
+ "langroid/parsing/repo_loader.py",
206
+ "langroid/embedding_models/clustering.py",
207
+ "langroid/agent/callbacks/chainlit.py",
208
+ "langroid/vector_store/chromadb.py",
209
+ "langroid/embedding_models/protoc" # ignore generated files
210
+ ]
211
+ files=["langroid/*"]
212
+ plugins = [
213
+ "pydantic.mypy"
214
+ ]
215
+
216
+ [tool.ruff]
217
+ line-length = 88
218
+ # Allow unused variables when underscore-prefixed.
219
+ lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
220
+ # Assume Python 3.11.
221
+ target-version = "py311"
222
+ lint.select = [
223
+ "E", # pycodestyle
224
+ "F", # pyflakes
225
+ "I", # isort
226
+ ]
227
+ lint.exclude = ["docs/**", ".venv", "venv", "examples/**", "examples_dev", "langroid/utils/web", "notebooks", "__init__.py", "langroid/embedding_models/protoc/*"]
228
+ lint.fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
229
+ lint.unfixable = []
230
+ lint.extend-ignore = ["F821"]
231
+
232
+ [tool.pytest.ini_options]
233
+ filterwarnings = ["ignore::DeprecationWarning"]