langchain-core 1.0.2__tar.gz → 1.0.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.
- {langchain_core-1.0.2 → langchain_core-1.0.5}/PKG-INFO +2 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/README.md +1 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/agents.py +39 -30
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/callbacks/base.py +1 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/callbacks/manager.py +19 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/callbacks/usage.py +4 -4
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/documents/base.py +6 -6
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/example_selectors/length_based.py +1 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/exceptions.py +12 -10
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/indexing/api.py +17 -14
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/language_models/_utils.py +1 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/language_models/base.py +50 -20
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/language_models/chat_models.py +83 -26
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/language_models/llms.py +66 -36
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/load/load.py +15 -9
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/ai.py +3 -3
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/base.py +4 -3
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/block_translators/__init__.py +2 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/block_translators/openai.py +2 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/content.py +2 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/utils.py +12 -8
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/output_parsers/openai_tools.py +14 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/outputs/chat_generation.py +4 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/outputs/generation.py +6 -5
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompt_values.py +2 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompts/base.py +50 -45
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompts/chat.py +35 -28
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompts/dict.py +1 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompts/message.py +5 -5
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompts/string.py +4 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/rate_limiters.py +3 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/base.py +98 -53
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/branch.py +22 -20
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/configurable.py +30 -29
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/fallbacks.py +23 -21
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/graph.py +1 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/graph_ascii.py +2 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/graph_mermaid.py +4 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/graph_png.py +28 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/history.py +43 -32
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/passthrough.py +35 -25
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/router.py +5 -5
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/schema.py +1 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/utils.py +3 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/sys_info.py +4 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tools/base.py +74 -59
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tools/convert.py +37 -25
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/core.py +6 -6
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/function_calling.py +11 -7
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/input.py +3 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/json.py +4 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/pydantic.py +5 -4
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/vectorstores/base.py +14 -14
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/vectorstores/in_memory.py +1 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/version.py +1 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/pyproject.toml +15 -9
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/callbacks/test_async_callback_manager.py +62 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/indexing/test_hashed_document.py +1 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/language_models/chat_models/test_base.py +108 -0
- langchain_core-1.0.5/tests/unit_tests/messages/block_translators/test_groq.py +140 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/output_parsers/test_openai_tools.py +459 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/__snapshots__/test_chat.ambr +6 -6
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/test_chat.py +347 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/pydantic_utils.py +1 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/__snapshots__/test_graph.ambr +3 -3
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr +24 -24
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/test_concurrency.py +4 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/test_runnable.py +34 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/test_tracing_interops.py +8 -4
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/test_tools.py +1 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/test_strings.py +1 -1
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/test_utils.py +4 -2
- {langchain_core-1.0.2 → langchain_core-1.0.5}/uv.lock +47 -3
- {langchain_core-1.0.2 → langchain_core-1.0.5}/.gitignore +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/Makefile +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/extended_testing_deps.txt +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/_api/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/_api/beta_decorator.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/_api/deprecation.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/_api/internal.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/_api/path.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/_import_utils.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/caches.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/callbacks/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/callbacks/file.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/callbacks/stdout.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/callbacks/streaming_stdout.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/chat_history.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/chat_loaders.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/chat_sessions.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/document_loaders/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/document_loaders/base.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/document_loaders/blob_loaders.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/document_loaders/langsmith.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/documents/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/documents/compressor.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/documents/transformers.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/embeddings/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/embeddings/embeddings.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/embeddings/fake.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/env.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/example_selectors/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/example_selectors/base.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/example_selectors/semantic_similarity.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/globals.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/indexing/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/indexing/base.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/indexing/in_memory.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/language_models/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/language_models/fake.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/language_models/fake_chat_models.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/load/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/load/dump.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/load/mapping.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/load/serializable.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/block_translators/anthropic.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/block_translators/bedrock.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/block_translators/bedrock_converse.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/block_translators/google_genai.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/block_translators/google_vertexai.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/block_translators/groq.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/block_translators/langchain_v0.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/chat.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/function.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/human.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/modifier.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/system.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/messages/tool.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/output_parsers/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/output_parsers/base.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/output_parsers/format_instructions.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/output_parsers/json.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/output_parsers/list.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/output_parsers/openai_functions.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/output_parsers/pydantic.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/output_parsers/string.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/output_parsers/transform.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/output_parsers/xml.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/outputs/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/outputs/chat_result.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/outputs/llm_result.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/outputs/run_info.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompts/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompts/few_shot.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompts/few_shot_with_templates.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompts/image.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompts/loading.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompts/prompt.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/prompts/structured.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/py.typed +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/retrievers.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/config.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/runnables/retry.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/stores.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/structured_query.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tools/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tools/render.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tools/retriever.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tools/simple.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tools/structured.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/_streaming.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/base.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/context.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/evaluation.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/event_stream.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/langchain.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/log_stream.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/memory_stream.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/root_listeners.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/run_collector.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/schemas.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/tracers/stdout.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/_merge.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/aiter.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/env.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/formatting.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/html.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/image.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/interactive_env.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/iter.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/json_schema.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/mustache.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/strings.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/usage.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/utils/utils.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/vectorstores/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/vectorstores/utils.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/scripts/check_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/scripts/lint_imports.sh +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/benchmarks/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/benchmarks/test_async_callbacks.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/benchmarks/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/integration_tests/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/integration_tests/test_compile.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/_api/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/_api/test_beta_decorator.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/_api/test_deprecation.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/_api/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/_api/test_path.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/caches/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/caches/test_in_memory_cache.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/callbacks/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/callbacks/test_dispatch_custom_event.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/callbacks/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/callbacks/test_sync_callback_manager.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/callbacks/test_usage_callback.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/chat_history/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/chat_history/test_chat_history.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/conftest.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/data/prompt_file.txt +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/data/prompts/prompt_extra_args.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/data/prompts/prompt_missing_args.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/data/prompts/simple_prompt.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/dependencies/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/dependencies/test_dependencies.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/document_loaders/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/document_loaders/test_base.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/document_loaders/test_langsmith.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/documents/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/documents/test_document.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/documents/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/documents/test_str.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/embeddings/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/embeddings/test_deterministic_embedding.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/example_selectors/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/example_selectors/test_base.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/example_selectors/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/example_selectors/test_length_based_example_selector.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/example_selectors/test_similarity.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/example-non-utf8.csv +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/example-non-utf8.txt +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/example-utf8.csv +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/example-utf8.txt +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/example_prompt.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/examples.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/examples.yaml +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/few_shot_prompt.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/few_shot_prompt.yaml +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/few_shot_prompt_example_prompt.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/few_shot_prompt_examples_in.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/few_shot_prompt_yaml_examples.yaml +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/jinja_injection_prompt.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/jinja_injection_prompt.yaml +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/prompt_with_output_parser.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/simple_prompt.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/simple_prompt.yaml +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/simple_prompt_with_template_file.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/examples/simple_template.txt +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/fake/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/fake/callbacks.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/fake/test_fake_chat_model.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/indexing/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/indexing/test_in_memory_indexer.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/indexing/test_in_memory_record_manager.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/indexing/test_indexing.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/indexing/test_public_api.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/language_models/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/language_models/chat_models/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/language_models/chat_models/test_benchmark.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/language_models/chat_models/test_cache.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/language_models/chat_models/test_rate_limiting.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/language_models/llms/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/language_models/llms/test_base.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/language_models/llms/test_cache.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/language_models/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/load/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/load/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/load/test_serializable.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/messages/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/messages/block_translators/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/messages/block_translators/test_anthropic.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/messages/block_translators/test_bedrock.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/messages/block_translators/test_bedrock_converse.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/messages/block_translators/test_langchain_v0.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/messages/block_translators/test_openai.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/messages/block_translators/test_registration.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/messages/test_ai.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/messages/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/messages/test_utils.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/output_parsers/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/output_parsers/test_base_parsers.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/output_parsers/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/output_parsers/test_json.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/output_parsers/test_list_parser.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/output_parsers/test_openai_functions.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/output_parsers/test_pydantic_parser.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/output_parsers/test_xml_parser.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/outputs/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/outputs/test_chat_generation.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/outputs/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompt_file.txt +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/__snapshots__/test_prompt.ambr +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/prompt_extra_args.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/prompt_missing_args.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/simple_prompt.json +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/test_dict.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/test_few_shot.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/test_few_shot_with_templates.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/test_image.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/test_loading.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/test_prompt.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/test_string.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/test_structured.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/prompts/test_utils.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/rate_limiters/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/rate_limiters/test_in_memory_rate_limiter.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/__snapshots__/test_fallbacks.ambr +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/test_config.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/test_configurable.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/test_fallbacks.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/test_graph.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/test_history.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/test_runnable_events_v1.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/test_runnable_events_v2.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/runnables/test_utils.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/stores/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/stores/test_in_memory.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/stubs.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/test_globals.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/test_messages.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/test_outputs.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/test_prompt_values.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/test_pydantic_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/test_pydantic_serde.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/test_retrievers.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/test_setup.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/test_sys_info.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/tracers/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/tracers/test_async_base_tracer.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/tracers/test_base_tracer.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/tracers/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/tracers/test_langchain.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/tracers/test_memory_stream.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/tracers/test_run_collector.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/tracers/test_schemas.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/test_aiter.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/test_env.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/test_function_calling.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/test_html.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/test_imports.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/test_iter.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/test_json_schema.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/test_pydantic.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/test_rm_titles.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/utils/test_usage.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/vectorstores/__init__.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/vectorstores/test_in_memory.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/vectorstores/test_utils.py +0 -0
- {langchain_core-1.0.2 → langchain_core-1.0.5}/tests/unit_tests/vectorstores/test_vectorstore.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langchain-core
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: Building applications with LLMs through composability
|
|
5
5
|
Project-URL: Homepage, https://docs.langchain.com/
|
|
6
6
|
Project-URL: Documentation, https://reference.langchain.com/python/langchain_core/
|
|
@@ -56,7 +56,7 @@ The LangChain ecosystem is built on top of `langchain-core`. Some of the benefit
|
|
|
56
56
|
|
|
57
57
|
## 📖 Documentation
|
|
58
58
|
|
|
59
|
-
For full documentation, see the [API reference](https://reference.langchain.com/python/langchain_core/).
|
|
59
|
+
For full documentation, see the [API reference](https://reference.langchain.com/python/langchain_core/). For conceptual guides, tutorials, and examples on using LangChain, see the [LangChain Docs](https://docs.langchain.com/oss/python/langchain/overview).
|
|
60
60
|
|
|
61
61
|
## 📕 Releases & Versioning
|
|
62
62
|
|
|
@@ -34,7 +34,7 @@ The LangChain ecosystem is built on top of `langchain-core`. Some of the benefit
|
|
|
34
34
|
|
|
35
35
|
## 📖 Documentation
|
|
36
36
|
|
|
37
|
-
For full documentation, see the [API reference](https://reference.langchain.com/python/langchain_core/).
|
|
37
|
+
For full documentation, see the [API reference](https://reference.langchain.com/python/langchain_core/). For conceptual guides, tutorials, and examples on using LangChain, see the [LangChain Docs](https://docs.langchain.com/oss/python/langchain/overview).
|
|
38
38
|
|
|
39
39
|
## 📕 Releases & Versioning
|
|
40
40
|
|
|
@@ -52,31 +52,33 @@ class AgentAction(Serializable):
|
|
|
52
52
|
"""The input to pass in to the Tool."""
|
|
53
53
|
log: str
|
|
54
54
|
"""Additional information to log about the action.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
|
|
56
|
+
This log can be used in a few ways. First, it can be used to audit what exactly the
|
|
57
|
+
LLM predicted to lead to this `(tool, tool_input)`.
|
|
58
|
+
|
|
59
|
+
Second, it can be used in future iterations to show the LLMs prior thoughts. This is
|
|
60
|
+
useful when `(tool, tool_input)` does not contain full information about the LLM
|
|
61
|
+
prediction (for example, any `thought` before the tool/tool_input).
|
|
62
|
+
"""
|
|
61
63
|
type: Literal["AgentAction"] = "AgentAction"
|
|
62
64
|
|
|
63
65
|
# Override init to support instantiation by position for backward compat.
|
|
64
66
|
def __init__(self, tool: str, tool_input: str | dict, log: str, **kwargs: Any):
|
|
65
|
-
"""Create an AgentAction
|
|
67
|
+
"""Create an `AgentAction`.
|
|
66
68
|
|
|
67
69
|
Args:
|
|
68
70
|
tool: The name of the tool to execute.
|
|
69
|
-
tool_input: The input to pass in to the Tool
|
|
71
|
+
tool_input: The input to pass in to the `Tool`.
|
|
70
72
|
log: Additional information to log about the action.
|
|
71
73
|
"""
|
|
72
74
|
super().__init__(tool=tool, tool_input=tool_input, log=log, **kwargs)
|
|
73
75
|
|
|
74
76
|
@classmethod
|
|
75
77
|
def is_lc_serializable(cls) -> bool:
|
|
76
|
-
"""AgentAction is serializable.
|
|
78
|
+
"""`AgentAction` is serializable.
|
|
77
79
|
|
|
78
80
|
Returns:
|
|
79
|
-
True
|
|
81
|
+
`True`
|
|
80
82
|
"""
|
|
81
83
|
return True
|
|
82
84
|
|
|
@@ -98,19 +100,23 @@ class AgentAction(Serializable):
|
|
|
98
100
|
class AgentActionMessageLog(AgentAction):
|
|
99
101
|
"""Representation of an action to be executed by an agent.
|
|
100
102
|
|
|
101
|
-
This is similar to AgentAction
|
|
102
|
-
chat messages.
|
|
103
|
-
|
|
103
|
+
This is similar to `AgentAction`, but includes a message log consisting of
|
|
104
|
+
chat messages.
|
|
105
|
+
|
|
106
|
+
This is useful when working with `ChatModels`, and is used to reconstruct
|
|
107
|
+
conversation history from the agent's perspective.
|
|
104
108
|
"""
|
|
105
109
|
|
|
106
110
|
message_log: Sequence[BaseMessage]
|
|
107
|
-
"""Similar to log, this can be used to pass along extra
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (tool, tool_input) cannot be used to fully recreate the
|
|
111
|
-
prediction, and you need that LLM prediction (for future agent iteration).
|
|
111
|
+
"""Similar to log, this can be used to pass along extra information about what exact
|
|
112
|
+
messages were predicted by the LLM before parsing out the `(tool, tool_input)`.
|
|
113
|
+
|
|
114
|
+
This is again useful if `(tool, tool_input)` cannot be used to fully recreate the
|
|
115
|
+
LLM prediction, and you need that LLM prediction (for future agent iteration).
|
|
116
|
+
|
|
112
117
|
Compared to `log`, this is useful when the underlying LLM is a
|
|
113
|
-
chat model (and therefore returns messages rather than a string).
|
|
118
|
+
chat model (and therefore returns messages rather than a string).
|
|
119
|
+
"""
|
|
114
120
|
# Ignoring type because we're overriding the type from AgentAction.
|
|
115
121
|
# And this is the correct thing to do in this case.
|
|
116
122
|
# The type literal is used for serialization purposes.
|
|
@@ -118,12 +124,12 @@ class AgentActionMessageLog(AgentAction):
|
|
|
118
124
|
|
|
119
125
|
|
|
120
126
|
class AgentStep(Serializable):
|
|
121
|
-
"""Result of running an AgentAction
|
|
127
|
+
"""Result of running an `AgentAction`."""
|
|
122
128
|
|
|
123
129
|
action: AgentAction
|
|
124
|
-
"""The AgentAction that was executed."""
|
|
130
|
+
"""The `AgentAction` that was executed."""
|
|
125
131
|
observation: Any
|
|
126
|
-
"""The result of the AgentAction
|
|
132
|
+
"""The result of the `AgentAction`."""
|
|
127
133
|
|
|
128
134
|
@property
|
|
129
135
|
def messages(self) -> Sequence[BaseMessage]:
|
|
@@ -132,19 +138,22 @@ class AgentStep(Serializable):
|
|
|
132
138
|
|
|
133
139
|
|
|
134
140
|
class AgentFinish(Serializable):
|
|
135
|
-
"""Final return value of an ActionAgent
|
|
141
|
+
"""Final return value of an `ActionAgent`.
|
|
136
142
|
|
|
137
|
-
Agents return an AgentFinish when they have reached a stopping condition.
|
|
143
|
+
Agents return an `AgentFinish` when they have reached a stopping condition.
|
|
138
144
|
"""
|
|
139
145
|
|
|
140
146
|
return_values: dict
|
|
141
147
|
"""Dictionary of return values."""
|
|
142
148
|
log: str
|
|
143
149
|
"""Additional information to log about the return value.
|
|
150
|
+
|
|
144
151
|
This is used to pass along the full LLM prediction, not just the parsed out
|
|
145
|
-
return value.
|
|
146
|
-
|
|
147
|
-
|
|
152
|
+
return value.
|
|
153
|
+
|
|
154
|
+
For example, if the full LLM prediction was `Final Answer: 2` you may want to just
|
|
155
|
+
return `2` as a return value, but pass along the full string as a `log` (for
|
|
156
|
+
debugging or observability purposes).
|
|
148
157
|
"""
|
|
149
158
|
type: Literal["AgentFinish"] = "AgentFinish"
|
|
150
159
|
|
|
@@ -154,7 +163,7 @@ class AgentFinish(Serializable):
|
|
|
154
163
|
|
|
155
164
|
@classmethod
|
|
156
165
|
def is_lc_serializable(cls) -> bool:
|
|
157
|
-
"""Return True as this class is serializable."""
|
|
166
|
+
"""Return `True` as this class is serializable."""
|
|
158
167
|
return True
|
|
159
168
|
|
|
160
169
|
@classmethod
|
|
@@ -202,7 +211,7 @@ def _convert_agent_observation_to_messages(
|
|
|
202
211
|
observation: Observation to convert to a message.
|
|
203
212
|
|
|
204
213
|
Returns:
|
|
205
|
-
AIMessage that corresponds to the original tool invocation.
|
|
214
|
+
`AIMessage` that corresponds to the original tool invocation.
|
|
206
215
|
"""
|
|
207
216
|
if isinstance(agent_action, AgentActionMessageLog):
|
|
208
217
|
return [_create_function_message(agent_action, observation)]
|
|
@@ -225,7 +234,7 @@ def _create_function_message(
|
|
|
225
234
|
observation: the result of the tool invocation.
|
|
226
235
|
|
|
227
236
|
Returns:
|
|
228
|
-
FunctionMessage that corresponds to the original tool invocation.
|
|
237
|
+
`FunctionMessage` that corresponds to the original tool invocation.
|
|
229
238
|
"""
|
|
230
239
|
if not isinstance(observation, str):
|
|
231
240
|
try:
|
|
@@ -5,13 +5,12 @@ from __future__ import annotations
|
|
|
5
5
|
import logging
|
|
6
6
|
from typing import TYPE_CHECKING, Any
|
|
7
7
|
|
|
8
|
-
from typing_extensions import Self
|
|
9
|
-
|
|
10
8
|
if TYPE_CHECKING:
|
|
11
9
|
from collections.abc import Sequence
|
|
12
10
|
from uuid import UUID
|
|
13
11
|
|
|
14
12
|
from tenacity import RetryCallState
|
|
13
|
+
from typing_extensions import Self
|
|
15
14
|
|
|
16
15
|
from langchain_core.agents import AgentAction, AgentFinish
|
|
17
16
|
from langchain_core.documents import Document
|
|
@@ -39,7 +39,6 @@ from langchain_core.tracers.context import (
|
|
|
39
39
|
tracing_v2_callback_var,
|
|
40
40
|
)
|
|
41
41
|
from langchain_core.tracers.langchain import LangChainTracer
|
|
42
|
-
from langchain_core.tracers.schemas import Run
|
|
43
42
|
from langchain_core.tracers.stdout import ConsoleCallbackHandler
|
|
44
43
|
from langchain_core.utils.env import env_var_is_set
|
|
45
44
|
|
|
@@ -52,6 +51,7 @@ if TYPE_CHECKING:
|
|
|
52
51
|
from langchain_core.documents import Document
|
|
53
52
|
from langchain_core.outputs import ChatGenerationChunk, GenerationChunk, LLMResult
|
|
54
53
|
from langchain_core.runnables.config import RunnableConfig
|
|
54
|
+
from langchain_core.tracers.schemas import Run
|
|
55
55
|
|
|
56
56
|
logger = logging.getLogger(__name__)
|
|
57
57
|
|
|
@@ -229,7 +229,24 @@ def shielded(func: Func) -> Func:
|
|
|
229
229
|
|
|
230
230
|
@functools.wraps(func)
|
|
231
231
|
async def wrapped(*args: Any, **kwargs: Any) -> Any:
|
|
232
|
-
|
|
232
|
+
# Capture the current context to preserve context variables
|
|
233
|
+
ctx = copy_context()
|
|
234
|
+
|
|
235
|
+
# Create the coroutine
|
|
236
|
+
coro = func(*args, **kwargs)
|
|
237
|
+
|
|
238
|
+
# For Python 3.11+, create task with explicit context
|
|
239
|
+
# For older versions, fallback to original behavior
|
|
240
|
+
try:
|
|
241
|
+
# Create a task with the captured context to preserve context variables
|
|
242
|
+
task = asyncio.create_task(coro, context=ctx) # type: ignore[call-arg, unused-ignore]
|
|
243
|
+
# `call-arg` used to not fail 3.9 or 3.10 tests
|
|
244
|
+
return await asyncio.shield(task)
|
|
245
|
+
except TypeError:
|
|
246
|
+
# Python < 3.11 fallback - create task normally then shield
|
|
247
|
+
# This won't preserve context perfectly but is better than nothing
|
|
248
|
+
task = asyncio.create_task(coro)
|
|
249
|
+
return await asyncio.shield(task)
|
|
233
250
|
|
|
234
251
|
return cast("Func", wrapped)
|
|
235
252
|
|
|
@@ -24,7 +24,7 @@ class UsageMetadataCallbackHandler(BaseCallbackHandler):
|
|
|
24
24
|
from langchain_core.callbacks import UsageMetadataCallbackHandler
|
|
25
25
|
|
|
26
26
|
llm_1 = init_chat_model(model="openai:gpt-4o-mini")
|
|
27
|
-
llm_2 = init_chat_model(model="anthropic:claude-3-5-haiku-
|
|
27
|
+
llm_2 = init_chat_model(model="anthropic:claude-3-5-haiku-20241022")
|
|
28
28
|
|
|
29
29
|
callback = UsageMetadataCallbackHandler()
|
|
30
30
|
result_1 = llm_1.invoke("Hello", config={"callbacks": [callback]})
|
|
@@ -43,7 +43,7 @@ class UsageMetadataCallbackHandler(BaseCallbackHandler):
|
|
|
43
43
|
'input_token_details': {'cache_read': 0, 'cache_creation': 0}}}
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
!!! version-added "Added in
|
|
46
|
+
!!! version-added "Added in `langchain-core` 0.3.49"
|
|
47
47
|
|
|
48
48
|
"""
|
|
49
49
|
|
|
@@ -109,7 +109,7 @@ def get_usage_metadata_callback(
|
|
|
109
109
|
from langchain_core.callbacks import get_usage_metadata_callback
|
|
110
110
|
|
|
111
111
|
llm_1 = init_chat_model(model="openai:gpt-4o-mini")
|
|
112
|
-
llm_2 = init_chat_model(model="anthropic:claude-3-5-haiku-
|
|
112
|
+
llm_2 = init_chat_model(model="anthropic:claude-3-5-haiku-20241022")
|
|
113
113
|
|
|
114
114
|
with get_usage_metadata_callback() as cb:
|
|
115
115
|
llm_1.invoke("Hello")
|
|
@@ -134,7 +134,7 @@ def get_usage_metadata_callback(
|
|
|
134
134
|
}
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
!!! version-added "Added in
|
|
137
|
+
!!! version-added "Added in `langchain-core` 0.3.49"
|
|
138
138
|
|
|
139
139
|
"""
|
|
140
140
|
usage_metadata_callback_var: ContextVar[UsageMetadataCallbackHandler | None] = (
|
|
@@ -114,11 +114,11 @@ class Blob(BaseMedia):
|
|
|
114
114
|
data: bytes | str | None = None
|
|
115
115
|
"""Raw data associated with the `Blob`."""
|
|
116
116
|
mimetype: str | None = None
|
|
117
|
-
"""
|
|
117
|
+
"""MIME type, not to be confused with a file extension."""
|
|
118
118
|
encoding: str = "utf-8"
|
|
119
119
|
"""Encoding to use if decoding the bytes into a string.
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
Uses `utf-8` as default encoding if decoding to string.
|
|
122
122
|
"""
|
|
123
123
|
path: PathLike | None = None
|
|
124
124
|
"""Location where the original content was found."""
|
|
@@ -134,7 +134,7 @@ class Blob(BaseMedia):
|
|
|
134
134
|
|
|
135
135
|
If a path is associated with the `Blob`, it will default to the path location.
|
|
136
136
|
|
|
137
|
-
Unless explicitly set via a metadata field called `
|
|
137
|
+
Unless explicitly set via a metadata field called `'source'`, in which
|
|
138
138
|
case that value will be used instead.
|
|
139
139
|
"""
|
|
140
140
|
if self.metadata and "source" in self.metadata:
|
|
@@ -309,7 +309,7 @@ class Document(BaseMedia):
|
|
|
309
309
|
|
|
310
310
|
@classmethod
|
|
311
311
|
def is_lc_serializable(cls) -> bool:
|
|
312
|
-
"""Return True as this class is serializable."""
|
|
312
|
+
"""Return `True` as this class is serializable."""
|
|
313
313
|
return True
|
|
314
314
|
|
|
315
315
|
@classmethod
|
|
@@ -322,10 +322,10 @@ class Document(BaseMedia):
|
|
|
322
322
|
return ["langchain", "schema", "document"]
|
|
323
323
|
|
|
324
324
|
def __str__(self) -> str:
|
|
325
|
-
"""Override __str__ to restrict it to page_content and metadata.
|
|
325
|
+
"""Override `__str__` to restrict it to page_content and metadata.
|
|
326
326
|
|
|
327
327
|
Returns:
|
|
328
|
-
A string representation of the Document
|
|
328
|
+
A string representation of the `Document`.
|
|
329
329
|
"""
|
|
330
330
|
# The format matches pydantic format for __str__.
|
|
331
331
|
#
|
{langchain_core-1.0.2 → langchain_core-1.0.5}/langchain_core/example_selectors/length_based.py
RENAMED
|
@@ -29,7 +29,7 @@ class LengthBasedExampleSelector(BaseExampleSelector, BaseModel):
|
|
|
29
29
|
max_length: int = 2048
|
|
30
30
|
"""Max length for the prompt, beyond which examples are cut."""
|
|
31
31
|
|
|
32
|
-
example_text_lengths: list[int] = Field(default_factory=list)
|
|
32
|
+
example_text_lengths: list[int] = Field(default_factory=list)
|
|
33
33
|
"""Length of each example."""
|
|
34
34
|
|
|
35
35
|
def add_example(self, example: dict[str, str]) -> None:
|
|
@@ -16,9 +16,10 @@ class OutputParserException(ValueError, LangChainException): # noqa: N818
|
|
|
16
16
|
"""Exception that output parsers should raise to signify a parsing error.
|
|
17
17
|
|
|
18
18
|
This exists to differentiate parsing errors from other code or execution errors
|
|
19
|
-
that also may arise inside the output parser.
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
that also may arise inside the output parser.
|
|
20
|
+
|
|
21
|
+
`OutputParserException` will be available to catch and handle in ways to fix the
|
|
22
|
+
parsing error, while other errors will be raised.
|
|
22
23
|
"""
|
|
23
24
|
|
|
24
25
|
def __init__(
|
|
@@ -32,18 +33,19 @@ class OutputParserException(ValueError, LangChainException): # noqa: N818
|
|
|
32
33
|
|
|
33
34
|
Args:
|
|
34
35
|
error: The error that's being re-raised or an error message.
|
|
35
|
-
observation: String explanation of error which can be passed to a
|
|
36
|
-
|
|
36
|
+
observation: String explanation of error which can be passed to a model to
|
|
37
|
+
try and remediate the issue.
|
|
37
38
|
llm_output: String model output which is error-ing.
|
|
38
39
|
|
|
39
40
|
send_to_llm: Whether to send the observation and llm_output back to an Agent
|
|
40
41
|
after an `OutputParserException` has been raised.
|
|
42
|
+
|
|
41
43
|
This gives the underlying model driving the agent the context that the
|
|
42
44
|
previous output was improperly structured, in the hopes that it will
|
|
43
45
|
update the output to the correct format.
|
|
44
46
|
|
|
45
47
|
Raises:
|
|
46
|
-
ValueError: If `send_to_llm` is True but either observation or
|
|
48
|
+
ValueError: If `send_to_llm` is `True` but either observation or
|
|
47
49
|
`llm_output` are not provided.
|
|
48
50
|
"""
|
|
49
51
|
if isinstance(error, str):
|
|
@@ -66,11 +68,11 @@ class ErrorCode(Enum):
|
|
|
66
68
|
"""Error codes."""
|
|
67
69
|
|
|
68
70
|
INVALID_PROMPT_INPUT = "INVALID_PROMPT_INPUT"
|
|
69
|
-
INVALID_TOOL_RESULTS = "INVALID_TOOL_RESULTS"
|
|
71
|
+
INVALID_TOOL_RESULTS = "INVALID_TOOL_RESULTS" # Used in JS; not Py (yet)
|
|
70
72
|
MESSAGE_COERCION_FAILURE = "MESSAGE_COERCION_FAILURE"
|
|
71
|
-
MODEL_AUTHENTICATION = "MODEL_AUTHENTICATION"
|
|
72
|
-
MODEL_NOT_FOUND = "MODEL_NOT_FOUND"
|
|
73
|
-
MODEL_RATE_LIMIT = "MODEL_RATE_LIMIT"
|
|
73
|
+
MODEL_AUTHENTICATION = "MODEL_AUTHENTICATION" # Used in JS; not Py (yet)
|
|
74
|
+
MODEL_NOT_FOUND = "MODEL_NOT_FOUND" # Used in JS; not Py (yet)
|
|
75
|
+
MODEL_RATE_LIMIT = "MODEL_RATE_LIMIT" # Used in JS; not Py (yet)
|
|
74
76
|
OUTPUT_PARSING_FAILURE = "OUTPUT_PARSING_FAILURE"
|
|
75
77
|
|
|
76
78
|
|
|
@@ -6,16 +6,9 @@ import hashlib
|
|
|
6
6
|
import json
|
|
7
7
|
import uuid
|
|
8
8
|
import warnings
|
|
9
|
-
from collections.abc import (
|
|
10
|
-
AsyncIterable,
|
|
11
|
-
AsyncIterator,
|
|
12
|
-
Callable,
|
|
13
|
-
Iterable,
|
|
14
|
-
Iterator,
|
|
15
|
-
Sequence,
|
|
16
|
-
)
|
|
17
9
|
from itertools import islice
|
|
18
10
|
from typing import (
|
|
11
|
+
TYPE_CHECKING,
|
|
19
12
|
Any,
|
|
20
13
|
Literal,
|
|
21
14
|
TypedDict,
|
|
@@ -29,6 +22,16 @@ from langchain_core.exceptions import LangChainException
|
|
|
29
22
|
from langchain_core.indexing.base import DocumentIndex, RecordManager
|
|
30
23
|
from langchain_core.vectorstores import VectorStore
|
|
31
24
|
|
|
25
|
+
if TYPE_CHECKING:
|
|
26
|
+
from collections.abc import (
|
|
27
|
+
AsyncIterable,
|
|
28
|
+
AsyncIterator,
|
|
29
|
+
Callable,
|
|
30
|
+
Iterable,
|
|
31
|
+
Iterator,
|
|
32
|
+
Sequence,
|
|
33
|
+
)
|
|
34
|
+
|
|
32
35
|
# Magic UUID to use as a namespace for hashing.
|
|
33
36
|
# Used to try and generate a unique UUID for each document
|
|
34
37
|
# from hashing the document content and metadata.
|
|
@@ -298,7 +301,7 @@ def index(
|
|
|
298
301
|
For the time being, documents are indexed using their hashes, and users
|
|
299
302
|
are not able to specify the uid of the document.
|
|
300
303
|
|
|
301
|
-
!!! warning "Behavior changed in 0.3.25"
|
|
304
|
+
!!! warning "Behavior changed in `langchain-core` 0.3.25"
|
|
302
305
|
Added `scoped_full` cleanup mode.
|
|
303
306
|
|
|
304
307
|
!!! warning
|
|
@@ -349,7 +352,7 @@ def index(
|
|
|
349
352
|
key_encoder: Hashing algorithm to use for hashing the document content and
|
|
350
353
|
metadata. Options include "blake2b", "sha256", and "sha512".
|
|
351
354
|
|
|
352
|
-
!!! version-added "Added in
|
|
355
|
+
!!! version-added "Added in `langchain-core` 0.3.66"
|
|
353
356
|
|
|
354
357
|
key_encoder: Hashing algorithm to use for hashing the document.
|
|
355
358
|
If not provided, a default encoder using SHA-1 will be used.
|
|
@@ -366,7 +369,7 @@ def index(
|
|
|
366
369
|
method of the `VectorStore` or the upsert method of the DocumentIndex.
|
|
367
370
|
For example, you can use this to specify a custom vector_field:
|
|
368
371
|
upsert_kwargs={"vector_field": "embedding"}
|
|
369
|
-
!!! version-added "Added in
|
|
372
|
+
!!! version-added "Added in `langchain-core` 0.3.10"
|
|
370
373
|
|
|
371
374
|
Returns:
|
|
372
375
|
Indexing result which contains information about how many documents
|
|
@@ -636,7 +639,7 @@ async def aindex(
|
|
|
636
639
|
For the time being, documents are indexed using their hashes, and users
|
|
637
640
|
are not able to specify the uid of the document.
|
|
638
641
|
|
|
639
|
-
!!! warning "Behavior changed in 0.3.25"
|
|
642
|
+
!!! warning "Behavior changed in `langchain-core` 0.3.25"
|
|
640
643
|
Added `scoped_full` cleanup mode.
|
|
641
644
|
|
|
642
645
|
!!! warning
|
|
@@ -687,7 +690,7 @@ async def aindex(
|
|
|
687
690
|
key_encoder: Hashing algorithm to use for hashing the document content and
|
|
688
691
|
metadata. Options include "blake2b", "sha256", and "sha512".
|
|
689
692
|
|
|
690
|
-
!!! version-added "Added in
|
|
693
|
+
!!! version-added "Added in `langchain-core` 0.3.66"
|
|
691
694
|
|
|
692
695
|
key_encoder: Hashing algorithm to use for hashing the document.
|
|
693
696
|
If not provided, a default encoder using SHA-1 will be used.
|
|
@@ -704,7 +707,7 @@ async def aindex(
|
|
|
704
707
|
method of the `VectorStore` or the upsert method of the DocumentIndex.
|
|
705
708
|
For example, you can use this to specify a custom vector_field:
|
|
706
709
|
upsert_kwargs={"vector_field": "embedding"}
|
|
707
|
-
!!! version-added "Added in
|
|
710
|
+
!!! version-added "Added in `langchain-core` 0.3.10"
|
|
708
711
|
|
|
709
712
|
Returns:
|
|
710
713
|
Indexing result which contains information about how many documents
|
|
@@ -139,7 +139,7 @@ def _normalize_messages(
|
|
|
139
139
|
directly; this may change in the future
|
|
140
140
|
- LangChain v0 standard content blocks for backward compatibility
|
|
141
141
|
|
|
142
|
-
!!! warning "Behavior changed in 1.0.0"
|
|
142
|
+
!!! warning "Behavior changed in `langchain-core` 1.0.0"
|
|
143
143
|
In previous versions, this function returned messages in LangChain v0 format.
|
|
144
144
|
Now, it returns messages in LangChain v1 format, which upgraded chat models now
|
|
145
145
|
expect to receive when passing back in message history. For backward
|
|
@@ -131,14 +131,19 @@ class BaseLanguageModel(
|
|
|
131
131
|
|
|
132
132
|
Caching is not currently supported for streaming methods of models.
|
|
133
133
|
"""
|
|
134
|
+
|
|
134
135
|
verbose: bool = Field(default_factory=_get_verbosity, exclude=True, repr=False)
|
|
135
136
|
"""Whether to print out response text."""
|
|
137
|
+
|
|
136
138
|
callbacks: Callbacks = Field(default=None, exclude=True)
|
|
137
139
|
"""Callbacks to add to the run trace."""
|
|
140
|
+
|
|
138
141
|
tags: list[str] | None = Field(default=None, exclude=True)
|
|
139
142
|
"""Tags to add to the run trace."""
|
|
143
|
+
|
|
140
144
|
metadata: dict[str, Any] | None = Field(default=None, exclude=True)
|
|
141
145
|
"""Metadata to add to the run trace."""
|
|
146
|
+
|
|
142
147
|
custom_get_token_ids: Callable[[str], list[int]] | None = Field(
|
|
143
148
|
default=None, exclude=True
|
|
144
149
|
)
|
|
@@ -195,15 +200,22 @@ class BaseLanguageModel(
|
|
|
195
200
|
type (e.g., pure text completion models vs chat models).
|
|
196
201
|
|
|
197
202
|
Args:
|
|
198
|
-
prompts: List of `PromptValue` objects.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
prompts: List of `PromptValue` objects.
|
|
204
|
+
|
|
205
|
+
A `PromptValue` is an object that can be converted to match the format
|
|
206
|
+
of any language model (string for pure text generation models and
|
|
207
|
+
`BaseMessage` objects for chat models).
|
|
208
|
+
stop: Stop words to use when generating.
|
|
209
|
+
|
|
210
|
+
Model output is cut off at the first occurrence of any of these
|
|
211
|
+
substrings.
|
|
212
|
+
callbacks: `Callbacks` to pass through.
|
|
213
|
+
|
|
214
|
+
Used for executing additional functionality, such as logging or
|
|
215
|
+
streaming, throughout generation.
|
|
216
|
+
**kwargs: Arbitrary additional keyword arguments.
|
|
217
|
+
|
|
218
|
+
These are usually passed to the model provider API call.
|
|
207
219
|
|
|
208
220
|
Returns:
|
|
209
221
|
An `LLMResult`, which contains a list of candidate `Generation` objects for
|
|
@@ -232,15 +244,22 @@ class BaseLanguageModel(
|
|
|
232
244
|
type (e.g., pure text completion models vs chat models).
|
|
233
245
|
|
|
234
246
|
Args:
|
|
235
|
-
prompts: List of `PromptValue` objects.
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
247
|
+
prompts: List of `PromptValue` objects.
|
|
248
|
+
|
|
249
|
+
A `PromptValue` is an object that can be converted to match the format
|
|
250
|
+
of any language model (string for pure text generation models and
|
|
251
|
+
`BaseMessage` objects for chat models).
|
|
252
|
+
stop: Stop words to use when generating.
|
|
253
|
+
|
|
254
|
+
Model output is cut off at the first occurrence of any of these
|
|
255
|
+
substrings.
|
|
256
|
+
callbacks: `Callbacks` to pass through.
|
|
257
|
+
|
|
258
|
+
Used for executing additional functionality, such as logging or
|
|
259
|
+
streaming, throughout generation.
|
|
260
|
+
**kwargs: Arbitrary additional keyword arguments.
|
|
261
|
+
|
|
262
|
+
These are usually passed to the model provider API call.
|
|
244
263
|
|
|
245
264
|
Returns:
|
|
246
265
|
An `LLMResult`, which contains a list of candidate `Generation` objects for
|
|
@@ -280,6 +299,9 @@ class BaseLanguageModel(
|
|
|
280
299
|
|
|
281
300
|
Useful for checking if an input fits in a model's context window.
|
|
282
301
|
|
|
302
|
+
This should be overridden by model-specific implementations to provide accurate
|
|
303
|
+
token counts via model-specific tokenizers.
|
|
304
|
+
|
|
283
305
|
Args:
|
|
284
306
|
text: The string input to tokenize.
|
|
285
307
|
|
|
@@ -298,9 +320,17 @@ class BaseLanguageModel(
|
|
|
298
320
|
|
|
299
321
|
Useful for checking if an input fits in a model's context window.
|
|
300
322
|
|
|
323
|
+
This should be overridden by model-specific implementations to provide accurate
|
|
324
|
+
token counts via model-specific tokenizers.
|
|
325
|
+
|
|
301
326
|
!!! note
|
|
302
|
-
|
|
303
|
-
|
|
327
|
+
|
|
328
|
+
* The base implementation of `get_num_tokens_from_messages` ignores tool
|
|
329
|
+
schemas.
|
|
330
|
+
* The base implementation of `get_num_tokens_from_messages` adds additional
|
|
331
|
+
prefixes to messages in represent user roles, which will add to the
|
|
332
|
+
overall token count. Model-specific implementations may choose to
|
|
333
|
+
handle this differently.
|
|
304
334
|
|
|
305
335
|
Args:
|
|
306
336
|
messages: The message inputs to tokenize.
|