langroid 0.34.0__py3-none-any.whl → 0.34.1__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.
@@ -72,14 +72,13 @@ def apply_nest_asyncio() -> None:
72
72
 
73
73
  logger = logging.getLogger(__name__)
74
74
 
75
- DEFAULT_DOC_CHAT_INSTRUCTIONS = """
76
- Your task is to answer questions about various documents.
77
- You will be given various passages from these documents, and asked to answer questions
78
- about them, or summarize them into coherent answers.
79
- """
80
75
 
81
76
  DEFAULT_DOC_CHAT_SYSTEM_MESSAGE = """
82
77
  You are a helpful assistant, helping me understand a collection of documents.
78
+
79
+ Your TASK is to answer questions about various documents.
80
+ You will be given various passages from these documents, and asked to answer questions
81
+ about them, or summarize them into coherent answers.
83
82
  """
84
83
 
85
84
  CHUNK_ENRICHMENT_DELIMITER = "<##-##-##>"
@@ -113,7 +112,6 @@ class ChunkEnrichmentAgentConfig(ChatAgentConfig):
113
112
 
114
113
  class DocChatAgentConfig(ChatAgentConfig):
115
114
  system_message: str = DEFAULT_DOC_CHAT_SYSTEM_MESSAGE
116
- user_message: str = DEFAULT_DOC_CHAT_INSTRUCTIONS
117
115
  summarize_prompt: str = SUMMARY_ANSWER_PROMPT_GPT4
118
116
  # extra fields to include in content as key=value pairs
119
117
  # (helps retrieval for table-like data)
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ import re
2
3
  from enum import Enum
3
4
  from typing import Dict, List, Literal
4
5
 
@@ -250,12 +251,12 @@ class Parser:
250
251
  continue
251
252
 
252
253
  # Find the last period or punctuation mark in the chunk
253
- last_punctuation = max(
254
- chunk_text.rfind("."),
255
- chunk_text.rfind("?"),
256
- chunk_text.rfind("!"),
257
- chunk_text.rfind("\n"),
258
- )
254
+ punctuation_matches = [
255
+ (m.start(), m.group())
256
+ for m in re.finditer(r"(?:[.!?][\s\n]|\n)", chunk_text)
257
+ ]
258
+
259
+ last_punctuation = max([pos for pos, _ in punctuation_matches] + [-1])
259
260
 
260
261
  # If there is a punctuation mark, and the last punctuation index is
261
262
  # after MIN_CHUNK_SIZE_CHARS
@@ -268,7 +269,7 @@ class Parser:
268
269
 
269
270
  # Remove any newline characters and strip any leading or
270
271
  # trailing whitespace
271
- chunk_text_to_append = chunk_text.replace("\n", " ").strip()
272
+ chunk_text_to_append = re.sub(r"\n{2,}", "\n", chunk_text).strip()
272
273
 
273
274
  if len(chunk_text_to_append) > self.config.discard_chunk_chars:
274
275
  # Append the chunk text to the list of chunks
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langroid
3
- Version: 0.34.0
3
+ Version: 0.34.1
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  Author-email: Prasad Chalasani <pchalasani@gmail.com>
6
6
  License: MIT
@@ -287,7 +287,11 @@ teacher_task.run()
287
287
  <details>
288
288
  <summary> <b>Click to expand</b></summary>
289
289
 
