langchain-core 1.1.1__tar.gz → 1.2.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.
Files changed (367) hide show
  1. {langchain_core-1.1.1 → langchain_core-1.2.0}/PKG-INFO +1 -1
  2. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/callbacks/usage.py +1 -1
  3. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/language_models/__init__.py +7 -5
  4. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/language_models/chat_models.py +56 -56
  5. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/language_models/llms.py +5 -3
  6. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/load/load.py +14 -1
  7. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/ai.py +10 -4
  8. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/base.py +6 -6
  9. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/block_translators/anthropic.py +11 -0
  10. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/block_translators/google_genai.py +25 -10
  11. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/tool.py +28 -27
  12. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/utils.py +43 -18
  13. langchain_core-1.2.0/langchain_core/output_parsers/string.py +63 -0
  14. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompts/string.py +2 -59
  15. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/base.py +8 -8
  16. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/fallbacks.py +1 -2
  17. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/passthrough.py +2 -2
  18. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tools/base.py +20 -0
  19. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tools/convert.py +16 -0
  20. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tools/retriever.py +29 -58
  21. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/event_stream.py +2 -2
  22. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/aiter.py +3 -1
  23. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/function_calling.py +3 -2
  24. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/pydantic.py +7 -7
  25. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/version.py +1 -1
  26. {langchain_core-1.1.1 → langchain_core-1.2.0}/pyproject.toml +1 -1
  27. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/messages/block_translators/test_anthropic.py +22 -0
  28. langchain_core-1.2.0/tests/unit_tests/messages/block_translators/test_google_genai.py +218 -0
  29. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/messages/test_utils.py +21 -8
  30. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/__snapshots__/test_chat.ambr +56 -52
  31. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/test_chat.py +0 -65
  32. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/__snapshots__/test_graph.ambr +26 -24
  33. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr +208 -192
  34. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/test_tools.py +221 -0
  35. {langchain_core-1.1.1 → langchain_core-1.2.0}/uv.lock +102 -101
  36. langchain_core-1.1.1/langchain_core/output_parsers/string.py +0 -37
  37. {langchain_core-1.1.1 → langchain_core-1.2.0}/.gitignore +0 -0
  38. {langchain_core-1.1.1 → langchain_core-1.2.0}/Makefile +0 -0
  39. {langchain_core-1.1.1 → langchain_core-1.2.0}/README.md +0 -0
  40. {langchain_core-1.1.1 → langchain_core-1.2.0}/extended_testing_deps.txt +0 -0
  41. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/__init__.py +0 -0
  42. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/_api/__init__.py +0 -0
  43. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/_api/beta_decorator.py +0 -0
  44. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/_api/deprecation.py +0 -0
  45. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/_api/internal.py +0 -0
  46. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/_api/path.py +0 -0
  47. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/_import_utils.py +0 -0
  48. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/agents.py +0 -0
  49. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/caches.py +0 -0
  50. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/callbacks/__init__.py +0 -0
  51. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/callbacks/base.py +0 -0
  52. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/callbacks/file.py +0 -0
  53. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/callbacks/manager.py +0 -0
  54. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/callbacks/stdout.py +0 -0
  55. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/callbacks/streaming_stdout.py +0 -0
  56. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/chat_history.py +0 -0
  57. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/chat_loaders.py +0 -0
  58. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/chat_sessions.py +0 -0
  59. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/document_loaders/__init__.py +0 -0
  60. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/document_loaders/base.py +0 -0
  61. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/document_loaders/blob_loaders.py +0 -0
  62. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/document_loaders/langsmith.py +0 -0
  63. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/documents/__init__.py +0 -0
  64. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/documents/base.py +0 -0
  65. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/documents/compressor.py +0 -0
  66. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/documents/transformers.py +0 -0
  67. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/embeddings/__init__.py +0 -0
  68. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/embeddings/embeddings.py +0 -0
  69. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/embeddings/fake.py +0 -0
  70. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/env.py +0 -0
  71. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/example_selectors/__init__.py +0 -0
  72. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/example_selectors/base.py +0 -0
  73. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/example_selectors/length_based.py +0 -0
  74. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/example_selectors/semantic_similarity.py +0 -0
  75. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/exceptions.py +0 -0
  76. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/globals.py +0 -0
  77. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/indexing/__init__.py +0 -0
  78. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/indexing/api.py +0 -0
  79. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/indexing/base.py +0 -0
  80. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/indexing/in_memory.py +0 -0
  81. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/language_models/_utils.py +0 -0
  82. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/language_models/base.py +0 -0
  83. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/language_models/fake.py +0 -0
  84. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/language_models/fake_chat_models.py +0 -0
  85. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/language_models/model_profile.py +0 -0
  86. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/load/__init__.py +0 -0
  87. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/load/dump.py +0 -0
  88. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/load/mapping.py +0 -0
  89. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/load/serializable.py +0 -0
  90. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/__init__.py +0 -0
  91. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/block_translators/__init__.py +0 -0
  92. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/block_translators/bedrock.py +0 -0
  93. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/block_translators/bedrock_converse.py +0 -0
  94. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/block_translators/google_vertexai.py +0 -0
  95. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/block_translators/groq.py +0 -0
  96. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/block_translators/langchain_v0.py +0 -0
  97. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/block_translators/openai.py +0 -0
  98. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/chat.py +0 -0
  99. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/content.py +0 -0
  100. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/function.py +0 -0
  101. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/human.py +0 -0
  102. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/modifier.py +0 -0
  103. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/messages/system.py +0 -0
  104. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/output_parsers/__init__.py +0 -0
  105. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/output_parsers/base.py +0 -0
  106. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/output_parsers/format_instructions.py +0 -0
  107. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/output_parsers/json.py +0 -0
  108. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/output_parsers/list.py +0 -0
  109. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/output_parsers/openai_functions.py +0 -0
  110. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/output_parsers/openai_tools.py +0 -0
  111. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/output_parsers/pydantic.py +0 -0
  112. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/output_parsers/transform.py +0 -0
  113. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/output_parsers/xml.py +0 -0
  114. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/outputs/__init__.py +0 -0
  115. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/outputs/chat_generation.py +0 -0
  116. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/outputs/chat_result.py +0 -0
  117. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/outputs/generation.py +0 -0
  118. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/outputs/llm_result.py +0 -0
  119. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/outputs/run_info.py +0 -0
  120. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompt_values.py +0 -0
  121. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompts/__init__.py +0 -0
  122. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompts/base.py +0 -0
  123. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompts/chat.py +0 -0
  124. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompts/dict.py +0 -0
  125. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompts/few_shot.py +0 -0
  126. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompts/few_shot_with_templates.py +0 -0
  127. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompts/image.py +0 -0
  128. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompts/loading.py +0 -0
  129. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompts/message.py +0 -0
  130. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompts/prompt.py +0 -0
  131. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/prompts/structured.py +0 -0
  132. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/py.typed +0 -0
  133. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/rate_limiters.py +0 -0
  134. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/retrievers.py +0 -0
  135. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/__init__.py +0 -0
  136. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/branch.py +0 -0
  137. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/config.py +0 -0
  138. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/configurable.py +0 -0
  139. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/graph.py +0 -0
  140. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/graph_ascii.py +0 -0
  141. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/graph_mermaid.py +0 -0
  142. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/graph_png.py +0 -0
  143. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/history.py +0 -0
  144. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/retry.py +0 -0
  145. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/router.py +0 -0
  146. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/schema.py +0 -0
  147. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/runnables/utils.py +0 -0
  148. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/stores.py +0 -0
  149. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/structured_query.py +0 -0
  150. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/sys_info.py +0 -0
  151. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tools/__init__.py +0 -0
  152. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tools/render.py +0 -0
  153. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tools/simple.py +0 -0
  154. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tools/structured.py +0 -0
  155. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/__init__.py +0 -0
  156. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/_streaming.py +0 -0
  157. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/base.py +0 -0
  158. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/context.py +0 -0
  159. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/core.py +0 -0
  160. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/evaluation.py +0 -0
  161. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/langchain.py +0 -0
  162. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/log_stream.py +0 -0
  163. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/memory_stream.py +0 -0
  164. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/root_listeners.py +0 -0
  165. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/run_collector.py +0 -0
  166. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/schemas.py +0 -0
  167. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/tracers/stdout.py +0 -0
  168. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/__init__.py +0 -0
  169. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/_merge.py +0 -0
  170. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/env.py +0 -0
  171. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/formatting.py +0 -0
  172. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/html.py +0 -0
  173. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/image.py +0 -0
  174. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/input.py +0 -0
  175. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/interactive_env.py +0 -0
  176. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/iter.py +0 -0
  177. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/json.py +0 -0
  178. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/json_schema.py +0 -0
  179. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/mustache.py +0 -0
  180. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/strings.py +0 -0
  181. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/usage.py +0 -0
  182. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/utils.py +0 -0
  183. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/utils/uuid.py +0 -0
  184. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/vectorstores/__init__.py +0 -0
  185. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/vectorstores/base.py +0 -0
  186. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/vectorstores/in_memory.py +0 -0
  187. {langchain_core-1.1.1 → langchain_core-1.2.0}/langchain_core/vectorstores/utils.py +0 -0
  188. {langchain_core-1.1.1 → langchain_core-1.2.0}/scripts/check_imports.py +0 -0
  189. {langchain_core-1.1.1 → langchain_core-1.2.0}/scripts/lint_imports.sh +0 -0
  190. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/__init__.py +0 -0
  191. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/benchmarks/__init__.py +0 -0
  192. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/benchmarks/test_async_callbacks.py +0 -0
  193. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/benchmarks/test_imports.py +0 -0
  194. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/integration_tests/__init__.py +0 -0
  195. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/integration_tests/test_compile.py +0 -0
  196. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/__init__.py +0 -0
  197. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/_api/__init__.py +0 -0
  198. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/_api/test_beta_decorator.py +0 -0
  199. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/_api/test_deprecation.py +0 -0
  200. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/_api/test_imports.py +0 -0
  201. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/_api/test_path.py +0 -0
  202. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/caches/__init__.py +0 -0
  203. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/caches/test_in_memory_cache.py +0 -0
  204. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/callbacks/__init__.py +0 -0
  205. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/callbacks/test_async_callback_manager.py +0 -0
  206. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/callbacks/test_dispatch_custom_event.py +0 -0
  207. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/callbacks/test_imports.py +0 -0
  208. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/callbacks/test_sync_callback_manager.py +0 -0
  209. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/callbacks/test_usage_callback.py +0 -0
  210. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/chat_history/__init__.py +0 -0
  211. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/chat_history/test_chat_history.py +0 -0
  212. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/conftest.py +0 -0
  213. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/data/prompt_file.txt +0 -0
  214. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/data/prompts/prompt_extra_args.json +0 -0
  215. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/data/prompts/prompt_missing_args.json +0 -0
  216. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/data/prompts/simple_prompt.json +0 -0
  217. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/dependencies/__init__.py +0 -0
  218. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/dependencies/test_dependencies.py +0 -0
  219. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/document_loaders/__init__.py +0 -0
  220. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/document_loaders/test_base.py +0 -0
  221. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/document_loaders/test_langsmith.py +0 -0
  222. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/documents/__init__.py +0 -0
  223. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/documents/test_document.py +0 -0
  224. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/documents/test_imports.py +0 -0
  225. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/documents/test_str.py +0 -0
  226. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/embeddings/__init__.py +0 -0
  227. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/embeddings/test_deterministic_embedding.py +0 -0
  228. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/example_selectors/__init__.py +0 -0
  229. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/example_selectors/test_base.py +0 -0
  230. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/example_selectors/test_imports.py +0 -0
  231. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/example_selectors/test_length_based_example_selector.py +0 -0
  232. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/example_selectors/test_similarity.py +0 -0
  233. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/example-non-utf8.csv +0 -0
  234. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/example-non-utf8.txt +0 -0
  235. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/example-utf8.csv +0 -0
  236. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/example-utf8.txt +0 -0
  237. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/example_prompt.json +0 -0
  238. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/examples.json +0 -0
  239. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/examples.yaml +0 -0
  240. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/few_shot_prompt.json +0 -0
  241. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/few_shot_prompt.yaml +0 -0
  242. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/few_shot_prompt_example_prompt.json +0 -0
  243. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/few_shot_prompt_examples_in.json +0 -0
  244. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/few_shot_prompt_yaml_examples.yaml +0 -0
  245. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/jinja_injection_prompt.json +0 -0
  246. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/jinja_injection_prompt.yaml +0 -0
  247. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/prompt_with_output_parser.json +0 -0
  248. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/simple_prompt.json +0 -0
  249. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/simple_prompt.yaml +0 -0
  250. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/simple_prompt_with_template_file.json +0 -0
  251. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/examples/simple_template.txt +0 -0
  252. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/fake/__init__.py +0 -0
  253. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/fake/callbacks.py +0 -0
  254. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/fake/test_fake_chat_model.py +0 -0
  255. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/indexing/__init__.py +0 -0
  256. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/indexing/test_hashed_document.py +0 -0
  257. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/indexing/test_in_memory_indexer.py +0 -0
  258. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/indexing/test_in_memory_record_manager.py +0 -0
  259. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/indexing/test_indexing.py +0 -0
  260. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/indexing/test_public_api.py +0 -0
  261. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/language_models/__init__.py +0 -0
  262. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/language_models/chat_models/__init__.py +0 -0
  263. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/language_models/chat_models/test_base.py +0 -0
  264. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/language_models/chat_models/test_benchmark.py +0 -0
  265. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/language_models/chat_models/test_cache.py +0 -0
  266. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/language_models/chat_models/test_rate_limiting.py +0 -0
  267. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/language_models/llms/__init__.py +0 -0
  268. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/language_models/llms/test_base.py +0 -0
  269. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/language_models/llms/test_cache.py +0 -0
  270. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/language_models/test_imports.py +0 -0
  271. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/load/__init__.py +0 -0
  272. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/load/test_imports.py +0 -0
  273. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/load/test_serializable.py +0 -0
  274. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/messages/__init__.py +0 -0
  275. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/messages/block_translators/__init__.py +0 -0
  276. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/messages/block_translators/test_bedrock.py +0 -0
  277. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/messages/block_translators/test_bedrock_converse.py +0 -0
  278. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/messages/block_translators/test_groq.py +0 -0
  279. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/messages/block_translators/test_langchain_v0.py +0 -0
  280. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/messages/block_translators/test_openai.py +0 -0
  281. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/messages/block_translators/test_registration.py +0 -0
  282. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/messages/test_ai.py +0 -0
  283. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/messages/test_imports.py +0 -0
  284. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/output_parsers/__init__.py +0 -0
  285. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/output_parsers/test_base_parsers.py +0 -0
  286. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/output_parsers/test_imports.py +0 -0
  287. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/output_parsers/test_json.py +0 -0
  288. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/output_parsers/test_list_parser.py +0 -0
  289. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/output_parsers/test_openai_functions.py +0 -0
  290. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/output_parsers/test_openai_tools.py +0 -0
  291. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/output_parsers/test_pydantic_parser.py +0 -0
  292. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/output_parsers/test_xml_parser.py +0 -0
  293. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/outputs/__init__.py +0 -0
  294. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/outputs/test_chat_generation.py +0 -0
  295. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/outputs/test_imports.py +0 -0
  296. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompt_file.txt +0 -0
  297. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/__init__.py +0 -0
  298. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/__snapshots__/test_prompt.ambr +0 -0
  299. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/prompt_extra_args.json +0 -0
  300. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/prompt_missing_args.json +0 -0
  301. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/simple_prompt.json +0 -0
  302. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/test_dict.py +0 -0
  303. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/test_few_shot.py +0 -0
  304. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/test_few_shot_with_templates.py +0 -0
  305. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/test_image.py +0 -0
  306. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/test_imports.py +0 -0
  307. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/test_loading.py +0 -0
  308. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/test_prompt.py +0 -0
  309. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/test_string.py +0 -0
  310. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/test_structured.py +0 -0
  311. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/prompts/test_utils.py +0 -0
  312. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/pydantic_utils.py +0 -0
  313. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/rate_limiters/__init__.py +0 -0
  314. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/rate_limiters/test_in_memory_rate_limiter.py +0 -0
  315. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/__init__.py +0 -0
  316. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/__snapshots__/test_fallbacks.ambr +0 -0
  317. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/test_concurrency.py +0 -0
  318. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/test_config.py +0 -0
  319. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/test_configurable.py +0 -0
  320. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/test_fallbacks.py +0 -0
  321. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/test_graph.py +0 -0
  322. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/test_history.py +0 -0
  323. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/test_imports.py +0 -0
  324. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/test_runnable.py +0 -0
  325. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/test_runnable_events_v1.py +0 -0
  326. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/test_runnable_events_v2.py +0 -0
  327. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/test_tracing_interops.py +0 -0
  328. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/runnables/test_utils.py +0 -0
  329. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/stores/__init__.py +0 -0
  330. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/stores/test_in_memory.py +0 -0
  331. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/stubs.py +0 -0
  332. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/test_globals.py +0 -0
  333. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/test_imports.py +0 -0
  334. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/test_messages.py +0 -0
  335. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/test_outputs.py +0 -0
  336. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/test_prompt_values.py +0 -0
  337. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/test_pydantic_imports.py +0 -0
  338. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/test_pydantic_serde.py +0 -0
  339. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/test_retrievers.py +0 -0
  340. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/test_setup.py +0 -0
  341. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/test_sys_info.py +0 -0
  342. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/tracers/__init__.py +0 -0
  343. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/tracers/test_async_base_tracer.py +0 -0
  344. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/tracers/test_base_tracer.py +0 -0
  345. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/tracers/test_imports.py +0 -0
  346. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/tracers/test_langchain.py +0 -0
  347. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/tracers/test_memory_stream.py +0 -0
  348. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/tracers/test_run_collector.py +0 -0
  349. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/tracers/test_schemas.py +0 -0
  350. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/__init__.py +0 -0
  351. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_aiter.py +0 -0
  352. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_env.py +0 -0
  353. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_function_calling.py +0 -0
  354. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_html.py +0 -0
  355. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_imports.py +0 -0
  356. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_iter.py +0 -0
  357. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_json_schema.py +0 -0
  358. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_pydantic.py +0 -0
  359. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_rm_titles.py +0 -0
  360. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_strings.py +0 -0
  361. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_usage.py +0 -0
  362. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_utils.py +0 -0
  363. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/utils/test_uuid_utils.py +0 -0
  364. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/vectorstores/__init__.py +0 -0
  365. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/vectorstores/test_in_memory.py +0 -0
  366. {langchain_core-1.1.1 → langchain_core-1.2.0}/tests/unit_tests/vectorstores/test_utils.py +0 -0
  367. {langchain_core-1.1.1 → langchain_core-1.2.0}/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.1.1
