langroid 0.16.3__tar.gz → 0.16.5__tar.gz
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-0.16.3 → langroid-0.16.5}/PKG-INFO +2 -2
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/base.py +2 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/openai_gpt.py +7 -2
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/parse_json.py +32 -71
- {langroid-0.16.3 → langroid-0.16.5}/pyproject.toml +2 -2
- {langroid-0.16.3 → langroid-0.16.5}/LICENSE +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/README.md +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/base.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/batch.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/callbacks/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/callbacks/chainlit.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/chat_agent.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/chat_document.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/helpers.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/junk +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/openai_assistant.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/doc_chat_agent.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/lance_doc_chat_agent.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/lance_rag/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/lance_rag/critic_agent.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/lance_rag/lance_rag_task.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/lance_rag/query_planner_agent.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/lance_tools.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/neo4j/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/neo4j/csv_kg_chat.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/neo4j/neo4j_chat_agent.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/neo4j/utils/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/neo4j/utils/system_message.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/relevance_extractor_agent.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/retriever_agent.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/sql/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/sql/sql_chat_agent.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/sql/utils/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/sql/utils/description_extractors.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/sql/utils/populate_metadata.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/sql/utils/system_message.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/sql/utils/tools.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/table_chat_agent.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/structured_message.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/task.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tool_message.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/duckduckgo_search_tool.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/extract_tool.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/generator_tool.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/google_search_tool.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/metaphor_search_tool.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/note_tool.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/orchestration.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/recipient_tool.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/retrieval_tool.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/rewind_tool.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/run_python_code.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/tools/segment_extract_tool.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent/typed_task.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/agent_config.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/cachedb/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/cachedb/base.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/cachedb/momento_cachedb.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/cachedb/redis_cachedb.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/embedding_models/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/embedding_models/base.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/embedding_models/clustering.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/embedding_models/models.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/embedding_models/protoc/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/embedding_models/protoc/embeddings.proto +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/embedding_models/protoc/embeddings_pb2.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/embedding_models/protoc/embeddings_pb2.pyi +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/embedding_models/protoc/embeddings_pb2_grpc.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/embedding_models/remote_embeds.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/exceptions.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/.chainlit/config.toml +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/.chainlit/translations/en-US.json +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/azure_openai.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/config.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/mock_lm.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/prompt_formatter/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/prompt_formatter/base.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/prompt_formatter/hf_formatter.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/prompt_formatter/llama2_formatter.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/utils.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/mytypes.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/agent_chats.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/code-parsing.md +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/code_parser.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/config.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/document_parser.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/image_text.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/para_sentence_split.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/parser.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/repo_loader.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/routing.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/search.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/spider.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/table_loader.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/url_loader.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/url_loader_cookies.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/urls.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/utils.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/parsing/web_search.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/prompts/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/prompts/chat-gpt4-system-prompt.md +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/prompts/dialog.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/prompts/prompts_config.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/prompts/templates.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/py.typed +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/pydantic_v1/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/pydantic_v1/main.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/.chainlit/config.toml +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/.chainlit/translations/en-US.json +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/algorithms/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/algorithms/graph.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/configuration.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/constants.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/docker.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/globals.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/llms/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/llms/strings.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/logging.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/object_registry.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/output/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/output/citations.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/output/printing.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/output/status.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/pandas_utils.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/pydantic_utils.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/system.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/types.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/web/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/utils/web/login.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/vector_store/__init__.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/vector_store/base.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/vector_store/chromadb.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/vector_store/lancedb.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/vector_store/meilisearch.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/vector_store/momento.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/vector_store/qdrant_cloud.py +0 -0
- {langroid-0.16.3 → langroid-0.16.5}/langroid/vector_store/qdrantdb.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: langroid
|
3
|
-
Version: 0.16.
|
3
|
+
Version: 0.16.5
|
4
4
|
Summary: Harness LLMs with Multi-Agent Programming
|
5
5
|
License: MIT
|
6
6
|
Author: Prasad Chalasani
|
@@ -55,7 +55,7 @@ Requires-Dist: grpcio (>=1.62.1,<2.0.0)
|
|
55
55
|
Requires-Dist: halo (>=0.0.31,<0.0.32)
|
56
56
|
Requires-Dist: huggingface-hub (>=0.21.2,<0.22.0) ; extra == "hf-transformers" or extra == "all" or extra == "transformers"
|
57
57
|
Requires-Dist: jinja2 (>=3.1.2,<4.0.0)
|
58
|
-
Requires-Dist: json-repair (>=0.
|
58
|
+
Requires-Dist: json-repair (>=0.29.0,<0.30.0)
|
59
59
|
Requires-Dist: lancedb (>=0.8.2,<0.9.0) ; extra == "vecdbs" or extra == "lancedb"
|
60
60
|
Requires-Dist: litellm (>=1.30.1,<2.0.0) ; extra == "all" or extra == "litellm"
|
61
61
|
Requires-Dist: lxml (>=4.9.3,<5.0.0)
|
@@ -219,6 +219,8 @@ class LLMMessage(BaseModel):
|
|
219
219
|
# in case has_system_role is False
|
220
220
|
if not has_system_role and "role" in d and d["role"] == "system":
|
221
221
|
d["role"] = "user"
|
222
|
+
if "content" in d:
|
223
|
+
d["content"] = "[ADDITIONAL SYSTEM MESSAGE:]\n\n" + d["content"]
|
222
224
|
# drop None values since API doesn't accept them
|
223
225
|
dict_no_none = {k: v for k, v in d.items() if v is not None}
|
224
226
|
if "name" in dict_no_none and dict_no_none["name"] == "":
|
@@ -1123,8 +1123,13 @@ class OpenAIGPT(LanguageModel):
|
|
1123
1123
|
) -> LLMTokenUsage:
|
1124
1124
|
"""
|
1125
1125
|
Extracts token usage from ``response`` and computes cost, only when NOT
|
1126
|
-
in streaming mode, since the LLM API (OpenAI currently)
|
1127
|
-
usage fields in streaming mode
|
1126
|
+
in streaming mode, since the LLM API (OpenAI currently) was not
|
1127
|
+
populating the usage fields in streaming mode (but as of Sep 2024, streaming
|
1128
|
+
responses include usage info as well, so we should update the code
|
1129
|
+
to directly use usage information from the streaming response, which is more
|
1130
|
+
accurate, esp with "thinking" LLMs like o1 series which consume
|
1131
|
+
thinking tokens).
|
1132
|
+
In streaming mode, these are set to zero for
|
1128
1133
|
now, and will be updated later by the fn ``update_token_usage``.
|
1129
1134
|
"""
|
1130
1135
|
cost = 0.0
|
@@ -4,6 +4,7 @@ from datetime import datetime
|
|
4
4
|
from typing import Any, Dict, Iterator, List, Union
|
5
5
|
|
6
6
|
import yaml
|
7
|
+
from json_repair import repair_json
|
7
8
|
from pyparsing import nestedExpr, originalTextFor
|
8
9
|
|
9
10
|
|
@@ -47,34 +48,6 @@ def get_json_candidates(s: str) -> List[str]:
|
|
47
48
|
return []
|
48
49
|
|
49
50
|
|
50
|
-
def add_quotes(s: str) -> str:
|
51
|
-
"""
|
52
|
-
Replace accidentally un-quoted string-like keys and values in a potential json str.
|
53
|
-
Intended to handle cases where a weak LLM may produce a JSON-like string
|
54
|
-
containing, e.g. "rent": DO-NOT-KNOW, where it "forgot" to put quotes on the value,
|
55
|
-
or city: "New York" where it "forgot" to put quotes on the key.
|
56
|
-
It will even handle cases like 'address: do not know'.
|
57
|
-
|
58
|
-
Got this fiendishly clever solution from
|
59
|
-
https://stackoverflow.com/a/66053900/10940584
|
60
|
-
Far better/safer than trying to do it with regexes.
|
61
|
-
|
62
|
-
Args:
|
63
|
-
- s (str): The potential JSON string to parse.
|
64
|
-
|
65
|
-
Returns:
|
66
|
-
- str: The (potential) JSON string with un-quoted string-like values
|
67
|
-
replaced by quoted values.
|
68
|
-
"""
|
69
|
-
if is_valid_json(s):
|
70
|
-
return s
|
71
|
-
try:
|
72
|
-
dct = yaml.load(s, yaml.SafeLoader)
|
73
|
-
return json.dumps(dct)
|
74
|
-
except Exception:
|
75
|
-
return s
|
76
|
-
|
77
|
-
|
78
51
|
def parse_imperfect_json(json_string: str) -> Union[Dict[str, Any], List[Any]]:
|
79
52
|
if not json_string.strip():
|
80
53
|
raise ValueError("Empty string is not valid JSON")
|
@@ -87,13 +60,11 @@ def parse_imperfect_json(json_string: str) -> Union[Dict[str, Any], List[Any]]:
|
|
87
60
|
except (ValueError, SyntaxError):
|
88
61
|
pass
|
89
62
|
|
90
|
-
# If ast.literal_eval fails or returns non-dict/list, try
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
return result
|
96
|
-
except json.JSONDecodeError:
|
63
|
+
# If ast.literal_eval fails or returns non-dict/list, try repair_json
|
64
|
+
json_repaired_obj = repair_json(json_string, return_objects=True)
|
65
|
+
if isinstance(json_repaired_obj, (dict, list)):
|
66
|
+
return json_repaired_obj
|
67
|
+
else:
|
97
68
|
try:
|
98
69
|
# fallback on yaml
|
99
70
|
yaml_result = yaml.safe_load(json_string)
|
@@ -102,39 +73,38 @@ def parse_imperfect_json(json_string: str) -> Union[Dict[str, Any], List[Any]]:
|
|
102
73
|
except yaml.YAMLError:
|
103
74
|
pass
|
104
75
|
|
105
|
-
try:
|
106
|
-
# last resort: try to repair the json using a lib
|
107
|
-
from json_repair import repair_json
|
108
|
-
|
109
|
-
repaired_json = repair_json(json_string)
|
110
|
-
result = json.loads(repaired_json)
|
111
|
-
if isinstance(result, (dict, list)):
|
112
|
-
return result
|
113
|
-
except Exception:
|
114
|
-
pass
|
115
|
-
|
116
76
|
# If all methods fail, raise ValueError
|
117
77
|
raise ValueError(f"Unable to parse as JSON: {json_string}")
|
118
78
|
|
119
79
|
|
120
|
-
def
|
80
|
+
def try_repair_json_yaml(s: str) -> str | None:
|
121
81
|
"""
|
122
|
-
Attempt to load as json, and if it fails, try
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
These would not be valid JSON, so we try to clean them up here.
|
82
|
+
Attempt to load as json, and if it fails, try repairing the JSON.
|
83
|
+
If that fails, replace any \n with space as a last resort.
|
84
|
+
NOTE - replacing \n with space will result in format loss,
|
85
|
+
which may matter in generated code (e.g. python, toml, etc)
|
127
86
|
"""
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
87
|
+
s_repaired_obj = repair_json(s, return_objects=True)
|
88
|
+
if isinstance(s_repaired_obj, list):
|
89
|
+
if len(s_repaired_obj) > 0:
|
90
|
+
s_repaired_obj = s_repaired_obj[0]
|
91
|
+
else:
|
92
|
+
s_repaired_obj = None
|
93
|
+
if s_repaired_obj is not None:
|
94
|
+
return json.dumps(s_repaired_obj) # type: ignore
|
95
|
+
else:
|
132
96
|
try:
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
except
|
97
|
+
yaml_result = yaml.safe_load(s)
|
98
|
+
if isinstance(yaml_result, dict):
|
99
|
+
return json.dumps(yaml_result)
|
100
|
+
except yaml.YAMLError:
|
101
|
+
pass
|
102
|
+
# If it still fails, replace any \n with space as a last resort
|
103
|
+
s = s.replace("\n", " ")
|
104
|
+
if is_valid_json(s):
|
137
105
|
return s
|
106
|
+
else:
|
107
|
+
return None # all failed
|
138
108
|
|
139
109
|
|
140
110
|
def extract_top_level_json(s: str) -> List[str]:
|
@@ -148,18 +118,9 @@ def extract_top_level_json(s: str) -> List[str]:
|
|
148
118
|
"""
|
149
119
|
# Find JSON object and array candidates
|
150
120
|
json_candidates = get_json_candidates(s)
|
121
|
+
maybe_repaired_jsons = map(try_repair_json_yaml, json_candidates)
|
151
122
|
|
152
|
-
|
153
|
-
candidate.replace("\\{", "{").replace("\\}", "}").replace("\\_", "_")
|
154
|
-
for candidate in json_candidates
|
155
|
-
]
|
156
|
-
candidates = [add_quotes(candidate) for candidate in normalized_candidates]
|
157
|
-
candidates = [repair_newlines(candidate) for candidate in candidates]
|
158
|
-
top_level_jsons = [
|
159
|
-
candidate for candidate in candidates if is_valid_json(candidate)
|
160
|
-
]
|
161
|
-
|
162
|
-
return top_level_jsons
|
123
|
+
return [candidate for candidate in maybe_repaired_jsons if candidate is not None]
|
163
124
|
|
164
125
|
|
165
126
|
def top_level_json_field(s: str, f: str) -> Any:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "langroid"
|
3
|
-
version = "0.16.
|
3
|
+
version = "0.16.5"
|
4
4
|
description = "Harness LLMs with Multi-Agent Programming"
|
5
5
|
authors = ["Prasad Chalasani <pchalasani@gmail.com>"]
|
6
6
|
readme = "README.md"
|
@@ -87,7 +87,7 @@ nest-asyncio = "^1.6.0"
|
|
87
87
|
async-generator = "^1.10"
|
88
88
|
|
89
89
|
python-magic = "^0.4.27"
|
90
|
-
json-repair = "^0.
|
90
|
+
json-repair = "^0.29.0"
|
91
91
|
cerebras-cloud-sdk = "^1.1.0"
|
92
92
|
|
93
93
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langroid-0.16.3 → langroid-0.16.5}/langroid/agent/special/sql/utils/description_extractors.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/.chainlit/translations/en-US.json
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/prompt_formatter/hf_formatter.py
RENAMED
File without changes
|
{langroid-0.16.3 → langroid-0.16.5}/langroid/language_models/prompt_formatter/llama2_formatter.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|