langroid 0.22.1__tar.gz → 0.22.2__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.22.1 → langroid-0.22.2}/PKG-INFO +1 -1
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/base.py +14 -4
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/task.py +4 -4
- {langroid-0.22.1 → langroid-0.22.2}/pyproject.toml +1 -1
- {langroid-0.22.1 → langroid-0.22.2}/LICENSE +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/README.md +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/batch.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/callbacks/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/callbacks/chainlit.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/chat_agent.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/chat_document.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/helpers.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/junk +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/openai_assistant.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/arangodb/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/arangodb/arangodb_agent.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/arangodb/system_messages.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/arangodb/tools.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/arangodb/utils.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/doc_chat_agent.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/lance_doc_chat_agent.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/lance_rag/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/lance_rag/critic_agent.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/lance_rag/lance_rag_task.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/lance_rag/query_planner_agent.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/lance_tools.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/neo4j/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/neo4j/csv_kg_chat.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/neo4j/neo4j_chat_agent.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/neo4j/system_messages.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/neo4j/tools.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/relevance_extractor_agent.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/retriever_agent.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/sql/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/sql/sql_chat_agent.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/sql/utils/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/sql/utils/description_extractors.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/sql/utils/populate_metadata.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/sql/utils/system_message.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/sql/utils/tools.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/special/table_chat_agent.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/structured_message.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/tool_message.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/tools/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/tools/duckduckgo_search_tool.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/tools/file_tools.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/tools/google_search_tool.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/tools/metaphor_search_tool.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/tools/orchestration.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/tools/recipient_tool.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/tools/retrieval_tool.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/tools/rewind_tool.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/tools/segment_extract_tool.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/typed_task.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent/xml_tool_message.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/agent_config.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/cachedb/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/cachedb/base.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/cachedb/momento_cachedb.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/cachedb/redis_cachedb.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/embedding_models/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/embedding_models/base.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/embedding_models/clustering.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/embedding_models/models.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/embedding_models/protoc/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/embedding_models/protoc/embeddings.proto +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/embedding_models/protoc/embeddings_pb2.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/embedding_models/protoc/embeddings_pb2.pyi +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/embedding_models/protoc/embeddings_pb2_grpc.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/embedding_models/remote_embeds.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/exceptions.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/.chainlit/config.toml +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/.chainlit/translations/en-US.json +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/azure_openai.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/base.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/config.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/mock_lm.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/openai_gpt.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/prompt_formatter/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/prompt_formatter/base.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/prompt_formatter/hf_formatter.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/prompt_formatter/llama2_formatter.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/utils.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/mytypes.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/agent_chats.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/code-parsing.md +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/code_parser.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/config.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/document_parser.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/image_text.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/para_sentence_split.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/parse_json.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/parser.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/repo_loader.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/routing.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/search.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/spider.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/table_loader.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/url_loader.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/url_loader_cookies.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/urls.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/utils.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/parsing/web_search.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/prompts/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/prompts/chat-gpt4-system-prompt.md +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/prompts/dialog.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/prompts/prompts_config.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/prompts/templates.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/py.typed +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/pydantic_v1/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/pydantic_v1/main.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/.chainlit/config.toml +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/.chainlit/translations/en-US.json +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/algorithms/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/algorithms/graph.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/configuration.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/constants.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/docker.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/git_utils.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/globals.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/llms/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/llms/strings.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/logging.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/object_registry.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/output/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/output/citations.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/output/printing.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/output/status.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/pandas_utils.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/pydantic_utils.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/system.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/types.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/web/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/utils/web/login.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/vector_store/__init__.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/vector_store/base.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/vector_store/chromadb.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/vector_store/lancedb.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/vector_store/meilisearch.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/vector_store/momento.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/vector_store/qdrant_cloud.py +0 -0
- {langroid-0.22.1 → langroid-0.22.2}/langroid/vector_store/qdrantdb.py +0 -0
@@ -703,7 +703,7 @@ class Agent(ABC):
|
|
703
703
|
if self.llm is None:
|
704
704
|
return False
|
705
705
|
|
706
|
-
if message is not None and len(self.
|
706
|
+
if message is not None and len(self.try_get_tool_messages(message)) > 0:
|
707
707
|
# if there is a valid "tool" message (either JSON or via `function_call`)
|
708
708
|
# then LLM cannot respond to it
|
709
709
|
return False
|
@@ -717,7 +717,7 @@ class Agent(ABC):
|
|
717
717
|
Args:
|
718
718
|
message (str|ChatDocument): message or ChatDocument object to respond to.
|
719
719
|
"""
|
720
|
-
tools = self.
|
720
|
+
tools = self.try_get_tool_messages(message)
|
721
721
|
if len(tools) == 0 and self.config.respond_tools_only:
|
722
722
|
return False
|
723
723
|
if message is not None and self.has_only_unhandled_tools(message):
|
@@ -915,11 +915,21 @@ class Agent(ABC):
|
|
915
915
|
"""
|
916
916
|
if msg is None:
|
917
917
|
return False
|
918
|
-
tools = self.
|
918
|
+
tools = self.try_get_tool_messages(msg, all_tools=True)
|
919
919
|
if len(tools) == 0:
|
920
920
|
return False
|
921
921
|
return all(not self._tool_recipient_match(t) for t in tools)
|
922
922
|
|
923
|
+
def try_get_tool_messages(
|
924
|
+
self,
|
925
|
+
msg: str | ChatDocument | None,
|
926
|
+
all_tools: bool = False,
|
927
|
+
) -> List[ToolMessage]:
|
928
|
+
try:
|
929
|
+
return self.get_tool_messages(msg, all_tools)
|
930
|
+
except ValidationError:
|
931
|
+
return []
|
932
|
+
|
923
933
|
def get_tool_messages(
|
924
934
|
self,
|
925
935
|
msg: str | ChatDocument | None,
|
@@ -1417,7 +1427,7 @@ class Agent(ABC):
|
|
1417
1427
|
if content_any is not None and isinstance(content_any, output_type):
|
1418
1428
|
return cast(T, content_any)
|
1419
1429
|
|
1420
|
-
tools = self.
|
1430
|
+
tools = self.try_get_tool_messages(msg, all_tools=True)
|
1421
1431
|
|
1422
1432
|
if get_origin(output_type) is list:
|
1423
1433
|
list_element_type = get_args(output_type)[0]
|
@@ -1314,7 +1314,7 @@ class Task:
|
|
1314
1314
|
actual_turns = e.turns if e.turns > 0 else turns
|
1315
1315
|
e.agent.callbacks.set_parent_agent(self.agent)
|
1316
1316
|
# e.callbacks.set_parent_agent(self.agent)
|
1317
|
-
pending_tools = self.agent.
|
1317
|
+
pending_tools = self.agent.try_get_tool_messages(self.pending_message)
|
1318
1318
|
# TODO disable this
|
1319
1319
|
if (
|
1320
1320
|
len(pending_tools) > 1
|
@@ -1332,7 +1332,7 @@ class Task:
|
|
1332
1332
|
)
|
1333
1333
|
# update result.tool_messages if any
|
1334
1334
|
if isinstance(result, ChatDocument):
|
1335
|
-
self.agent.
|
1335
|
+
self.agent.try_get_tool_messages(result)
|
1336
1336
|
if result is not None:
|
1337
1337
|
content, id2result, oai_tool_id = self.agent.process_tool_results(
|
1338
1338
|
result.content,
|
@@ -1363,7 +1363,7 @@ class Task:
|
|
1363
1363
|
result = response_fn(self.pending_message)
|
1364
1364
|
# update result.tool_messages if any
|
1365
1365
|
if isinstance(result, ChatDocument):
|
1366
|
-
self.agent.
|
1366
|
+
self.agent.try_get_tool_messages(result)
|
1367
1367
|
|
1368
1368
|
result_chat_doc = self.agent.to_ChatDocument(
|
1369
1369
|
result,
|
@@ -1446,7 +1446,7 @@ class Task:
|
|
1446
1446
|
if isinstance(e, Task):
|
1447
1447
|
actual_turns = e.turns if e.turns > 0 else turns
|
1448
1448
|
e.agent.callbacks.set_parent_agent(self.agent)
|
1449
|
-
pending_tools = self.agent.
|
1449
|
+
pending_tools = self.agent.try_get_tool_messages(self.pending_message)
|
1450
1450
|
# TODO disable this
|
1451
1451
|
if (
|
1452
1452
|
len(pending_tools) > 1
|
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.22.1 → langroid-0.22.2}/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
|
{langroid-0.22.1 → langroid-0.22.2}/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
|
File without changes
|
File without changes
|
{langroid-0.22.1 → langroid-0.22.2}/langroid/language_models/prompt_formatter/hf_formatter.py
RENAMED
File without changes
|
{langroid-0.22.1 → langroid-0.22.2}/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
|
File without changes
|
File without changes
|