3
+ Version: 1.2.0
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/
@@ -95,7 +95,7 @@ def get_usage_metadata_callback(
95
95
  """Get usage metadata callback.
96
96
 
97
97
  Get context manager for tracking usage metadata across chat model calls using
98
- `AIMessage.usage_metadata`.
98
+ [`AIMessage.usage_metadata`][langchain.messages.AIMessage.usage_metadata].
99
99
 
100
100
  Args:
101
101
  name: The name of the context variable.
@@ -1,7 +1,7 @@
1
- """Language models.
1
+ """Core language model abstractions.
2
2
 
3
3
  LangChain has two main classes to work with language models: chat models and
4
- "old-fashioned" LLMs.
4
+ "old-fashioned" LLMs (string-in, string-out).
5
5
 
6
6
  **Chat models**
7
7
 
@@ -11,14 +11,16 @@ as outputs (as opposed to using plain text).
11
11
  Chat models support the assignment of distinct roles to conversation messages, helping
12
12
  to distinguish messages from the AI, users, and instructions such as system messages.
13
13
 
14
- The key abstraction for chat models is `BaseChatModel`. Implementations should inherit
15
- from this class.
14
+ The key abstraction for chat models is
15
+ [`BaseChatModel`][langchain_core.language_models.BaseChatModel]. Implementations should
16
+ inherit from this class.
16
17
 
17
18
  See existing [chat model integrations](https://docs.langchain.com/oss/python/integrations/chat).
18
19
 
19
- **LLMs**
20
+ **LLMs (legacy)**
20
21
 
21
22
  Language models that takes a string as input and returns a string.
23
+
22
24
  These are traditionally older models (newer models generally are chat models).
23
25
 
24
26
  Although the underlying models are string in, string out, the LangChain wrappers also
@@ -1578,86 +1578,86 @@ class BaseChatModel(BaseLanguageModel[AIMessage], ABC):
1578
1578
  depends on the `schema` as described above.
1579
1579
  - `'parsing_error'`: `BaseException | None`
1580
1580
 
1581
- Example: Pydantic schema (`include_raw=False`):
1581
+ ???+ example "Pydantic schema (`include_raw=False`)"
1582
1582
 
1583
- ```python
1584
- from pydantic import BaseModel
1583
+ ```python
1584
+ from pydantic import BaseModel
1585
1585
 
1586
1586
 
1587
- class AnswerWithJustification(BaseModel):
1588
- '''An answer to the user question along with justification for the answer.'''
1587
+ class AnswerWithJustification(BaseModel):
1588
+ '''An answer to the user question along with justification for the answer.'''
1589
1589
 
1590
- answer: str
1591
- justification: str
1590
+ answer: str
1591
+ justification: str
1592
1592
 
1593
1593
 
1594
- model = ChatModel(model="model-name", temperature=0)
1595
- structured_model = model.with_structured_output(AnswerWithJustification)
1594
+ model = ChatModel(model="model-name", temperature=0)
1595
+ structured_model = model.with_structured_output(AnswerWithJustification)
1596
1596
 
1597
- structured_model.invoke(
1598
- "What weighs more a pound of bricks or a pound of feathers"
1599
- )
1597
+ structured_model.invoke(
1598
+ "What weighs more a pound of bricks or a pound of feathers"
1599
+ )
1600
1600
 
1601
- # -> AnswerWithJustification(
1602
- # answer='They weigh the same',
1603
- # justification='Both a pound of bricks and a pound of feathers weigh one pound. The weight is the same, but the volume or density of the objects may differ.'
1604
- # )
1605
- ```
1601
+ # -> AnswerWithJustification(
1602
+ # answer='They weigh the same',
1603
+ # justification='Both a pound of bricks and a pound of feathers weigh one pound. The weight is the same, but the volume or density of the objects may differ.'
1604
+ # )
1605
+ ```
1606
1606
 
1607
- Example: Pydantic schema (`include_raw=True`):
1607
+ ??? example "Pydantic schema (`include_raw=True`)"
1608
1608
 
1609
- ```python
1610
- from pydantic import BaseModel
1609
+ ```python
1610
+ from pydantic import BaseModel
1611
1611
 
1612
1612
 
1613
- class AnswerWithJustification(BaseModel):
1614
- '''An answer to the user question along with justification for the answer.'''
1613
+ class AnswerWithJustification(BaseModel):
1614
+ '''An answer to the user question along with justification for the answer.'''
1615
1615
 
1616
- answer: str
1617
- justification: str
1616
+ answer: str
1617
+ justification: str
1618
1618
 
1619
1619
 
1620
- model = ChatModel(model="model-name", temperature=0)
1621
- structured_model = model.with_structured_output(
1622
- AnswerWithJustification, include_raw=True
1623
- )
1620
+ model = ChatModel(model="model-name", temperature=0)
1621
+ structured_model = model.with_structured_output(
1622
+ AnswerWithJustification, include_raw=True
1623
+ )
1624
1624
 
1625
- structured_model.invoke(
1626
- "What weighs more a pound of bricks or a pound of feathers"
1627
- )
1628
- # -> {
1629
- # 'raw': AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_Ao02pnFYXD6GN1yzc0uXPsvF', 'function': {'arguments': '{"answer":"They weigh the same.","justification":"Both a pound of bricks and a pound of feathers weigh one pound. The weight is the same, but the volume or density of the objects may differ."}', 'name': 'AnswerWithJustification'}, 'type': 'function'}]}),
1630
- # 'parsed': AnswerWithJustification(answer='They weigh the same.', justification='Both a pound of bricks and a pound of feathers weigh one pound. The weight is the same, but the volume or density of the objects may differ.'),
1631
- # 'parsing_error': None
1632
- # }
1633
- ```
1625
+ structured_model.invoke(
1626
+ "What weighs more a pound of bricks or a pound of feathers"
1627
+ )
1628
+ # -> {
1629
+ # 'raw': AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_Ao02pnFYXD6GN1yzc0uXPsvF', 'function': {'arguments': '{"answer":"They weigh the same.","justification":"Both a pound of bricks and a pound of feathers weigh one pound. The weight is the same, but the volume or density of the objects may differ."}', 'name': 'AnswerWithJustification'}, 'type': 'function'}]}),
1630
+ # 'parsed': AnswerWithJustification(answer='They weigh the same.', justification='Both a pound of bricks and a pound of feathers weigh one pound. The weight is the same, but the volume or density of the objects may differ.'),
1631
+ # 'parsing_error': None
1632
+ # }
1633
+ ```
1634
1634
 
1635
- Example: Dictionary schema (`include_raw=False`):
1635
+ ??? example "Dictionary schema (`include_raw=False`)"
1636
1636
 
1637
- ```python
1638
- from pydantic import BaseModel
1639
- from langchain_core.utils.function_calling import convert_to_openai_tool
1637
+ ```python
1638
+ from pydantic import BaseModel
1639
+ from langchain_core.utils.function_calling import convert_to_openai_tool
1640
1640
 
1641
1641
 
1642
- class AnswerWithJustification(BaseModel):
1643
- '''An answer to the user question along with justification for the answer.'''
1642
+ class AnswerWithJustification(BaseModel):
1643
+ '''An answer to the user question along with justification for the answer.'''
1644
1644
 
1645
- answer: str
1646
- justification: str
1645
+ answer: str
1646
+ justification: str
1647
1647
 
1648
1648
 
1649
- dict_schema = convert_to_openai_tool(AnswerWithJustification)
1650
- model = ChatModel(model="model-name", temperature=0)
1651
- structured_model = model.with_structured_output(dict_schema)
1649
+ dict_schema = convert_to_openai_tool(AnswerWithJustification)
1650
+ model = ChatModel(model="model-name", temperature=0)
1651
+ structured_model = model.with_structured_output(dict_schema)
1652
1652
 
1653
- structured_model.invoke(
1654
- "What weighs more a pound of bricks or a pound of feathers"
1655
- )
1656
- # -> {
1657
- # 'answer': 'They weigh the same',
1658
- # 'justification': 'Both a pound of bricks and a pound of feathers weigh one pound. The weight is the same, but the volume and density of the two substances differ.'
1659
- # }
1660
- ```
1653
+ structured_model.invoke(
1654
+ "What weighs more a pound of bricks or a pound of feathers"
1655
+ )
1656
+ # -> {
1657
+ # 'answer': 'They weigh the same',
1658
+ # 'justification': 'Both a pound of bricks and a pound of feathers weigh one pound. The weight is the same, but the volume and density of the two substances differ.'
1659
+ # }
1660
+ ```
1661
1661
 
1662
1662
  !!! warning "Behavior changed in `langchain-core` 0.2.26"
1663
1663
 
@@ -61,6 +61,8 @@ if TYPE_CHECKING:
61
61
 
62
62
  logger = logging.getLogger(__name__)
63
63
 
64
+ _background_tasks: set[asyncio.Task] = set()
65
+
64
66
 
65
67
  @functools.lru_cache
66
68
  def _log_error_once(msg: str) -> None:
@@ -100,9 +102,9 @@ def create_base_retry_decorator(
100
102
  asyncio.run(coro)
101
103
  else:
102
104
  if loop.is_running():
103
- # TODO: Fix RUF006 - this task should have a reference
104
- # and be awaited somewhere
105
- loop.create_task(coro) # noqa: RUF006
105
+ task = loop.create_task(coro)
106
+ _background_tasks.add(task)
107
+ task.add_done_callback(_background_tasks.discard)
106
108
  else:
107
109
  asyncio.run(coro)
108
110
  except Exception as e:
@@ -1,4 +1,9 @@
1
- """Load LangChain objects from JSON strings or objects."""
1
+ """Load LangChain objects from JSON strings or objects.
2
+
3
+ !!! warning
4
+ `load` and `loads` are vulnerable to remote code execution. Never use with untrusted
5
+ input.
6
+ """
2
7
 
3
8
  import importlib
4
9
  import json
@@ -193,6 +198,10 @@ def loads(
193
198
  ) -> Any:
194
199
  """Revive a LangChain class from a JSON string.
195
200
 
201
+ !!! warning
202
+ This function is vulnerable to remote code execution. Never use with untrusted
203
+ input.
204
+
196
205
  Equivalent to `load(json.loads(text))`.
197
206
 
198
207
  Args:
@@ -236,6 +245,10 @@ def load(
236
245
  ) -> Any:
237
246
  """Revive a LangChain class from a JSON object.
238
247
 
248
+ !!! warning
249
+ This function is vulnerable to remote code execution. Never use with untrusted
250
+ input.
251
+
239
252
  Use this if you already have a parsed JSON object,
240
253
  eg. from `json.load` or `orjson.loads`.
241
254
 
@@ -51,22 +51,22 @@ class InputTokenDetails(TypedDict, total=False):
51
51
  May also hold extra provider-specific keys.
52
52
 
53
53
  !!! version-added "Added in `langchain-core` 0.3.9"
54
-
55
54
  """
56
55
 
57
56
  audio: int
58
57
  """Audio input tokens."""
58
+
59
59
  cache_creation: int
60
60
  """Input tokens that were cached and there was a cache miss.
61
61
 
62
62
  Since there was a cache miss, the cache was created from these tokens.
63
63
  """
64
+
64
65
  cache_read: int
65
66
  """Input tokens that were cached and there was a cache hit.
66
67
 
67
68
  Since there was a cache hit, the tokens were read from the cache. More precisely,
68
69
  the model state given these tokens was read from the cache.
69
-
70
70
  """
71
71
 
72
72
 
@@ -91,12 +91,12 @@ class OutputTokenDetails(TypedDict, total=False):
91
91
 
92
92
  audio: int
93
93
  """Audio output tokens."""
94
+
94
95
  reasoning: int
95
96
  """Reasoning output tokens.
96
97
 
97
98
  Tokens generated by the model in a chain of thought process (i.e. by OpenAI's o1
98
99
  models) that are not returned as part of model output.
99
-
100
100
  """
101
101
 
102
102
 
@@ -136,15 +136,19 @@ class UsageMetadata(TypedDict):
136
136
 
137
137
  input_tokens: int
138
138
  """Count of input (or prompt) tokens. Sum of all input token types."""
139
+
139
140
  output_tokens: int
140
141
  """Count of output (or completion) tokens. Sum of all output token types."""
142
+
141
143
  total_tokens: int
142
144
  """Total token count. Sum of `input_tokens` + `output_tokens`."""
145
+
143
146
  input_token_details: NotRequired[InputTokenDetails]
144
147
  """Breakdown of input token counts.
145
148
 
146
149
  Does *not* need to sum to full input token count. Does *not* need to have all keys.
147
150
  """
151
+
148
152
  output_token_details: NotRequired[OutputTokenDetails]
149
153
  """Breakdown of output token counts.
150
154
 
@@ -164,8 +168,10 @@ class AIMessage(BaseMessage):
164
168
 
165
169
  tool_calls: list[ToolCall] = []
166
170
  """If present, tool calls associated with the message."""
171
+
167
172
  invalid_tool_calls: list[InvalidToolCall] = []
168
173
  """If present, tool calls with parsing errors associated with the message."""
174
+
169
175
  usage_metadata: UsageMetadata | None = None
170
176
  """If present, usage metadata for a message, such as token counts.
171
177
 
@@ -557,7 +563,7 @@ class AIMessageChunk(AIMessage, BaseMessageChunk):
557
563
 
558
564
  @model_validator(mode="after")
559
565
  def init_server_tool_calls(self) -> Self:
560
- """Parse `server_tool_call_chunks`."""
566
+ """Parse `server_tool_call_chunks` from [`ServerToolCallChunk`][langchain.messages.ServerToolCallChunk] objects.""" # noqa: E501
561
567
  if (
562
568
  self.chunk_position == "last"
563
569
  and self.response_metadata.get("output_version") == "v1"
@@ -391,12 +391,12 @@ class BaseMessageChunk(BaseMessage):
391
391
  Raises:
392
392
  TypeError: If the other object is not a message chunk.
393
393
 
394
- For example,
395
-
396
- `AIMessageChunk(content="Hello") + AIMessageChunk(content=" World")`
397
-
398
- will give `AIMessageChunk(content="Hello World")`
399
-
394
+ Example:
395
+ ```txt
396
+ AIMessageChunk(content="Hello", ...)
397
+ + AIMessageChunk(content=" World", ...)
398
+ = AIMessageChunk(content="Hello World", ...)
399
+ ```
400
400
  """
401
401
  if isinstance(other, BaseMessageChunk):
402
402
  # If both are (subclasses of) BaseMessageChunk,
@@ -248,8 +248,14 @@ def _convert_to_v1_from_anthropic(message: AIMessage) -> list[types.ContentBlock
248
248
  tool_call_chunk: types.ToolCallChunk = (
249
249
  message.tool_call_chunks[0].copy() # type: ignore[assignment]
250
250
  )
251
+ if "caller" in block:
252
+ if "extras" not in tool_call_chunk:
253
+ tool_call_chunk["extras"] = {}
254
+ tool_call_chunk["extras"]["caller"] = block["caller"]
255
+
251
256
  if "type" not in tool_call_chunk:
252
257
  tool_call_chunk["type"] = "tool_call_chunk"
258
+
253
259
  yield tool_call_chunk
254
260
  else:
255
261
  tool_call_block: types.ToolCall | None = None
@@ -282,6 +288,11 @@ def _convert_to_v1_from_anthropic(message: AIMessage) -> list[types.ContentBlock
282
288
  }
283
289
  if "index" in block:
284
290
  tool_call_block["index"] = block["index"]
291
+ if "caller" in block:
292
+ if "extras" not in tool_call_block:
293
+ tool_call_block["extras"] = {}
294
+ tool_call_block["extras"]["caller"] = block["caller"]
295
+
285
296
  yield tool_call_block
286
297
 
287
298
  elif block_type == "input_json_delta" and isinstance(
@@ -76,21 +76,36 @@ def translate_grounding_metadata_to_citations(
76
76
  for chunk_index in chunk_indices:
77
77
  if chunk_index < len(grounding_chunks):
78
78
  chunk = grounding_chunks[chunk_index]
79
- web_info = chunk.get("web", {})
79
+
80
+ # Handle web and maps grounding
81
+ web_info = chunk.get("web") or {}
82
+ maps_info = chunk.get("maps") or {}
83
+
84
+ # Extract citation info depending on source
85
+ url = maps_info.get("uri") or web_info.get("uri")
86
+ title = maps_info.get("title") or web_info.get("title")
87
+
88
+ # Note: confidence_scores is a legacy field from Gemini 2.0 and earlier
89
+ # that indicated confidence (0.0-1.0) for each grounding chunk.
90
+ #
91
+ # In Gemini 2.5+, this field is always None/empty and should be ignored.
92
+ extras_metadata = {
93
+ "web_search_queries": web_search_queries,
94
+ "grounding_chunk_index": chunk_index,
95
+ "confidence_scores": support.get("confidence_scores") or [],
96
+ }
97
+
98
+ # Add maps-specific metadata if present
99
+ if maps_info.get("placeId"):
100
+ extras_metadata["place_id"] = maps_info["placeId"]
80
101
 
81
102
  citation = create_citation(
82
- url=web_info.get("uri"),
83
- title=web_info.get("title"),
103
+ url=url,
104
+ title=title,
84
105
  start_index=start_index,
85
106
  end_index=end_index,
86
107
  cited_text=cited_text,
87
- extras={
88
- "google_ai_metadata": {
89
- "web_search_queries": web_search_queries,
90
- "grounding_chunk_index": chunk_index,
91
- "confidence_scores": support.get("confidence_scores", []),
92
- }
93
- },
108
+ google_ai_metadata=extras_metadata,
94
109
  )
95
110
  citations.append(citation)
96
111
 
@@ -29,38 +29,39 @@ class ToolMessage(BaseMessage, ToolOutputMixin):
29
29
  `ToolMessage` objects contain the result of a tool invocation. Typically, the result
30
30
  is encoded inside the `content` field.
31
31
 
32
- Example: A `ToolMessage` representing a result of `42` from a tool call with id
32
+ `tool_call_id` is used to associate the tool call request with the tool call
33
+ response. Useful in situations where a chat model is able to request multiple tool
34
+ calls in parallel.
33
35
 
34
- ```python
35
- from langchain_core.messages import ToolMessage
36
-
37
- ToolMessage(content="42", tool_call_id="call_Jja7J89XsjrOLA5r!MEOW!SL")
38
- ```
36
+ Example:
37
+ A `ToolMessage` representing a result of `42` from a tool call with id
39
38
 
40
- Example: A `ToolMessage` where only part of the tool output is sent to the model
41
- and the full output is passed in to artifact.
39
+ ```python
40
+ from langchain_core.messages import ToolMessage
42
41
 
43
- ```python
44
- from langchain_core.messages import ToolMessage
45
-
46
- tool_output = {
47
- "stdout": "From the graph we can see that the correlation between "
48
- "x and y is ...",
49
- "stderr": None,
50
- "artifacts": {"type": "image", "base64_data": "/9j/4gIcSU..."},
51
- }
52
-
53
- ToolMessage(
54
- content=tool_output["stdout"],
55
- artifact=tool_output,
56
- tool_call_id="call_Jja7J89XsjrOLA5r!MEOW!SL",
57
- )
58
- ```
42
+ ToolMessage(content="42", tool_call_id="call_Jja7J89XsjrOLA5r!MEOW!SL")
43
+ ```
59
44
 
60
- The `tool_call_id` field is used to associate the tool call request with the
61
- tool call response. Useful in situations where a chat model is able
62
- to request multiple tool calls in parallel.
45
+ Example:
46
+ A `ToolMessage` where only part of the tool output is sent to the model
47
+ and the full output is passed in to artifact.
63
48
 
49
+ ```python
50
+ from langchain_core.messages import ToolMessage
51
+
52
+ tool_output = {
53
+ "stdout": "From the graph we can see that the correlation between "
54
+ "x and y is ...",
55
+ "stderr": None,
56
+ "artifacts": {"type": "image", "base64_data": "/9j/4gIcSU..."},
57
+ }
58
+
59
+ ToolMessage(
60
+ content=tool_output["stdout"],
61
+ artifact=tool_output,
62
+ tool_call_id="call_Jja7J89XsjrOLA5r!MEOW!SL",
63
+ )
64
+ ```
64
65
  """
65
66
 
66
67
  tool_call_id: str
@@ -15,12 +15,16 @@ import json
15
15
  import logging
16
16
  import math
17
17
  from collections.abc import Callable, Iterable, Sequence
18
- from functools import partial
18
+ from functools import partial, wraps
19
19
  from typing import (
20
20
  TYPE_CHECKING,
21
21
  Annotated,
22
22
  Any,
23
+ Concatenate,
23
24
  Literal,
25
+ ParamSpec,
26
+ Protocol,
27
+ TypeVar,
24
28
  cast,
25
29
  overload,
26
30
  )
@@ -384,33 +388,54 @@ def convert_to_messages(
384
388
  return [_convert_to_message(m) for m in messages]
385
389
 
386
390
 
387
- def _runnable_support(func: Callable) -> Callable:
388
- @overload
389
- def wrapped(
390
- messages: None = None, **kwargs: Any
391
- ) -> Runnable[Sequence[MessageLikeRepresentation], list[BaseMessage]]: ...
391
+ _P = ParamSpec("_P")
392
+ _R_co = TypeVar("_R_co", covariant=True)
393
+
392
394
 
395
+ class _RunnableSupportCallable(Protocol[_P, _R_co]):
393
396
  @overload
394
- def wrapped(
395
- messages: Sequence[MessageLikeRepresentation], **kwargs: Any
396
- ) -> list[BaseMessage]: ...
397
+ def __call__(
398
+ self,
399
+ messages: None = None,
400
+ *args: _P.args,
401
+ **kwargs: _P.kwargs,
402
+ ) -> Runnable[Sequence[MessageLikeRepresentation], _R_co]: ...
397
403
 
404
+ @overload
405
+ def __call__(
406
+ self,
407
+ messages: Sequence[MessageLikeRepresentation] | PromptValue,
408
+ *args: _P.args,
409
+ **kwargs: _P.kwargs,
410
+ ) -> _R_co: ...
411
+
412
+ def __call__(
413
+ self,
414
+ messages: Sequence[MessageLikeRepresentation] | PromptValue | None = None,
415
+ *args: _P.args,
416
+ **kwargs: _P.kwargs,
417
+ ) -> _R_co | Runnable[Sequence[MessageLikeRepresentation], _R_co]: ...
418
+
419
+
420
+ def _runnable_support(
421
+ func: Callable[
422
+ Concatenate[Sequence[MessageLikeRepresentation] | PromptValue, _P], _R_co
423
+ ],
424
+ ) -> _RunnableSupportCallable[_P, _R_co]:
425
+ @wraps(func)
398
426
  def wrapped(
399
- messages: Sequence[MessageLikeRepresentation] | None = None,
400
- **kwargs: Any,
401
- ) -> (
402
- list[BaseMessage]
403
- | Runnable[Sequence[MessageLikeRepresentation], list[BaseMessage]]
404
- ):
427
+ messages: Sequence[MessageLikeRepresentation] | PromptValue | None = None,
428
+ *args: _P.args,
429
+ **kwargs: _P.kwargs,
430
+ ) -> _R_co | Runnable[Sequence[MessageLikeRepresentation], _R_co]:
405
431
  # Import locally to prevent circular import.
406
432
  from langchain_core.runnables.base import RunnableLambda # noqa: PLC0415
407
433
 
408
434
  if messages is not None:
409
- return func(messages, **kwargs)
435
+ return func(messages, *args, **kwargs)
410
436
  return RunnableLambda(partial(func, **kwargs), name=func.__name__)
411
437
 
412
- wrapped.__doc__ = func.__doc__
413
- return wrapped
438
+ return cast("_RunnableSupportCallable[_P, _R_co]", wrapped)
414
439
 
415
440
 
416
441
  @_runnable_support
@@ -0,0 +1,63 @@
1
+ """String output parser."""
2
+
3
+ from typing_extensions import override
4
+
5
+ from langchain_core.output_parsers.transform import BaseTransformOutputParser
6
+
7
+
8
+ class StrOutputParser(BaseTransformOutputParser[str]):
9
+ """Extract text content from model outputs as a string.
10
+
11
+ Converts model outputs (such as `AIMessage` or `AIMessageChunk` objects) into plain
12
+ text strings. It's the simplest output parser and is useful when you need string
13
+ responses for downstream processing, display, or storage.
14
+
15
+ Supports streaming, yielding text chunks as they're generated by the model.
16
+
17
+ Example:
18
+ ```python
19
+ from langchain_core.output_parsers import StrOutputParser
20
+ from langchain_openai import ChatOpenAI
21
+
22
+ model = ChatOpenAI(model="gpt-4o")
23
+ parser = StrOutputParser()
24
+
25
+ # Get string output from a model
26
+ message = model.invoke("Tell me a joke")
27
+ result = parser.invoke(message)
28
+ print(result) # plain string
29
+
30
+ # With streaming - use transform() to process a stream
31
+ stream = model.stream("Tell me a story")
32
+ for chunk in parser.transform(stream):
33
+ print(chunk, end="", flush=True)
34
+ ```
35
+ """
36
+
37
+ @classmethod
38
+ def is_lc_serializable(cls) -> bool:
39
+ """`StrOutputParser` is serializable.
40
+
41
+ Returns:
42
+ `True`
43
+ """
44
+ return True
45
+
46
+ @classmethod
47
+ def get_lc_namespace(cls) -> list[str]:
48
+ """Get the namespace of the LangChain object.
49
+
50
+ Returns:
51
+ `["langchain", "schema", "output_parser"]`
52
+ """
53
+ return ["langchain", "schema", "output_parser"]
54
+
55
+ @property
56
+ def _type(self) -> str:
57
+ """Return the output parser type for serialization."""
58
+ return "default"
59
+
60
+ @override
61
+ def parse(self, text: str) -> str:
62
+ """Returns the input text with no changes."""
63
+ return text