290
+ - **Jan 2025:**
291
+ - [0.33.0](https://github.com/langroid/langroid/releases/tag/0.33.3) Move from Poetry to uv!
292
+ - [0.32.0](https://github.com/langroid/langroid/releases/tag/0.32.0) DeepSeek v3 support.
290
293
  - **Dec 2024:**
294
+ - [0.31.0](https://github.com/langroid/langroid/releases/tag/0.31.0) Azure OpenAI Embeddings
291
295
  - [0.30.0](https://github.com/langroid/langroid/releases/tag/0.30.0) Llama-cpp embeddings.
292
296
  - [0.29.0](https://github.com/langroid/langroid/releases/tag/0.29.0) Custom Azure OpenAI Client
293
297
  - [0.28.0](https://github.com/langroid/langroid/releases/tag/0.28.0) `ToolMessage`: `_handler` field to override
@@ -14,7 +14,7 @@ langroid/agent/xml_tool_message.py,sha256=6SshYZJKIfi4mkE-gIoSwjkEYekQ8GwcSiCv7a
14
14
  langroid/agent/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  langroid/agent/callbacks/chainlit.py,sha256=RH8qUXaZE5o2WQz3WJQ1SdFtASGlxWCA6_HYz_3meDQ,20822
16
16
  langroid/agent/special/__init__.py,sha256=gik_Xtm_zV7U9s30Mn8UX3Gyuy4jTjQe9zjiE3HWmEo,1273
17
- langroid/agent/special/doc_chat_agent.py,sha256=tI16jVavTSOen9OUoRTl5heDTeTBhWsxW17XU9ZcEko,63563
17
+ langroid/agent/special/doc_chat_agent.py,sha256=EPRKhchk1nuExn4_Lbuu5hzGkBP06PvJAK1edoISQHc,63470
18
18
  langroid/agent/special/lance_doc_chat_agent.py,sha256=s8xoRs0gGaFtDYFUSIRchsgDVbS5Q3C2b2mr3V1Fd-Q,10419
19
19
  langroid/agent/special/lance_tools.py,sha256=qS8x4wi8mrqfbYV2ztFzrcxyhHQ0ZWOc-zkYiH7awj0,2105
20
20
  langroid/agent/special/relevance_extractor_agent.py,sha256=zIx8GUdVo1aGW6ASla0NPQjYYIpmriK_TYMijqAx3F8,4796
@@ -81,7 +81,7 @@ langroid/parsing/code_parser.py,sha256=AOxb3xbYpTBPP3goOm5dKfJdh5hS_2BhLVCEkifWZ
81
81
  langroid/parsing/document_parser.py,sha256=9xUOyrVNBAS9cpCvCptr2XK4Kq47W574i8zzGEoXc3c,24933
82
82
  langroid/parsing/para_sentence_split.py,sha256=AJBzZojP3zpB-_IMiiHismhqcvkrVBQ3ZINoQyx_bE4,2000
83
83
  langroid/parsing/parse_json.py,sha256=aADo38bAHQhC8on4aWZZzVzSDy-dK35vRLZsFI2ewh8,4756
84
- langroid/parsing/parser.py,sha256=bTG5TO2CEwGdLf9979j9_dFntKX5FloGF8vhts6ObU0,11978
84
+ langroid/parsing/parser.py,sha256=N0jr1Zl_f_rx-8YMmSQftPHquqSQfec-3s7JAhhEe6I,12032
85
85
  langroid/parsing/repo_loader.py,sha256=3GjvPJS6Vf5L6gV2zOU8s-Tf1oq_fZm-IB_RL_7CTsY,29373
86
86
  langroid/parsing/routing.py,sha256=-FcnlqldzL4ZoxuDwXjQPNHgBe9F9-F4R6q7b_z9CvI,1232
87
87
  langroid/parsing/search.py,sha256=0i_r0ESb5HEQfagA2g7_uMQyxYPADWVbdcN9ixZhS4E,8992
@@ -121,7 +121,7 @@ langroid/vector_store/lancedb.py,sha256=b3_vWkTjG8mweZ7ZNlUD-NjmQP_rLBZfyKWcxt2v
121
121
  langroid/vector_store/meilisearch.py,sha256=6frB7GFWeWmeKzRfLZIvzRjllniZ1cYj3HmhHQICXLs,11663
122
122
  langroid/vector_store/momento.py,sha256=UNHGT6jXuQtqY9f6MdqGU14bVnS0zHgIJUa30ULpUJo,10474
123
123
  langroid/vector_store/qdrantdb.py,sha256=HRLCt-FG8y4718omwpFaQZnWeYxPj0XCwS4tjokI1sU,18116
124
- langroid-0.34.0.dist-info/METADATA,sha256=fo7ULfjnWFED6Cag8aUFjOaPqEatQKBXEz-Z_rFyHnk,59015
125
- langroid-0.34.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
126
- langroid-0.34.0.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
127
- langroid-0.34.0.dist-info/RECORD,,
124
+ langroid-0.34.1.dist-info/METADATA,sha256=_sKdjcKkVQBqsbSe4p79aSmHTjZ1ClwX9GXO1Fn15y0,59313
125
+ langroid-0.34.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
126
+ langroid-0.34.1.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
127
+ langroid-0.34.1.dist-info/RECORD,,