langchain-core 0.4.0.dev0__tar.gz → 1.0.0__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.0/.gitignore +163 -0
- langchain_core-1.0.0/Makefile +75 -0
- langchain_core-1.0.0/PKG-INFO +68 -0
- langchain_core-1.0.0/README.md +47 -0
- langchain_core-1.0.0/extended_testing_deps.txt +1 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/__init__.py +1 -1
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/_api/__init__.py +3 -4
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/_api/beta_decorator.py +45 -70
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/_api/deprecation.py +80 -80
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/_api/path.py +22 -8
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/_import_utils.py +10 -4
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/agents.py +25 -21
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/caches.py +53 -63
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/callbacks/__init__.py +1 -8
- langchain_core-1.0.0/langchain_core/callbacks/base.py +1107 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/callbacks/file.py +55 -44
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/callbacks/manager.py +546 -683
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/callbacks/stdout.py +29 -30
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/callbacks/streaming_stdout.py +35 -36
- langchain_core-1.0.0/langchain_core/callbacks/usage.py +147 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/chat_history.py +48 -55
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/document_loaders/base.py +46 -21
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/document_loaders/langsmith.py +39 -36
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/documents/__init__.py +0 -1
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/documents/base.py +96 -74
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/documents/compressor.py +12 -9
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/documents/transformers.py +29 -28
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/embeddings/fake.py +56 -57
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/env.py +2 -3
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/example_selectors/base.py +12 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/example_selectors/length_based.py +1 -1
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/example_selectors/semantic_similarity.py +21 -25
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/exceptions.py +15 -9
- langchain_core-1.0.0/langchain_core/globals.py +72 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/indexing/api.py +132 -125
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/indexing/base.py +64 -67
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/indexing/in_memory.py +26 -6
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/language_models/__init__.py +15 -27
- langchain_core-1.0.0/langchain_core/language_models/_utils.py +326 -0
- langchain_core-1.0.0/langchain_core/language_models/base.py +319 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/language_models/chat_models.py +547 -407
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/language_models/fake.py +11 -11
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/language_models/fake_chat_models.py +72 -118
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/language_models/llms.py +168 -242
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/load/dump.py +8 -11
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/load/load.py +32 -28
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/load/mapping.py +2 -4
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/load/serializable.py +50 -56
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/messages/__init__.py +36 -51
- langchain_core-1.0.0/langchain_core/messages/ai.py +800 -0
- langchain_core-1.0.0/langchain_core/messages/base.py +479 -0
- langchain_core-1.0.0/langchain_core/messages/block_translators/__init__.py +111 -0
- langchain_core-1.0.0/langchain_core/messages/block_translators/anthropic.py +470 -0
- langchain_core-1.0.0/langchain_core/messages/block_translators/bedrock.py +94 -0
- langchain_core-1.0.0/langchain_core/messages/block_translators/bedrock_converse.py +297 -0
- langchain_core-1.0.0/langchain_core/messages/block_translators/google_genai.py +530 -0
- langchain_core-1.0.0/langchain_core/messages/block_translators/google_vertexai.py +21 -0
- langchain_core-1.0.0/langchain_core/messages/block_translators/groq.py +143 -0
- langchain_core-1.0.0/langchain_core/messages/block_translators/langchain_v0.py +301 -0
- langchain_core-1.0.0/langchain_core/messages/block_translators/openai.py +1010 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/messages/chat.py +2 -3
- langchain_core-1.0.0/langchain_core/messages/content.py +1423 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/messages/function.py +7 -7
- langchain_core-1.0.0/langchain_core/messages/human.py +70 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/messages/modifier.py +3 -2
- langchain_core-1.0.0/langchain_core/messages/system.py +70 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/messages/tool.py +160 -58
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/messages/utils.py +527 -638
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/output_parsers/__init__.py +1 -14
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/output_parsers/base.py +68 -104
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/output_parsers/json.py +13 -17
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/output_parsers/list.py +11 -33
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/output_parsers/openai_functions.py +56 -74
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/output_parsers/openai_tools.py +68 -109
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/output_parsers/pydantic.py +15 -13
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/output_parsers/string.py +6 -2
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/output_parsers/transform.py +17 -60
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/output_parsers/xml.py +34 -44
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/outputs/__init__.py +1 -1
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/outputs/chat_generation.py +26 -11
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/outputs/chat_result.py +1 -3
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/outputs/generation.py +17 -6
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/outputs/llm_result.py +15 -8
- langchain_core-1.0.0/langchain_core/prompt_values.py +152 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/prompts/__init__.py +3 -27
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/prompts/base.py +48 -63
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/prompts/chat.py +259 -288
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/prompts/dict.py +19 -11
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/prompts/few_shot.py +84 -90
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/prompts/few_shot_with_templates.py +14 -12
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/prompts/image.py +19 -14
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/prompts/loading.py +6 -8
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/prompts/message.py +7 -8
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/prompts/prompt.py +42 -43
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/prompts/string.py +37 -16
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/prompts/structured.py +43 -46
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/rate_limiters.py +51 -60
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/retrievers.py +52 -192
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/base.py +1727 -1683
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/branch.py +52 -73
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/config.py +89 -103
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/configurable.py +128 -130
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/fallbacks.py +93 -82
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/graph.py +127 -127
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/graph_ascii.py +63 -41
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/graph_mermaid.py +87 -70
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/graph_png.py +31 -36
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/history.py +145 -161
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/passthrough.py +141 -144
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/retry.py +84 -68
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/router.py +33 -37
- langchain_core-1.0.0/langchain_core/runnables/schema.py +185 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/utils.py +95 -139
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/stores.py +85 -131
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/structured_query.py +11 -15
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/sys_info.py +31 -32
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tools/__init__.py +1 -14
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tools/base.py +221 -247
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tools/convert.py +144 -161
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tools/render.py +10 -10
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tools/retriever.py +12 -19
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tools/simple.py +52 -29
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tools/structured.py +56 -60
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/__init__.py +1 -9
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/_streaming.py +6 -7
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/base.py +103 -112
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/context.py +29 -48
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/core.py +142 -105
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/evaluation.py +30 -34
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/event_stream.py +162 -117
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/langchain.py +34 -36
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/log_stream.py +87 -49
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/memory_stream.py +3 -3
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/root_listeners.py +18 -34
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/run_collector.py +8 -20
- langchain_core-1.0.0/langchain_core/tracers/schemas.py +14 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/tracers/stdout.py +3 -3
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/__init__.py +1 -4
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/_merge.py +47 -9
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/aiter.py +70 -66
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/env.py +12 -9
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/function_calling.py +139 -206
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/html.py +7 -8
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/input.py +6 -6
- langchain_core-1.0.0/langchain_core/utils/interactive_env.py +12 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/iter.py +48 -45
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/json.py +14 -4
- langchain_core-1.0.0/langchain_core/utils/json_schema.py +238 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/mustache.py +32 -25
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/pydantic.py +67 -40
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/strings.py +5 -5
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/usage.py +1 -1
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/utils.py +104 -62
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/vectorstores/base.py +131 -179
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/vectorstores/in_memory.py +113 -182
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/vectorstores/utils.py +23 -17
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/version.py +1 -1
- langchain_core-1.0.0/pyproject.toml +136 -0
- langchain_core-1.0.0/scripts/check_imports.py +24 -0
- langchain_core-1.0.0/scripts/lint_imports.sh +17 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/benchmarks/test_async_callbacks.py +8 -12
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/_api/test_beta_decorator.py +18 -7
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/_api/test_deprecation.py +12 -12
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/callbacks/test_async_callback_manager.py +2 -2
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/callbacks/test_dispatch_custom_event.py +5 -5
- langchain_core-1.0.0/tests/unit_tests/callbacks/test_sync_callback_manager.py +43 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/conftest.py +4 -6
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/document_loaders/test_base.py +2 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/example_selectors/test_base.py +3 -2
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/example_selectors/test_similarity.py +6 -6
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/fake/callbacks.py +4 -5
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/fake/test_fake_chat_model.py +23 -21
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/indexing/test_in_memory_indexer.py +3 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/indexing/test_indexing.py +355 -71
- langchain_core-1.0.0/tests/unit_tests/language_models/chat_models/test_base.py +1219 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/language_models/chat_models/test_cache.py +25 -8
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/language_models/chat_models/test_rate_limiting.py +6 -5
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/language_models/llms/test_base.py +58 -13
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/language_models/llms/test_cache.py +7 -7
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/language_models/test_imports.py +1 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/load/test_serializable.py +94 -5
- langchain_core-1.0.0/tests/unit_tests/messages/block_translators/test_anthropic.py +487 -0
- langchain_core-1.0.0/tests/unit_tests/messages/block_translators/test_bedrock.py +405 -0
- langchain_core-1.0.0/tests/unit_tests/messages/block_translators/test_bedrock_converse.py +379 -0
- langchain_core-1.0.0/tests/unit_tests/messages/block_translators/test_langchain_v0.py +113 -0
- langchain_core-1.0.0/tests/unit_tests/messages/block_translators/test_openai.py +604 -0
- langchain_core-1.0.0/tests/unit_tests/messages/block_translators/test_registration.py +29 -0
- langchain_core-1.0.0/tests/unit_tests/messages/test_ai.py +504 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/messages/test_imports.py +6 -5
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/messages/test_utils.py +107 -32
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/output_parsers/test_base_parsers.py +23 -49
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/output_parsers/test_json.py +13 -2
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/output_parsers/test_openai_tools.py +20 -340
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/output_parsers/test_pydantic_parser.py +27 -20
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/outputs/test_chat_generation.py +2 -4
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/__snapshots__/test_chat.ambr +260 -368
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/test_chat.py +25 -64
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/test_few_shot.py +15 -16
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/test_imports.py +0 -1
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/test_loading.py +2 -2
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/test_prompt.py +57 -10
- langchain_core-1.0.0/tests/unit_tests/prompts/test_string.py +32 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/test_structured.py +9 -7
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/pydantic_utils.py +21 -28
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/__snapshots__/test_graph.ambr +586 -1906
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr +1465 -3171
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/test_concurrency.py +1 -2
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/test_configurable.py +10 -10
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/test_fallbacks.py +21 -24
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/test_graph.py +123 -10
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/test_history.py +27 -35
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/test_imports.py +1 -1
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/test_runnable.py +85 -56
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/test_runnable_events_v1.py +82 -17
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/test_runnable_events_v2.py +85 -30
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/test_tracing_interops.py +12 -8
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/test_utils.py +1 -5
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/stores/test_in_memory.py +5 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/stubs.py +5 -4
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/test_globals.py +4 -5
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/test_imports.py +13 -4
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/test_messages.py +217 -263
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/test_pydantic_imports.py +5 -1
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/test_tools.py +219 -371
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/tracers/test_async_base_tracer.py +5 -41
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/tracers/test_base_tracer.py +5 -42
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/tracers/test_memory_stream.py +1 -1
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/tracers/test_run_collector.py +2 -2
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/tracers/test_schemas.py +0 -10
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/utils/test_env.py +1 -1
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/utils/test_function_calling.py +55 -22
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/utils/test_html.py +11 -11
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/utils/test_imports.py +0 -1
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/utils/test_json_schema.py +382 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/utils/test_pydantic.py +15 -25
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/utils/test_strings.py +33 -1
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/utils/test_usage.py +2 -2
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/utils/test_utils.py +27 -26
- langchain_core-1.0.0/tests/unit_tests/vectorstores/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/vectorstores/test_in_memory.py +38 -4
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/vectorstores/test_vectorstore.py +7 -7
- langchain_core-1.0.0/uv.lock +3395 -0
- langchain_core-0.4.0.dev0/PKG-INFO +0 -108
- langchain_core-0.4.0.dev0/README.md +0 -90
- langchain_core-0.4.0.dev0/langchain_core/beta/__init__.py +0 -1
- langchain_core-0.4.0.dev0/langchain_core/beta/runnables/__init__.py +0 -1
- langchain_core-0.4.0.dev0/langchain_core/beta/runnables/context.py +0 -448
- langchain_core-0.4.0.dev0/langchain_core/callbacks/base.py +0 -1114
- langchain_core-0.4.0.dev0/langchain_core/callbacks/usage.py +0 -152
- langchain_core-0.4.0.dev0/langchain_core/globals.py +0 -231
- langchain_core-0.4.0.dev0/langchain_core/language_models/_utils.py +0 -176
- langchain_core-0.4.0.dev0/langchain_core/language_models/base.py +0 -404
- langchain_core-0.4.0.dev0/langchain_core/memory.py +0 -116
- langchain_core-0.4.0.dev0/langchain_core/messages/ai.py +0 -573
- langchain_core-0.4.0.dev0/langchain_core/messages/base.py +0 -287
- langchain_core-0.4.0.dev0/langchain_core/messages/content_blocks.py +0 -1435
- langchain_core-0.4.0.dev0/langchain_core/messages/human.py +0 -64
- langchain_core-0.4.0.dev0/langchain_core/messages/system.py +0 -57
- langchain_core-0.4.0.dev0/langchain_core/prompt_values.py +0 -246
- langchain_core-0.4.0.dev0/langchain_core/prompts/pipeline.py +0 -133
- langchain_core-0.4.0.dev0/langchain_core/pydantic_v1/__init__.py +0 -30
- langchain_core-0.4.0.dev0/langchain_core/pydantic_v1/dataclasses.py +0 -23
- langchain_core-0.4.0.dev0/langchain_core/pydantic_v1/main.py +0 -23
- langchain_core-0.4.0.dev0/langchain_core/runnables/schema.py +0 -178
- langchain_core-0.4.0.dev0/langchain_core/tracers/langchain_v1.py +0 -23
- langchain_core-0.4.0.dev0/langchain_core/tracers/schemas.py +0 -139
- langchain_core-0.4.0.dev0/langchain_core/utils/interactive_env.py +0 -8
- langchain_core-0.4.0.dev0/langchain_core/utils/json_schema.py +0 -122
- langchain_core-0.4.0.dev0/langchain_core/utils/loading.py +0 -31
- langchain_core-0.4.0.dev0/langchain_core/v1/__init__.py +0 -1
- langchain_core-0.4.0.dev0/langchain_core/v1/chat_models.py +0 -1047
- langchain_core-0.4.0.dev0/langchain_core/v1/messages.py +0 -755
- langchain_core-0.4.0.dev0/pyproject.toml +0 -180
- langchain_core-0.4.0.dev0/tests/unit_tests/callbacks/test_sync_callback_manager.py +0 -15
- langchain_core-0.4.0.dev0/tests/unit_tests/language_models/chat_models/test_base.py +0 -750
- langchain_core-0.4.0.dev0/tests/unit_tests/messages/test_ai.py +0 -198
- langchain_core-0.4.0.dev0/tests/unit_tests/messages/test_content_block_factories.py +0 -974
- langchain_core-0.4.0.dev0/tests/unit_tests/messages/test_response_metadata.py +0 -343
- langchain_core-0.4.0.dev0/tests/unit_tests/messages/test_response_metadata.py.bak +0 -361
- langchain_core-0.4.0.dev0/tests/unit_tests/prompts/test_pipeline_prompt.py +0 -47
- langchain_core-0.4.0.dev0/tests/unit_tests/runnables/test_context.py +0 -427
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/_api/internal.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/chat_loaders.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/chat_sessions.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/document_loaders/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/document_loaders/blob_loaders.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/embeddings/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/embeddings/embeddings.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/example_selectors/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/indexing/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/load/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/output_parsers/format_instructions.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/outputs/run_info.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/py.typed +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/runnables/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/formatting.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/utils/image.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/langchain_core/vectorstores/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/benchmarks/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/benchmarks/test_imports.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/integration_tests/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/integration_tests/test_compile.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/_api/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/_api/test_imports.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/_api/test_path.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/caches/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/caches/test_in_memory_cache.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/callbacks/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/callbacks/test_imports.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/callbacks/test_usage_callback.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/chat_history/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/chat_history/test_chat_history.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/data/prompt_file.txt +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/data/prompts/prompt_extra_args.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/data/prompts/prompt_missing_args.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/data/prompts/simple_prompt.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/dependencies/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/dependencies/test_dependencies.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/document_loaders/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/document_loaders/test_langsmith.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/documents/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/documents/test_document.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/documents/test_imports.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/documents/test_str.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/embeddings/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/embeddings/test_deterministic_embedding.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/example_selectors/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/example_selectors/test_imports.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/example_selectors/test_length_based_example_selector.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/example-non-utf8.csv +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/example-non-utf8.txt +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/example-utf8.csv +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/example-utf8.txt +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/example_prompt.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/examples.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/examples.yaml +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/few_shot_prompt.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/few_shot_prompt.yaml +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/few_shot_prompt_example_prompt.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/few_shot_prompt_examples_in.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/few_shot_prompt_yaml_examples.yaml +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/jinja_injection_prompt.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/jinja_injection_prompt.yaml +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/prompt_with_output_parser.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/simple_prompt.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/simple_prompt.yaml +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/simple_prompt_with_template_file.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/examples/simple_template.txt +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/fake/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/indexing/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/indexing/test_hashed_document.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/indexing/test_in_memory_record_manager.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/indexing/test_public_api.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/language_models/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/language_models/chat_models/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/language_models/chat_models/test_benchmark.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/language_models/llms/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/load/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/load/test_imports.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/messages/__init__.py +0 -0
- {langchain_core-0.4.0.dev0/tests/unit_tests/output_parsers → langchain_core-1.0.0/tests/unit_tests/messages/block_translators}/__init__.py +0 -0
- {langchain_core-0.4.0.dev0/tests/unit_tests/outputs → langchain_core-1.0.0/tests/unit_tests/output_parsers}/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/output_parsers/test_imports.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/output_parsers/test_list_parser.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/output_parsers/test_openai_functions.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/output_parsers/test_xml_parser.py +0 -0
- {langchain_core-0.4.0.dev0/tests/unit_tests/rate_limiters → langchain_core-1.0.0/tests/unit_tests/outputs}/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/outputs/test_imports.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompt_file.txt +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/__snapshots__/test_prompt.ambr +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/prompt_extra_args.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/prompt_missing_args.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/simple_prompt.json +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/test_dict.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/test_few_shot_with_templates.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/test_image.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/prompts/test_utils.py +0 -0
- {langchain_core-0.4.0.dev0/tests/unit_tests/runnables → langchain_core-1.0.0/tests/unit_tests/rate_limiters}/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/rate_limiters/test_in_memory_rate_limiter.py +0 -0
- {langchain_core-0.4.0.dev0/tests/unit_tests/stores → langchain_core-1.0.0/tests/unit_tests/runnables}/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/__snapshots__/test_fallbacks.ambr +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/runnables/test_config.py +0 -0
- {langchain_core-0.4.0.dev0/tests/unit_tests/tracers → langchain_core-1.0.0/tests/unit_tests/stores}/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/test_outputs.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/test_prompt_values.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/test_pydantic_serde.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/test_retrievers.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/test_setup.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/test_sys_info.py +0 -0
- {langchain_core-0.4.0.dev0/tests/unit_tests/utils → langchain_core-1.0.0/tests/unit_tests/tracers}/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/tracers/test_imports.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/tracers/test_langchain.py +0 -0
- {langchain_core-0.4.0.dev0/tests/unit_tests/vectorstores → langchain_core-1.0.0/tests/unit_tests/utils}/__init__.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/utils/test_aiter.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/utils/test_iter.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/utils/test_rm_titles.py +0 -0
- {langchain_core-0.4.0.dev0 → langchain_core-1.0.0}/tests/unit_tests/vectorstores/test_utils.py +0 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
.vs/
|
|
2
|
+
.claude/
|
|
3
|
+
.idea/
|
|
4
|
+
# Byte-compiled / optimized / DLL files
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
*$py.class
|
|
8
|
+
|
|
9
|
+
# C extensions
|
|
10
|
+
*.so
|
|
11
|
+
|
|
12
|
+
# Distribution / packaging
|
|
13
|
+
.Python
|
|
14
|
+
build/
|
|
15
|
+
develop-eggs/
|
|
16
|
+
dist/
|
|
17
|
+
downloads/
|
|
18
|
+
eggs/
|
|
19
|
+
.eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
wheels/
|
|
26
|
+
pip-wheel-metadata/
|
|
27
|
+
share/python-wheels/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
MANIFEST
|
|
32
|
+
|
|
33
|
+
# Google GitHub Actions credentials files created by:
|
|
34
|
+
# https://github.com/google-github-actions/auth
|
|
35
|
+
#
|
|
36
|
+
# That action recommends adding this gitignore to prevent accidentally committing keys.
|
|
37
|
+
gha-creds-*.json
|
|
38
|
+
|
|
39
|
+
# PyInstaller
|
|
40
|
+
# Usually these files are written by a python script from a template
|
|
41
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
42
|
+
*.manifest
|
|
43
|
+
*.spec
|
|
44
|
+
|
|
45
|
+
# Installer logs
|
|
46
|
+
pip-log.txt
|
|
47
|
+
pip-delete-this-directory.txt
|
|
48
|
+
|
|
49
|
+
# Unit test / coverage reports
|
|
50
|
+
htmlcov/
|
|
51
|
+
.tox/
|
|
52
|
+
.nox/
|
|
53
|
+
.coverage
|
|
54
|
+
.coverage.*
|
|
55
|
+
.cache
|
|
56
|
+
nosetests.xml
|
|
57
|
+
coverage.xml
|
|
58
|
+
*.cover
|
|
59
|
+
*.py,cover
|
|
60
|
+
.hypothesis/
|
|
61
|
+
.pytest_cache/
|
|
62
|
+
.codspeed/
|
|
63
|
+
|
|
64
|
+
# Translations
|
|
65
|
+
*.mo
|
|
66
|
+
*.pot
|
|
67
|
+
|
|
68
|
+
# Django stuff:
|
|
69
|
+
*.log
|
|
70
|
+
local_settings.py
|
|
71
|
+
db.sqlite3
|
|
72
|
+
db.sqlite3-journal
|
|
73
|
+
|
|
74
|
+
# Flask stuff:
|
|
75
|
+
instance/
|
|
76
|
+
.webassets-cache
|
|
77
|
+
|
|
78
|
+
# Scrapy stuff:
|
|
79
|
+
.scrapy
|
|
80
|
+
|
|
81
|
+
# PyBuilder
|
|
82
|
+
target/
|
|
83
|
+
|
|
84
|
+
# Jupyter Notebook
|
|
85
|
+
.ipynb_checkpoints
|
|
86
|
+
notebooks/
|
|
87
|
+
|
|
88
|
+
# IPython
|
|
89
|
+
profile_default/
|
|
90
|
+
ipython_config.py
|
|
91
|
+
|
|
92
|
+
# pyenv
|
|
93
|
+
.python-version
|
|
94
|
+
|
|
95
|
+
# pipenv
|
|
96
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
97
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
98
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
99
|
+
# install all needed dependencies.
|
|
100
|
+
#Pipfile.lock
|
|
101
|
+
|
|
102
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
103
|
+
__pypackages__/
|
|
104
|
+
|
|
105
|
+
# Celery stuff
|
|
106
|
+
celerybeat-schedule
|
|
107
|
+
celerybeat.pid
|
|
108
|
+
|
|
109
|
+
# SageMath parsed files
|
|
110
|
+
*.sage.py
|
|
111
|
+
|
|
112
|
+
# Environments
|
|
113
|
+
.env
|
|
114
|
+
.envrc
|
|
115
|
+
.venv*
|
|
116
|
+
venv*
|
|
117
|
+
env/
|
|
118
|
+
ENV/
|
|
119
|
+
env.bak/
|
|
120
|
+
|
|
121
|
+
# Spyder project settings
|
|
122
|
+
.spyderproject
|
|
123
|
+
.spyproject
|
|
124
|
+
|
|
125
|
+
# Rope project settings
|
|
126
|
+
.ropeproject
|
|
127
|
+
|
|
128
|
+
# mkdocs documentation
|
|
129
|
+
/site
|
|
130
|
+
|
|
131
|
+
# mypy
|
|
132
|
+
.mypy_cache/
|
|
133
|
+
.mypy_cache_test/
|
|
134
|
+
.dmypy.json
|
|
135
|
+
dmypy.json
|
|
136
|
+
|
|
137
|
+
# Pyre type checker
|
|
138
|
+
.pyre/
|
|
139
|
+
|
|
140
|
+
# macOS display setting files
|
|
141
|
+
.DS_Store
|
|
142
|
+
|
|
143
|
+
# Wandb directory
|
|
144
|
+
wandb/
|
|
145
|
+
|
|
146
|
+
# asdf tool versions
|
|
147
|
+
.tool-versions
|
|
148
|
+
/.ruff_cache/
|
|
149
|
+
|
|
150
|
+
*.pkl
|
|
151
|
+
*.bin
|
|
152
|
+
|
|
153
|
+
# integration test artifacts
|
|
154
|
+
data_map*
|
|
155
|
+
\[('_type', 'fake'), ('stop', None)]
|
|
156
|
+
|
|
157
|
+
# Replit files
|
|
158
|
+
*replit*
|
|
159
|
+
|
|
160
|
+
node_modules
|
|
161
|
+
|
|
162
|
+
prof
|
|
163
|
+
virtualenv/
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.PHONY: all format lint test tests test_watch integration_tests help extended_tests
|
|
2
|
+
|
|
3
|
+
# Default target executed when no arguments are given to make.
|
|
4
|
+
all: help
|
|
5
|
+
|
|
6
|
+
# Define a variable for the test file path.
|
|
7
|
+
TEST_FILE ?= tests/unit_tests/
|
|
8
|
+
|
|
9
|
+
.EXPORT_ALL_VARIABLES:
|
|
10
|
+
UV_FROZEN = true
|
|
11
|
+
|
|
12
|
+
test tests:
|
|
13
|
+
env \
|
|
14
|
+
-u LANGCHAIN_TRACING_V2 \
|
|
15
|
+
-u LANGCHAIN_API_KEY \
|
|
16
|
+
-u LANGSMITH_TRACING \
|
|
17
|
+
-u LANGCHAIN_PROJECT \
|
|
18
|
+
uv run --group test pytest -n auto --disable-socket --allow-unix-socket $(TEST_FILE)
|
|
19
|
+
|
|
20
|
+
test_watch:
|
|
21
|
+
env \
|
|
22
|
+
-u LANGCHAIN_TRACING_V2 \
|
|
23
|
+
-u LANGCHAIN_API_KEY \
|
|
24
|
+
-u LANGSMITH_TRACING \
|
|
25
|
+
-u LANGCHAIN_PROJECT \
|
|
26
|
+
uv run --group test ptw --snapshot-update --now . --disable-socket --allow-unix-socket -vv -- $(TEST_FILE)
|
|
27
|
+
|
|
28
|
+
test_profile:
|
|
29
|
+
uv run --group test pytest -vv tests/unit_tests/ --profile-svg
|
|
30
|
+
|
|
31
|
+
check_imports: $(shell find langchain_core -name '*.py')
|
|
32
|
+
uv run --group test python ./scripts/check_imports.py $^
|
|
33
|
+
|
|
34
|
+
extended_tests:
|
|
35
|
+
uv run --group test pytest --only-extended --disable-socket --allow-unix-socket $(TEST_FILE)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
######################
|
|
39
|
+
# LINTING AND FORMATTING
|
|
40
|
+
######################
|
|
41
|
+
|
|
42
|
+
# Define a variable for Python and notebook files.
|
|
43
|
+
PYTHON_FILES=.
|
|
44
|
+
MYPY_CACHE=.mypy_cache
|
|
45
|
+
lint format: PYTHON_FILES=.
|
|
46
|
+
lint_diff format_diff: PYTHON_FILES=$(shell git diff --relative=libs/core --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$')
|
|
47
|
+
lint_package: PYTHON_FILES=langchain_core
|
|
48
|
+
lint_tests: PYTHON_FILES=tests
|
|
49
|
+
lint_tests: MYPY_CACHE=.mypy_cache_test
|
|
50
|
+
|
|
51
|
+
lint lint_diff lint_package lint_tests:
|
|
52
|
+
./scripts/lint_imports.sh
|
|
53
|
+
[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check $(PYTHON_FILES)
|
|
54
|
+
[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES) --diff
|
|
55
|
+
[ "$(PYTHON_FILES)" = "" ] || mkdir -p $(MYPY_CACHE) && uv run --all-groups mypy $(PYTHON_FILES) --cache-dir $(MYPY_CACHE)
|
|
56
|
+
|
|
57
|
+
format format_diff:
|
|
58
|
+
[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)
|
|
59
|
+
[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)
|
|
60
|
+
|
|
61
|
+
benchmark:
|
|
62
|
+
uv run pytest tests/benchmarks --codspeed
|
|
63
|
+
|
|
64
|
+
######################
|
|
65
|
+
# HELP
|
|
66
|
+
######################
|
|
67
|
+
|
|
68
|
+
help:
|
|
69
|
+
@echo '----'
|
|
70
|
+
@echo 'format - run code formatters'
|
|
71
|
+
@echo 'lint - run linters'
|
|
72
|
+
@echo 'test - run unit tests'
|
|
73
|
+
@echo 'tests - run unit tests'
|
|
74
|
+
@echo 'test TEST_FILE=<test_file> - run all tests in file'
|
|
75
|
+
@echo 'test_watch - run unit tests in watch mode'
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: langchain-core
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Building applications with LLMs through composability
|
|
5
|
+
Project-URL: homepage, https://docs.langchain.com/
|
|
6
|
+
Project-URL: repository, https://github.com/langchain-ai/langchain/tree/master/libs/core
|
|
7
|
+
Project-URL: changelog, https://github.com/langchain-ai/langchain/releases?q=%22langchain-core%3D%3D1%22
|
|
8
|
+
Project-URL: twitter, https://x.com/LangChainAI
|
|
9
|
+
Project-URL: slack, https://www.langchain.com/join-community
|
|
10
|
+
Project-URL: reddit, https://www.reddit.com/r/LangChain/
|
|
11
|
+
License: MIT
|
|
12
|
+
Requires-Python: <4.0.0,>=3.10.0
|
|
13
|
+
Requires-Dist: jsonpatch<2.0.0,>=1.33.0
|
|
14
|
+
Requires-Dist: langsmith<1.0.0,>=0.3.45
|
|
15
|
+
Requires-Dist: packaging<26.0.0,>=23.2.0
|
|
16
|
+
Requires-Dist: pydantic<3.0.0,>=2.7.4
|
|
17
|
+
Requires-Dist: pyyaml<7.0.0,>=5.3.0
|
|
18
|
+
Requires-Dist: tenacity!=8.4.0,<10.0.0,>=8.1.0
|
|
19
|
+
Requires-Dist: typing-extensions<5.0.0,>=4.7.0
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# 🦜🍎️ LangChain Core
|
|
23
|
+
|
|
24
|
+
[](https://pypi.org/project/langchain-core/#history)
|
|
25
|
+
[](https://opensource.org/licenses/MIT)
|
|
26
|
+
[](https://pypistats.org/packages/langchain-core)
|
|
27
|
+
[](https://twitter.com/langchainai)
|
|
28
|
+
|
|
29
|
+
Looking for the JS/TS version? Check out [LangChain.js](https://github.com/langchain-ai/langchainjs).
|
|
30
|
+
|
|
31
|
+
To help you ship LangChain apps to production faster, check out [LangSmith](https://smith.langchain.com).
|
|
32
|
+
[LangSmith](https://smith.langchain.com) is a unified developer platform for building, testing, and monitoring LLM applications.
|
|
33
|
+
|
|
34
|
+
## Quick Install
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install langchain-core
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 🤔 What is this?
|
|
41
|
+
|
|
42
|
+
LangChain Core contains the base abstractions that power the LangChain ecosystem.
|
|
43
|
+
|
|
44
|
+
These abstractions are designed to be as modular and simple as possible.
|
|
45
|
+
|
|
46
|
+
The benefit of having these abstractions is that any provider can implement the required interface and then easily be used in the rest of the LangChain ecosystem.
|
|
47
|
+
|
|
48
|
+
## ⛰️ Why build on top of LangChain Core?
|
|
49
|
+
|
|
50
|
+
The LangChain ecosystem is built on top of `langchain-core`. Some of the benefits:
|
|
51
|
+
|
|
52
|
+
- **Modularity**: We've designed Core around abstractions that are independent of each other, and not tied to any specific model provider.
|
|
53
|
+
- **Stability**: We are committed to a stable versioning scheme, and will communicate any breaking changes with advance notice and version bumps.
|
|
54
|
+
- **Battle-tested**: Core components have the largest install base in the LLM ecosystem, and are used in production by many companies.
|
|
55
|
+
|
|
56
|
+
## 📖 Documentation
|
|
57
|
+
|
|
58
|
+
For full documentation, see the [API reference](https://reference.langchain.com/python/langchain_core/).
|
|
59
|
+
|
|
60
|
+
## 📕 Releases & Versioning
|
|
61
|
+
|
|
62
|
+
See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.
|
|
63
|
+
|
|
64
|
+
## 💁 Contributing
|
|
65
|
+
|
|
66
|
+
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
|
|
67
|
+
|
|
68
|
+
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# 🦜🍎️ LangChain Core
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/langchain-core/#history)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://pypistats.org/packages/langchain-core)
|
|
6
|
+
[](https://twitter.com/langchainai)
|
|
7
|
+
|
|
8
|
+
Looking for the JS/TS version? Check out [LangChain.js](https://github.com/langchain-ai/langchainjs).
|
|
9
|
+
|
|
10
|
+
To help you ship LangChain apps to production faster, check out [LangSmith](https://smith.langchain.com).
|
|
11
|
+
[LangSmith](https://smith.langchain.com) is a unified developer platform for building, testing, and monitoring LLM applications.
|
|
12
|
+
|
|
13
|
+
## Quick Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install langchain-core
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 🤔 What is this?
|
|
20
|
+
|
|
21
|
+
LangChain Core contains the base abstractions that power the LangChain ecosystem.
|
|
22
|
+
|
|
23
|
+
These abstractions are designed to be as modular and simple as possible.
|
|
24
|
+
|
|
25
|
+
The benefit of having these abstractions is that any provider can implement the required interface and then easily be used in the rest of the LangChain ecosystem.
|
|
26
|
+
|
|
27
|
+
## ⛰️ Why build on top of LangChain Core?
|
|
28
|
+
|
|
29
|
+
The LangChain ecosystem is built on top of `langchain-core`. Some of the benefits:
|
|
30
|
+
|
|
31
|
+
- **Modularity**: We've designed Core around abstractions that are independent of each other, and not tied to any specific model provider.
|
|
32
|
+
- **Stability**: We are committed to a stable versioning scheme, and will communicate any breaking changes with advance notice and version bumps.
|
|
33
|
+
- **Battle-tested**: Core components have the largest install base in the LLM ecosystem, and are used in production by many companies.
|
|
34
|
+
|
|
35
|
+
## 📖 Documentation
|
|
36
|
+
|
|
37
|
+
For full documentation, see the [API reference](https://reference.langchain.com/python/langchain_core/).
|
|
38
|
+
|
|
39
|
+
## 📕 Releases & Versioning
|
|
40
|
+
|
|
41
|
+
See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.
|
|
42
|
+
|
|
43
|
+
## 💁 Contributing
|
|
44
|
+
|
|
45
|
+
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
|
|
46
|
+
|
|
47
|
+
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
jinja2>=3,<4
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""`langchain-core` defines the base abstractions for the LangChain ecosystem.
|
|
2
2
|
|
|
3
3
|
The interfaces for core components like chat models, LLMs, vector stores, retrievers,
|
|
4
4
|
and more are defined here. The universal invocation protocol (Runnables) along with
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This module is only relevant for LangChain developers, not for users.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This module and its submodules are for internal use only. Do not use them
|
|
8
|
-
in your own code. We may change the API at any time with no warning.
|
|
5
|
+
!!! warning
|
|
9
6
|
|
|
7
|
+
This module and its submodules are for internal use only. Do not use them in your
|
|
8
|
+
own code. We may change the API at any time with no warning.
|
|
10
9
|
"""
|
|
11
10
|
|
|
12
11
|
from typing import TYPE_CHECKING
|
|
@@ -4,18 +4,18 @@ This module was loosely adapted from matplotlibs _api/deprecation.py module:
|
|
|
4
4
|
|
|
5
5
|
https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/_api/deprecation.py
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
!!! warning
|
|
8
8
|
|
|
9
|
-
This module is for internal use only.
|
|
10
|
-
|
|
9
|
+
This module is for internal use only. Do not use it in your own code. We may change
|
|
10
|
+
the API at any time with no warning.
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
13
|
import contextlib
|
|
14
14
|
import functools
|
|
15
15
|
import inspect
|
|
16
16
|
import warnings
|
|
17
|
-
from collections.abc import Generator
|
|
18
|
-
from typing import Any,
|
|
17
|
+
from collections.abc import Callable, Generator
|
|
18
|
+
from typing import Any, TypeVar, cast
|
|
19
19
|
|
|
20
20
|
from langchain_core._api.internal import is_caller_internal
|
|
21
21
|
|
|
@@ -27,7 +27,7 @@ class LangChainBetaWarning(DeprecationWarning):
|
|
|
27
27
|
# PUBLIC API
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
T = TypeVar("T", bound=
|
|
30
|
+
T = TypeVar("T", bound=Callable[..., Any] | type)
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
def beta(
|
|
@@ -40,37 +40,37 @@ def beta(
|
|
|
40
40
|
"""Decorator to mark a function, a class, or a property as beta.
|
|
41
41
|
|
|
42
42
|
When marking a classmethod, a staticmethod, or a property, the
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
underlying callable), but *over*
|
|
43
|
+
`@beta` decorator should go *under* `@classmethod` and
|
|
44
|
+
`@staticmethod` (i.e., `beta` should directly decorate the
|
|
45
|
+
underlying callable), but *over* `@property`.
|
|
46
46
|
|
|
47
|
-
When marking a class
|
|
48
|
-
multiple inheritance hierarchy,
|
|
49
|
-
(if
|
|
50
|
-
|
|
51
|
-
own (annotation-emitting)
|
|
47
|
+
When marking a class `C` intended to be used as a base class in a
|
|
48
|
+
multiple inheritance hierarchy, `C` *must* define an `__init__` method
|
|
49
|
+
(if `C` instead inherited its `__init__` from its own base class, then
|
|
50
|
+
`@beta` would mess up `__init__` inheritance when installing its
|
|
51
|
+
own (annotation-emitting) `C.__init__`).
|
|
52
52
|
|
|
53
53
|
Args:
|
|
54
|
-
message
|
|
54
|
+
message:
|
|
55
55
|
Override the default beta message. The %(since)s,
|
|
56
56
|
%(name)s, %(alternative)s, %(obj_type)s, %(addendum)s,
|
|
57
57
|
and %(removal)s format specifiers will be replaced by the
|
|
58
58
|
values of the respective arguments passed to this function.
|
|
59
|
-
name
|
|
59
|
+
name:
|
|
60
60
|
The name of the beta object.
|
|
61
|
-
obj_type
|
|
61
|
+
obj_type:
|
|
62
62
|
The object type being beta.
|
|
63
|
-
addendum
|
|
63
|
+
addendum:
|
|
64
64
|
Additional text appended directly to the final message.
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
.. code-block:: python
|
|
69
|
-
|
|
70
|
-
@beta
|
|
71
|
-
def the_function_to_annotate():
|
|
72
|
-
pass
|
|
66
|
+
Returns:
|
|
67
|
+
A decorator which can be used to mark functions or classes as beta.
|
|
73
68
|
|
|
69
|
+
```python
|
|
70
|
+
@beta
|
|
71
|
+
def the_function_to_annotate():
|
|
72
|
+
pass
|
|
73
|
+
```
|
|
74
74
|
"""
|
|
75
75
|
|
|
76
76
|
def beta(
|
|
@@ -144,58 +144,33 @@ def beta(
|
|
|
144
144
|
obj.__init__ = functools.wraps(obj.__init__)( # type: ignore[misc]
|
|
145
145
|
warn_if_direct_instance
|
|
146
146
|
)
|
|
147
|
-
return
|
|
147
|
+
return obj
|
|
148
148
|
|
|
149
149
|
elif isinstance(obj, property):
|
|
150
|
-
# note(erick): this block doesn't seem to be used?
|
|
151
150
|
if not _obj_type:
|
|
152
151
|
_obj_type = "attribute"
|
|
153
152
|
wrapped = None
|
|
154
153
|
_name = _name or obj.fget.__qualname__
|
|
155
154
|
old_doc = obj.__doc__
|
|
156
155
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
self,
|
|
162
|
-
fget: Union[Callable[[Any], Any], None] = None,
|
|
163
|
-
fset: Union[Callable[[Any, Any], None], None] = None,
|
|
164
|
-
fdel: Union[Callable[[Any], None], None] = None,
|
|
165
|
-
doc: Union[str, None] = None,
|
|
166
|
-
) -> None:
|
|
167
|
-
super().__init__(fget, fset, fdel, doc)
|
|
168
|
-
self.__orig_fget = fget
|
|
169
|
-
self.__orig_fset = fset
|
|
170
|
-
self.__orig_fdel = fdel
|
|
171
|
-
|
|
172
|
-
def __get__(
|
|
173
|
-
self, instance: Any, owner: Union[type, None] = None
|
|
174
|
-
) -> Any:
|
|
175
|
-
if instance is not None or owner is not None:
|
|
176
|
-
emit_warning()
|
|
177
|
-
return self.fget(instance)
|
|
156
|
+
def _fget(instance: Any) -> Any:
|
|
157
|
+
if instance is not None:
|
|
158
|
+
emit_warning()
|
|
159
|
+
return obj.fget(instance)
|
|
178
160
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
161
|
+
def _fset(instance: Any, value: Any) -> None:
|
|
162
|
+
if instance is not None:
|
|
163
|
+
emit_warning()
|
|
164
|
+
obj.fset(instance, value)
|
|
183
165
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
def __set_name__(self, owner: Union[type, None], set_name: str) -> None:
|
|
190
|
-
nonlocal _name
|
|
191
|
-
if _name == "<lambda>":
|
|
192
|
-
_name = set_name
|
|
166
|
+
def _fdel(instance: Any) -> None:
|
|
167
|
+
if instance is not None:
|
|
168
|
+
emit_warning()
|
|
169
|
+
obj.fdel(instance)
|
|
193
170
|
|
|
194
|
-
def finalize(
|
|
171
|
+
def finalize(_wrapper: Callable[..., Any], new_doc: str) -> Any:
|
|
195
172
|
"""Finalize the property."""
|
|
196
|
-
return
|
|
197
|
-
fget=obj.fget, fset=obj.fset, fdel=obj.fdel, doc=new_doc
|
|
198
|
-
)
|
|
173
|
+
return property(fget=_fget, fset=_fset, fdel=_fdel, doc=new_doc)
|
|
199
174
|
|
|
200
175
|
else:
|
|
201
176
|
_name = _name or obj.__qualname__
|
|
@@ -249,17 +224,17 @@ def warn_beta(
|
|
|
249
224
|
) -> None:
|
|
250
225
|
"""Display a standardized beta annotation.
|
|
251
226
|
|
|
252
|
-
|
|
253
|
-
message
|
|
227
|
+
Args:
|
|
228
|
+
message:
|
|
254
229
|
Override the default beta message. The
|
|
255
230
|
%(name)s, %(obj_type)s, %(addendum)s
|
|
256
231
|
format specifiers will be replaced by the
|
|
257
232
|
values of the respective arguments passed to this function.
|
|
258
|
-
name
|
|
233
|
+
name:
|
|
259
234
|
The name of the annotated object.
|
|
260
|
-
obj_type
|
|
235
|
+
obj_type:
|
|
261
236
|
The object type being annotated.
|
|
262
|
-
addendum
|
|
237
|
+
addendum:
|
|
263
238
|
Additional text appended directly to the final message.
|
|
264
239
|
"""
|
|
265
240
|
if not message:
|