langroid 0.33.11__tar.gz → 0.33.13__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.33.11 → langroid-0.33.13}/PKG-INFO +1 -1
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/callbacks/chainlit.py +5 -4
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/doc_chat_agent.py +6 -2
- {langroid-0.33.11 → langroid-0.33.13}/langroid/language_models/__init__.py +2 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/language_models/base.py +8 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/language_models/openai_gpt.py +17 -10
- {langroid-0.33.11 → langroid-0.33.13}/langroid/mytypes.py +10 -0
- {langroid-0.33.11 → langroid-0.33.13}/pyproject.toml +1 -1
- {langroid-0.33.11 → langroid-0.33.13}/.gitignore +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/LICENSE +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/README.md +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/base.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/batch.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/callbacks/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/chat_agent.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/chat_document.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/openai_assistant.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/arangodb/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/arangodb/arangodb_agent.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/arangodb/system_messages.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/arangodb/tools.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/arangodb/utils.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/lance_doc_chat_agent.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/lance_rag/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/lance_rag/critic_agent.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/lance_rag/lance_rag_task.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/lance_rag/query_planner_agent.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/lance_tools.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/neo4j/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/neo4j/csv_kg_chat.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/neo4j/neo4j_chat_agent.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/neo4j/system_messages.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/neo4j/tools.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/relevance_extractor_agent.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/retriever_agent.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/sql/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/sql/sql_chat_agent.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/sql/utils/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/sql/utils/description_extractors.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/sql/utils/populate_metadata.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/sql/utils/system_message.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/sql/utils/tools.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/special/table_chat_agent.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/task.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/tool_message.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/tools/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/tools/duckduckgo_search_tool.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/tools/file_tools.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/tools/google_search_tool.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/tools/metaphor_search_tool.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/tools/orchestration.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/tools/recipient_tool.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/tools/retrieval_tool.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/tools/rewind_tool.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/tools/segment_extract_tool.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/agent/xml_tool_message.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/cachedb/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/cachedb/base.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/cachedb/momento_cachedb.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/cachedb/redis_cachedb.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/embedding_models/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/embedding_models/base.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/embedding_models/models.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/embedding_models/protoc/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/embedding_models/protoc/embeddings.proto +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/embedding_models/protoc/embeddings_pb2.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/embedding_models/protoc/embeddings_pb2.pyi +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/embedding_models/protoc/embeddings_pb2_grpc.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/embedding_models/remote_embeds.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/exceptions.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/language_models/azure_openai.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/language_models/config.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/language_models/mock_lm.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/language_models/prompt_formatter/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/language_models/prompt_formatter/base.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/language_models/prompt_formatter/hf_formatter.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/language_models/prompt_formatter/llama2_formatter.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/language_models/utils.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/agent_chats.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/code_parser.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/document_parser.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/para_sentence_split.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/parse_json.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/parser.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/repo_loader.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/routing.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/search.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/spider.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/table_loader.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/url_loader.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/urls.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/utils.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/parsing/web_search.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/prompts/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/prompts/dialog.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/prompts/prompts_config.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/prompts/templates.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/py.typed +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/pydantic_v1/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/pydantic_v1/main.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/algorithms/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/algorithms/graph.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/configuration.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/constants.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/git_utils.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/globals.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/logging.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/object_registry.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/output/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/output/citations.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/output/printing.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/output/status.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/pandas_utils.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/pydantic_utils.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/system.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/utils/types.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/vector_store/__init__.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/vector_store/base.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/vector_store/chromadb.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/vector_store/lancedb.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/vector_store/meilisearch.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/vector_store/momento.py +0 -0
- {langroid-0.33.11 → langroid-0.33.13}/langroid/vector_store/qdrantdb.py +0 -0
@@ -20,6 +20,7 @@ from chainlit.logger import logger
|
|
20
20
|
|
21
21
|
import langroid as lr
|
22
22
|
import langroid.language_models as lm
|
23
|
+
from langroid.language_models import StreamEventType
|
23
24
|
from langroid.utils.configuration import settings
|
24
25
|
from langroid.utils.constants import NO_ANSWER
|
25
26
|
|
@@ -276,7 +277,7 @@ class ChainlitAgentCallbacks:
|
|
276
277
|
def get_last_step(self) -> Optional[cl.Step]:
|
277
278
|
return self.last_step
|
278
279
|
|
279
|
-
def start_llm_stream(self) -> Callable[[str], None]:
|
280
|
+
def start_llm_stream(self) -> Callable[[str, StreamEventType], None]:
|
280
281
|
"""Returns a streaming fn that can be passed to the LLM class"""
|
281
282
|
self.stream = cl.Message(
|
282
283
|
content="",
|
@@ -295,14 +296,14 @@ class ChainlitAgentCallbacks:
|
|
295
296
|
"""
|
296
297
|
)
|
297
298
|
|
298
|
-
def stream_token(t: str) -> None:
|
299
|
+
def stream_token(t: str, e: StreamEventType) -> None:
|
299
300
|
if self.stream is None:
|
300
301
|
raise ValueError("Stream not initialized")
|
301
302
|
run_sync(self.stream.stream_token(t))
|
302
303
|
|
303
304
|
return stream_token
|
304
305
|
|
305
|
-
async def start_llm_stream_async(self) -> Callable[[str], None]:
|
306
|
+
async def start_llm_stream_async(self) -> Callable[[str, StreamEventType], None]:
|
306
307
|
"""Returns a streaming fn that can be passed to the LLM class"""
|
307
308
|
self.stream = cl.Message(
|
308
309
|
content="",
|
@@ -321,7 +322,7 @@ class ChainlitAgentCallbacks:
|
|
321
322
|
"""
|
322
323
|
)
|
323
324
|
|
324
|
-
async def stream_token(t: str) -> None:
|
325
|
+
async def stream_token(t: str, e: StreamEventType) -> None:
|
325
326
|
if self.stream is None:
|
326
327
|
raise ValueError("Stream not initialized")
|
327
328
|
await self.stream.stream_token(t)
|
@@ -1143,20 +1143,22 @@ class DocChatAgent(ChatAgent):
|
|
1143
1143
|
id2_rank_semantic = {d.id(): i for i, (d, _) in enumerate(docs_and_scores)}
|
1144
1144
|
id2doc = {d.id(): d for d, _ in docs_and_scores}
|
1145
1145
|
# make sure we get unique docs
|
1146
|
-
passages = [id2doc[id] for id
|
1146
|
+
passages = [id2doc[id] for id in id2_rank_semantic.keys()]
|
1147
1147
|
|
1148
1148
|
id2_rank_bm25 = {}
|
1149
1149
|
if self.config.use_bm25_search:
|
1150
1150
|
# TODO: Add score threshold in config
|
1151
1151
|
docs_scores = self.get_similar_chunks_bm25(query, retrieval_multiple)
|
1152
|
+
id2doc.update({d.id(): d for d, _ in docs_scores})
|
1152
1153
|
if self.config.cross_encoder_reranking_model == "":
|
1153
1154
|
# only if we're not re-ranking with a cross-encoder,
|
1154
1155
|
# we collect these ranks for Reciprocal Rank Fusion down below.
|
1155
1156
|
docs_scores = sorted(docs_scores, key=lambda x: x[1], reverse=True)
|
1156
1157
|
id2_rank_bm25 = {d.id(): i for i, (d, _) in enumerate(docs_scores)}
|
1157
|
-
id2doc.update({d.id(): d for d, _ in docs_scores})
|
1158
1158
|
else:
|
1159
1159
|
passages += [d for (d, _) in docs_scores]
|
1160
|
+
# eliminate duplicate ids
|
1161
|
+
passages = [id2doc[id] for id in id2doc.keys()]
|
1160
1162
|
|
1161
1163
|
id2_rank_fuzzy = {}
|
1162
1164
|
if self.config.use_fuzzy_match:
|
@@ -1174,6 +1176,8 @@ class DocChatAgent(ChatAgent):
|
|
1174
1176
|
id2doc.update({d.id(): d for d, _ in fuzzy_match_doc_scores})
|
1175
1177
|
else:
|
1176
1178
|
passages += [d for (d, _) in fuzzy_match_doc_scores]
|
1179
|
+
# eliminate duplicate ids
|
1180
|
+
passages = [id2doc[id] for id in id2doc.keys()]
|
1177
1181
|
|
1178
1182
|
if (
|
1179
1183
|
self.config.cross_encoder_reranking_model == ""
|
@@ -6,6 +6,7 @@ from . import azure_openai
|
|
6
6
|
from . import prompt_formatter
|
7
7
|
|
8
8
|
from .base import (
|
9
|
+
StreamEventType,
|
9
10
|
LLMConfig,
|
10
11
|
LLMMessage,
|
11
12
|
LLMFunctionCall,
|
@@ -33,6 +34,7 @@ __all__ = [
|
|
33
34
|
"openai_gpt",
|
34
35
|
"azure_openai",
|
35
36
|
"prompt_formatter",
|
37
|
+
"StreamEventType",
|
36
38
|
"LLMConfig",
|
37
39
|
"LLMMessage",
|
38
40
|
"LLMFunctionCall",
|
@@ -42,6 +42,14 @@ ToolChoiceTypes = Literal["none", "auto", "required"]
|
|
42
42
|
ToolTypes = Literal["function"]
|
43
43
|
|
44
44
|
|
45
|
+
class StreamEventType(Enum):
|
46
|
+
TEXT = 1
|
47
|
+
FUNC_NAME = 2
|
48
|
+
FUNC_ARGS = 3
|
49
|
+
TOOL_NAME = 4
|
50
|
+
TOOL_ARGS = 5
|
51
|
+
|
52
|
+
|
45
53
|
class LLMConfig(BaseSettings):
|
46
54
|
"""
|
47
55
|
Common configuration for all language models.
|
@@ -43,6 +43,7 @@ from langroid.language_models.base import (
|
|
43
43
|
OpenAIToolCall,
|
44
44
|
OpenAIToolSpec,
|
45
45
|
Role,
|
46
|
+
StreamEventType,
|
46
47
|
ToolChoiceTypes,
|
47
48
|
)
|
48
49
|
from langroid.language_models.config import HFPromptFormatterConfig
|
@@ -875,19 +876,19 @@ class OpenAIGPT(LanguageModel):
|
|
875
876
|
completion += event_text
|
876
877
|
sys.stdout.write(Colors().GREEN + event_text)
|
877
878
|
sys.stdout.flush()
|
878
|
-
self.config.streamer(event_text)
|
879
|
+
self.config.streamer(event_text, StreamEventType.TEXT)
|
879
880
|
if event_fn_name:
|
880
881
|
function_name = event_fn_name
|
881
882
|
has_function = True
|
882
883
|
sys.stdout.write(Colors().GREEN + "FUNC: " + event_fn_name + ": ")
|
883
884
|
sys.stdout.flush()
|
884
|
-
self.config.streamer(event_fn_name)
|
885
|
+
self.config.streamer(event_fn_name, StreamEventType.FUNC_NAME)
|
885
886
|
|
886
887
|
if event_args:
|
887
888
|
function_args += event_args
|
888
889
|
sys.stdout.write(Colors().GREEN + event_args)
|
889
890
|
sys.stdout.flush()
|
890
|
-
self.config.streamer(event_args)
|
891
|
+
self.config.streamer(event_args, StreamEventType.FUNC_ARGS)
|
891
892
|
|
892
893
|
if event_tool_deltas is not None:
|
893
894
|
# print out streaming tool calls, if not async
|
@@ -898,12 +899,12 @@ class OpenAIGPT(LanguageModel):
|
|
898
899
|
Colors().GREEN + "OAI-TOOL: " + tool_fn_name + ": "
|
899
900
|
)
|
900
901
|
sys.stdout.flush()
|
901
|
-
self.config.streamer(tool_fn_name)
|
902
|
+
self.config.streamer(tool_fn_name, StreamEventType.TOOL_NAME)
|
902
903
|
if td["function"]["arguments"] != "":
|
903
904
|
tool_fn_args = td["function"]["arguments"]
|
904
905
|
sys.stdout.write(Colors().GREEN + tool_fn_args)
|
905
906
|
sys.stdout.flush()
|
906
|
-
self.config.streamer(tool_fn_args)
|
907
|
+
self.config.streamer(tool_fn_args, StreamEventType.TOOL_ARGS)
|
907
908
|
|
908
909
|
# show this delta in the stream
|
909
910
|
if finish_reason in [
|
@@ -968,21 +969,23 @@ class OpenAIGPT(LanguageModel):
|
|
968
969
|
if not silent:
|
969
970
|
sys.stdout.write(Colors().GREEN + event_text)
|
970
971
|
sys.stdout.flush()
|
971
|
-
await self.config.streamer_async(event_text)
|
972
|
+
await self.config.streamer_async(event_text, StreamEventType.TEXT)
|
972
973
|
if event_fn_name:
|
973
974
|
function_name = event_fn_name
|
974
975
|
has_function = True
|
975
976
|
if not silent:
|
976
977
|
sys.stdout.write(Colors().GREEN + "FUNC: " + event_fn_name + ": ")
|
977
978
|
sys.stdout.flush()
|
978
|
-
await self.config.streamer_async(
|
979
|
+
await self.config.streamer_async(
|
980
|
+
event_fn_name, StreamEventType.FUNC_NAME
|
981
|
+
)
|
979
982
|
|
980
983
|
if event_args:
|
981
984
|
function_args += event_args
|
982
985
|
if not silent:
|
983
986
|
sys.stdout.write(Colors().GREEN + event_args)
|
984
987
|
sys.stdout.flush()
|
985
|
-
await self.config.streamer_async(event_args)
|
988
|
+
await self.config.streamer_async(event_args, StreamEventType.FUNC_ARGS)
|
986
989
|
|
987
990
|
if event_tool_deltas is not None and not silent:
|
988
991
|
# print out streaming tool calls, if not async
|
@@ -993,12 +996,16 @@ class OpenAIGPT(LanguageModel):
|
|
993
996
|
Colors().GREEN + "OAI-TOOL: " + tool_fn_name + ": "
|
994
997
|
)
|
995
998
|
sys.stdout.flush()
|
996
|
-
await self.config.streamer_async(
|
999
|
+
await self.config.streamer_async(
|
1000
|
+
tool_fn_name, StreamEventType.TOOL_NAME
|
1001
|
+
)
|
997
1002
|
if td["function"]["arguments"] != "":
|
998
1003
|
tool_fn_args = td["function"]["arguments"]
|
999
1004
|
sys.stdout.write(Colors().GREEN + tool_fn_args)
|
1000
1005
|
sys.stdout.flush()
|
1001
|
-
await self.config.streamer_async(
|
1006
|
+
await self.config.streamer_async(
|
1007
|
+
tool_fn_args, StreamEventType.TOOL_ARGS
|
1008
|
+
)
|
1002
1009
|
|
1003
1010
|
# show this delta in the stream
|
1004
1011
|
if choices[0].get("finish_reason", "") in [
|
@@ -75,6 +75,16 @@ class Document(BaseModel):
|
|
75
75
|
def id(self) -> str:
|
76
76
|
return self.metadata.id
|
77
77
|
|
78
|
+
def from_string(
|
79
|
+
content: str,
|
80
|
+
source: str = "context",
|
81
|
+
is_chunk: bool = True,
|
82
|
+
) -> "Document":
|
83
|
+
return Document(
|
84
|
+
content=content,
|
85
|
+
metadata=DocMetaData(source=source, is_chunk=is_chunk),
|
86
|
+
)
|
87
|
+
|
78
88
|
def __str__(self) -> str:
|
79
89
|
return dedent(
|
80
90
|
f"""
|
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.33.11 → langroid-0.33.13}/langroid/agent/special/lance_rag/query_planner_agent.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
|
{langroid-0.33.11 → langroid-0.33.13}/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
|
{langroid-0.33.11 → langroid-0.33.13}/langroid/embedding_models/protoc/embeddings_pb2_grpc.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
|
{langroid-0.33.11 → langroid-0.33.13}/langroid/language_models/prompt_formatter/hf_formatter.py
RENAMED
File without changes
|
{langroid-0.33.11 → langroid-0.33.13}/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
|