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