langchain-core 0.3.69__tar.gz → 0.3.70__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.

Potentially problematic release.


This version of langchain-core might be problematic. Click here for more details.

Files changed (350) hide show
  1. {langchain_core-0.3.69 → langchain_core-0.3.70}/PKG-INFO +1 -1
  2. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/_import_utils.py +2 -2
  3. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/language_models/fake_chat_models.py +6 -2
  4. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/output_parsers/openai_tools.py +38 -8
  5. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/outputs/__init__.py +8 -9
  6. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/outputs/chat_generation.py +5 -1
  7. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/outputs/generation.py +2 -1
  8. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/outputs/llm_result.py +12 -14
  9. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/rate_limiters.py +2 -3
  10. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tools/structured.py +8 -1
  11. langchain_core-0.3.70/langchain_core/utils/json_schema.py +122 -0
  12. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/mustache.py +5 -0
  13. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/vectorstores/utils.py +18 -0
  14. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/version.py +1 -1
  15. {langchain_core-0.3.69 → langchain_core-0.3.70}/pyproject.toml +1 -1
  16. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/fake/test_fake_chat_model.py +18 -1
  17. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/output_parsers/test_openai_tools.py +271 -0
  18. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/test_structured.py +7 -0
  19. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/test_tools.py +6 -0
  20. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/utils/test_json_schema.py +180 -0
  21. langchain_core-0.3.69/langchain_core/utils/json_schema.py +0 -117
  22. {langchain_core-0.3.69 → langchain_core-0.3.70}/README.md +0 -0
  23. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/__init__.py +0 -0
  24. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/_api/__init__.py +0 -0
  25. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/_api/beta_decorator.py +0 -0
  26. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/_api/deprecation.py +0 -0
  27. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/_api/internal.py +0 -0
  28. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/_api/path.py +0 -0
  29. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/agents.py +0 -0
  30. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/beta/__init__.py +0 -0
  31. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/beta/runnables/__init__.py +0 -0
  32. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/beta/runnables/context.py +0 -0
  33. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/caches.py +0 -0
  34. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/callbacks/__init__.py +0 -0
  35. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/callbacks/base.py +0 -0
  36. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/callbacks/file.py +0 -0
  37. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/callbacks/manager.py +0 -0
  38. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/callbacks/stdout.py +0 -0
  39. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/callbacks/streaming_stdout.py +0 -0
  40. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/callbacks/usage.py +0 -0
  41. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/chat_history.py +0 -0
  42. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/chat_loaders.py +0 -0
  43. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/chat_sessions.py +0 -0
  44. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/document_loaders/__init__.py +0 -0
  45. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/document_loaders/base.py +0 -0
  46. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/document_loaders/blob_loaders.py +0 -0
  47. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/document_loaders/langsmith.py +0 -0
  48. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/documents/__init__.py +0 -0
  49. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/documents/base.py +0 -0
  50. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/documents/compressor.py +0 -0
  51. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/documents/transformers.py +0 -0
  52. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/embeddings/__init__.py +0 -0
  53. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/embeddings/embeddings.py +0 -0
  54. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/embeddings/fake.py +0 -0
  55. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/env.py +0 -0
  56. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/example_selectors/__init__.py +0 -0
  57. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/example_selectors/base.py +0 -0
  58. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/example_selectors/length_based.py +0 -0
  59. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/example_selectors/semantic_similarity.py +0 -0
  60. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/exceptions.py +0 -0
  61. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/globals.py +0 -0
  62. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/indexing/__init__.py +0 -0
  63. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/indexing/api.py +0 -0
  64. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/indexing/base.py +0 -0
  65. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/indexing/in_memory.py +0 -0
  66. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/language_models/__init__.py +0 -0
  67. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/language_models/_utils.py +0 -0
  68. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/language_models/base.py +0 -0
  69. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/language_models/chat_models.py +0 -0
  70. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/language_models/fake.py +0 -0
  71. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/language_models/llms.py +0 -0
  72. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/load/__init__.py +0 -0
  73. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/load/dump.py +0 -0
  74. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/load/load.py +0 -0
  75. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/load/mapping.py +0 -0
  76. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/load/serializable.py +0 -0
  77. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/memory.py +0 -0
  78. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/messages/__init__.py +0 -0
  79. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/messages/ai.py +0 -0
  80. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/messages/base.py +0 -0
  81. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/messages/chat.py +0 -0
  82. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/messages/content_blocks.py +0 -0
  83. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/messages/function.py +0 -0
  84. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/messages/human.py +0 -0
  85. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/messages/modifier.py +0 -0
  86. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/messages/system.py +0 -0
  87. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/messages/tool.py +0 -0
  88. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/messages/utils.py +0 -0
  89. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/output_parsers/__init__.py +0 -0
  90. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/output_parsers/base.py +0 -0
  91. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/output_parsers/format_instructions.py +0 -0
  92. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/output_parsers/json.py +0 -0
  93. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/output_parsers/list.py +0 -0
  94. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/output_parsers/openai_functions.py +0 -0
  95. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/output_parsers/pydantic.py +0 -0
  96. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/output_parsers/string.py +0 -0
  97. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/output_parsers/transform.py +0 -0
  98. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/output_parsers/xml.py +0 -0
  99. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/outputs/chat_result.py +0 -0
  100. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/outputs/run_info.py +0 -0
  101. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompt_values.py +0 -0
  102. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/__init__.py +0 -0
  103. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/base.py +0 -0
  104. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/chat.py +0 -0
  105. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/dict.py +0 -0
  106. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/few_shot.py +0 -0
  107. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/few_shot_with_templates.py +0 -0
  108. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/image.py +0 -0
  109. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/loading.py +0 -0
  110. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/message.py +0 -0
  111. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/pipeline.py +0 -0
  112. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/prompt.py +0 -0
  113. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/string.py +0 -0
  114. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/prompts/structured.py +0 -0
  115. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/py.typed +0 -0
  116. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/pydantic_v1/__init__.py +0 -0
  117. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/pydantic_v1/dataclasses.py +0 -0
  118. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/pydantic_v1/main.py +0 -0
  119. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/retrievers.py +0 -0
  120. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/__init__.py +0 -0
  121. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/base.py +0 -0
  122. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/branch.py +0 -0
  123. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/config.py +0 -0
  124. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/configurable.py +0 -0
  125. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/fallbacks.py +0 -0
  126. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/graph.py +0 -0
  127. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/graph_ascii.py +0 -0
  128. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/graph_mermaid.py +0 -0
  129. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/graph_png.py +0 -0
  130. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/history.py +0 -0
  131. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/passthrough.py +0 -0
  132. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/retry.py +0 -0
  133. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/router.py +0 -0
  134. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/schema.py +0 -0
  135. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/runnables/utils.py +0 -0
  136. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/stores.py +0 -0
  137. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/structured_query.py +0 -0
  138. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/sys_info.py +0 -0
  139. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tools/__init__.py +0 -0
  140. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tools/base.py +0 -0
  141. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tools/convert.py +0 -0
  142. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tools/render.py +0 -0
  143. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tools/retriever.py +0 -0
  144. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tools/simple.py +0 -0
  145. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/__init__.py +0 -0
  146. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/_streaming.py +0 -0
  147. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/base.py +0 -0
  148. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/context.py +0 -0
  149. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/core.py +0 -0
  150. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/evaluation.py +0 -0
  151. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/event_stream.py +0 -0
  152. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/langchain.py +0 -0
  153. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/langchain_v1.py +0 -0
  154. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/log_stream.py +0 -0
  155. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/memory_stream.py +0 -0
  156. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/root_listeners.py +0 -0
  157. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/run_collector.py +0 -0
  158. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/schemas.py +0 -0
  159. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/tracers/stdout.py +0 -0
  160. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/__init__.py +0 -0
  161. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/_merge.py +0 -0
  162. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/aiter.py +0 -0
  163. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/env.py +0 -0
  164. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/formatting.py +0 -0
  165. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/function_calling.py +0 -0
  166. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/html.py +0 -0
  167. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/image.py +0 -0
  168. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/input.py +0 -0
  169. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/interactive_env.py +0 -0
  170. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/iter.py +0 -0
  171. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/json.py +0 -0
  172. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/loading.py +0 -0
  173. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/pydantic.py +0 -0
  174. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/strings.py +0 -0
  175. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/usage.py +0 -0
  176. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/utils/utils.py +0 -0
  177. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/vectorstores/__init__.py +0 -0
  178. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/vectorstores/base.py +0 -0
  179. {langchain_core-0.3.69 → langchain_core-0.3.70}/langchain_core/vectorstores/in_memory.py +0 -0
  180. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/__init__.py +0 -0
  181. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/benchmarks/__init__.py +0 -0
  182. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/benchmarks/test_async_callbacks.py +0 -0
  183. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/benchmarks/test_imports.py +0 -0
  184. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/integration_tests/__init__.py +0 -0
  185. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/integration_tests/test_compile.py +0 -0
  186. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/__init__.py +0 -0
  187. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/_api/__init__.py +0 -0
  188. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/_api/test_beta_decorator.py +0 -0
  189. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/_api/test_deprecation.py +0 -0
  190. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/_api/test_imports.py +0 -0
  191. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/_api/test_path.py +0 -0
  192. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/caches/__init__.py +0 -0
  193. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/caches/test_in_memory_cache.py +0 -0
  194. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/callbacks/__init__.py +0 -0
  195. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/callbacks/test_async_callback_manager.py +0 -0
  196. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/callbacks/test_dispatch_custom_event.py +0 -0
  197. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/callbacks/test_imports.py +0 -0
  198. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/callbacks/test_sync_callback_manager.py +0 -0
  199. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/callbacks/test_usage_callback.py +0 -0
  200. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/chat_history/__init__.py +0 -0
  201. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/chat_history/test_chat_history.py +0 -0
  202. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/conftest.py +0 -0
  203. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/data/prompt_file.txt +0 -0
  204. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/data/prompts/prompt_extra_args.json +0 -0
  205. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/data/prompts/prompt_missing_args.json +0 -0
  206. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/data/prompts/simple_prompt.json +0 -0
  207. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/dependencies/__init__.py +0 -0
  208. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/dependencies/test_dependencies.py +0 -0
  209. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/document_loaders/__init__.py +0 -0
  210. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/document_loaders/test_base.py +0 -0
  211. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/document_loaders/test_langsmith.py +0 -0
  212. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/documents/__init__.py +0 -0
  213. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/documents/test_document.py +0 -0
  214. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/documents/test_imports.py +0 -0
  215. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/documents/test_str.py +0 -0
  216. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/embeddings/__init__.py +0 -0
  217. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/embeddings/test_deterministic_embedding.py +0 -0
  218. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/example_selectors/__init__.py +0 -0
  219. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/example_selectors/test_base.py +0 -0
  220. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/example_selectors/test_imports.py +0 -0
  221. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/example_selectors/test_length_based_example_selector.py +0 -0
  222. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/example_selectors/test_similarity.py +0 -0
  223. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/example-non-utf8.csv +0 -0
  224. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/example-non-utf8.txt +0 -0
  225. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/example-utf8.csv +0 -0
  226. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/example-utf8.txt +0 -0
  227. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/example_prompt.json +0 -0
  228. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/examples.json +0 -0
  229. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/examples.yaml +0 -0
  230. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/few_shot_prompt.json +0 -0
  231. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/few_shot_prompt.yaml +0 -0
  232. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/few_shot_prompt_example_prompt.json +0 -0
  233. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/few_shot_prompt_examples_in.json +0 -0
  234. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/few_shot_prompt_yaml_examples.yaml +0 -0
  235. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/jinja_injection_prompt.json +0 -0
  236. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/jinja_injection_prompt.yaml +0 -0
  237. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/prompt_with_output_parser.json +0 -0
  238. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/simple_prompt.json +0 -0
  239. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/simple_prompt.yaml +0 -0
  240. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/simple_prompt_with_template_file.json +0 -0
  241. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/examples/simple_template.txt +0 -0
  242. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/fake/__init__.py +0 -0
  243. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/fake/callbacks.py +0 -0
  244. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/indexing/__init__.py +0 -0
  245. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/indexing/test_hashed_document.py +0 -0
  246. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/indexing/test_in_memory_indexer.py +0 -0
  247. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/indexing/test_in_memory_record_manager.py +0 -0
  248. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/indexing/test_indexing.py +0 -0
  249. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/indexing/test_public_api.py +0 -0
  250. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/language_models/__init__.py +0 -0
  251. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/language_models/chat_models/__init__.py +0 -0
  252. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/language_models/chat_models/test_base.py +0 -0
  253. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/language_models/chat_models/test_benchmark.py +0 -0
  254. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/language_models/chat_models/test_cache.py +0 -0
  255. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/language_models/chat_models/test_rate_limiting.py +0 -0
  256. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/language_models/llms/__init__.py +0 -0
  257. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/language_models/llms/test_base.py +0 -0
  258. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/language_models/llms/test_cache.py +0 -0
  259. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/language_models/test_imports.py +0 -0
  260. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/load/__init__.py +0 -0
  261. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/load/test_imports.py +0 -0
  262. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/load/test_serializable.py +0 -0
  263. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/messages/__init__.py +0 -0
  264. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/messages/test_ai.py +0 -0
  265. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/messages/test_imports.py +0 -0
  266. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/messages/test_utils.py +0 -0
  267. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/output_parsers/__init__.py +0 -0
  268. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/output_parsers/test_base_parsers.py +0 -0
  269. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/output_parsers/test_imports.py +0 -0
  270. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/output_parsers/test_json.py +0 -0
  271. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/output_parsers/test_list_parser.py +0 -0
  272. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/output_parsers/test_openai_functions.py +0 -0
  273. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/output_parsers/test_pydantic_parser.py +0 -0
  274. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/output_parsers/test_xml_parser.py +0 -0
  275. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/outputs/__init__.py +0 -0
  276. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/outputs/test_chat_generation.py +0 -0
  277. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/outputs/test_imports.py +0 -0
  278. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompt_file.txt +0 -0
  279. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/__init__.py +0 -0
  280. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/__snapshots__/test_chat.ambr +0 -0
  281. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/__snapshots__/test_prompt.ambr +0 -0
  282. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/prompt_extra_args.json +0 -0
  283. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/prompt_missing_args.json +0 -0
  284. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/simple_prompt.json +0 -0
  285. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/test_chat.py +0 -0
  286. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/test_dict.py +0 -0
  287. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/test_few_shot.py +0 -0
  288. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/test_few_shot_with_templates.py +0 -0
  289. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/test_image.py +0 -0
  290. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/test_imports.py +0 -0
  291. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/test_loading.py +0 -0
  292. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/test_pipeline_prompt.py +0 -0
  293. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/test_prompt.py +0 -0
  294. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/prompts/test_utils.py +0 -0
  295. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/pydantic_utils.py +0 -0
  296. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/rate_limiters/__init__.py +0 -0
  297. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/rate_limiters/test_in_memory_rate_limiter.py +0 -0
  298. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/__init__.py +0 -0
  299. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/__snapshots__/test_fallbacks.ambr +0 -0
  300. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/__snapshots__/test_graph.ambr +0 -0
  301. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr +0 -0
  302. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_concurrency.py +0 -0
  303. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_config.py +0 -0
  304. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_configurable.py +0 -0
  305. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_context.py +0 -0
  306. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_fallbacks.py +0 -0
  307. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_graph.py +0 -0
  308. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_history.py +0 -0
  309. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_imports.py +0 -0
  310. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_runnable.py +0 -0
  311. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_runnable_events_v1.py +0 -0
  312. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_runnable_events_v2.py +0 -0
  313. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_tracing_interops.py +0 -0
  314. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/runnables/test_utils.py +0 -0
  315. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/stores/__init__.py +0 -0
  316. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/stores/test_in_memory.py +0 -0
  317. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/stubs.py +0 -0
  318. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/test_globals.py +0 -0
  319. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/test_imports.py +0 -0
  320. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/test_messages.py +0 -0
  321. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/test_outputs.py +0 -0
  322. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/test_prompt_values.py +0 -0
  323. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/test_pydantic_imports.py +0 -0
  324. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/test_pydantic_serde.py +0 -0
  325. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/test_retrievers.py +0 -0
  326. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/test_setup.py +0 -0
  327. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/test_sys_info.py +0 -0
  328. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/tracers/__init__.py +0 -0
  329. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/tracers/test_async_base_tracer.py +0 -0
  330. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/tracers/test_base_tracer.py +0 -0
  331. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/tracers/test_imports.py +0 -0
  332. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/tracers/test_langchain.py +0 -0
  333. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/tracers/test_memory_stream.py +0 -0
  334. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/tracers/test_run_collector.py +0 -0
  335. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/tracers/test_schemas.py +0 -0
  336. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/utils/__init__.py +0 -0
  337. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/utils/test_aiter.py +0 -0
  338. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/utils/test_env.py +0 -0
  339. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/utils/test_function_calling.py +0 -0
  340. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/utils/test_html.py +0 -0
  341. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/utils/test_imports.py +0 -0
  342. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/utils/test_iter.py +0 -0
  343. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/utils/test_pydantic.py +0 -0
  344. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/utils/test_rm_titles.py +0 -0
  345. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/utils/test_usage.py +0 -0
  346. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/utils/test_utils.py +0 -0
  347. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/vectorstores/__init__.py +0 -0
  348. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/vectorstores/test_in_memory.py +0 -0
  349. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/vectorstores/test_utils.py +0 -0
  350. {langchain_core-0.3.69 → langchain_core-0.3.70}/tests/unit_tests/vectorstores/test_vectorstore.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain-core
3
- Version: 0.3.69
3
+ Version: 0.3.70
4
4
  Summary: Building applications with LLMs through composability
5
5
  License: MIT
6
6
  Project-URL: Source Code, https://github.com/langchain-ai/langchain/tree/master/libs/core
@@ -27,8 +27,8 @@ def import_attr(
27
27
  else:
28
28
  try:
29
29
  module = import_module(f".{module_name}", package=package)
30
- except ModuleNotFoundError:
31
- msg = f"module '{package!r}.{module_name!r}' not found"
30
+ except ModuleNotFoundError as err:
31
+ msg = f"module '{package!r}.{module_name!r}' not found ({err})"
32
32
  raise ImportError(msg) from None
33
33
  result = getattr(module, attr_name)
34
34
  return result
@@ -36,6 +36,8 @@ class FakeMessagesListChatModel(BaseChatModel):
36
36
  run_manager: Optional[CallbackManagerForLLMRun] = None,
37
37
  **kwargs: Any,
38
38
  ) -> ChatResult:
39
+ if self.sleep is not None:
40
+ time.sleep(self.sleep)
39
41
  response = self.responses[self.i]
40
42
  if self.i < len(self.responses) - 1:
41
43
  self.i += 1
@@ -61,9 +63,9 @@ class FakeListChatModel(SimpleChatModel):
61
63
  """List of responses to **cycle** through in order."""
62
64
  sleep: Optional[float] = None
63
65
  i: int = 0
64
- """List of responses to **cycle** through in order."""
65
- error_on_chunk_number: Optional[int] = None
66
66
  """Internally incremented after every model invocation."""
67
+ error_on_chunk_number: Optional[int] = None
68
+ """If set, raise an error on the specified chunk number during streaming."""
67
69
 
68
70
  @property
69
71
  @override
@@ -79,6 +81,8 @@ class FakeListChatModel(SimpleChatModel):
79
81
  **kwargs: Any,
80
82
  ) -> str:
81
83
  """First try to lookup in queries, else return 'foo' or 'bar'."""
84
+ if self.sleep is not None:
85
+ time.sleep(self.sleep)
82
86
  response = self.responses[self.i]
83
87
  if self.i < len(self.responses) - 1:
84
88
  self.i += 1
@@ -234,12 +234,39 @@ class JsonOutputKeyToolsParser(JsonOutputToolsParser):
234
234
  Returns:
235
235
  The parsed tool calls.
236
236
  """
237
- parsed_result = super().parse_result(result, partial=partial)
238
-
237
+ generation = result[0]
238
+ if not isinstance(generation, ChatGeneration):
239
+ msg = "This output parser can only be used with a chat generation."
240
+ raise OutputParserException(msg)
241
+ message = generation.message
242
+ if isinstance(message, AIMessage) and message.tool_calls:
243
+ parsed_tool_calls = [dict(tc) for tc in message.tool_calls]
244
+ for tool_call in parsed_tool_calls:
245
+ if not self.return_id:
246
+ _ = tool_call.pop("id")
247
+ else:
248
+ try:
249
+ raw_tool_calls = copy.deepcopy(message.additional_kwargs["tool_calls"])
250
+ except KeyError:
251
+ if self.first_tool_only:
252
+ return None
253
+ return []
254
+ parsed_tool_calls = parse_tool_calls(
255
+ raw_tool_calls,
256
+ partial=partial,
257
+ strict=self.strict,
258
+ return_id=self.return_id,
259
+ )
260
+ # For backwards compatibility
261
+ for tc in parsed_tool_calls:
262
+ tc["type"] = tc.pop("name")
239
263
  if self.first_tool_only:
264
+ parsed_result = list(
265
+ filter(lambda x: x["type"] == self.key_name, parsed_tool_calls)
266
+ )
240
267
  single_result = (
241
- parsed_result
242
- if parsed_result and parsed_result["type"] == self.key_name
268
+ parsed_result[0]
269
+ if parsed_result and parsed_result[0]["type"] == self.key_name
243
270
  else None
244
271
  )
245
272
  if self.return_id:
@@ -247,10 +274,13 @@ class JsonOutputKeyToolsParser(JsonOutputToolsParser):
247
274
  if single_result:
248
275
  return single_result["args"]
249
276
  return None
250
- parsed_result = [res for res in parsed_result if res["type"] == self.key_name]
251
- if not self.return_id:
252
- parsed_result = [res["args"] for res in parsed_result]
253
- return parsed_result
277
+ return (
278
+ [res for res in parsed_tool_calls if res["type"] == self.key_name]
279
+ if self.return_id
280
+ else [
281
+ res["args"] for res in parsed_tool_calls if res["type"] == self.key_name
282
+ ]
283
+ )
254
284
 
255
285
 
256
286
  # Common cause of ValidationError is truncated output due to max_tokens.
@@ -1,24 +1,23 @@
1
1
  """Output classes.
2
2
 
3
- **Output** classes are used to represent the output of a language model call
4
- and the output of a chat.
3
+ Used to represent the output of a language model call and the output of a chat.
5
4
 
6
- The top container for information is the `LLMResult` object. `LLMResult` is used by
7
- both chat models and LLMs. This object contains the output of the language
8
- model and any additional information that the model provider wants to return.
5
+ The top container for information is the `LLMResult` object. `LLMResult` is used by both
6
+ chat models and LLMs. This object contains the output of the language model and any
7
+ additional information that the model provider wants to return.
9
8
 
10
9
  When invoking models via the standard runnable methods (e.g. invoke, batch, etc.):
10
+
11
11
  - Chat models will return `AIMessage` objects.
12
12
  - LLMs will return regular text strings.
13
13
 
14
14
  In addition, users can access the raw output of either LLMs or chat models via
15
- callbacks. The on_chat_model_end and on_llm_end callbacks will return an
15
+ callbacks. The ``on_chat_model_end`` and ``on_llm_end`` callbacks will return an
16
16
  LLMResult object containing the generated outputs and any additional information
17
17
  returned by the model provider.
18
18
 
19
- In general, if information is already available
20
- in the AIMessage object, it is recommended to access it from there rather than
21
- from the `LLMResult` object.
19
+ In general, if information is already available in the AIMessage object, it is
20
+ recommended to access it from there rather than from the `LLMResult` object.
22
21
  """
23
22
 
24
23
  from typing import TYPE_CHECKING
@@ -27,7 +27,11 @@ class ChatGeneration(Generation):
27
27
  """
28
28
 
29
29
  text: str = ""
30
- """*SHOULD NOT BE SET DIRECTLY* The text contents of the output message."""
30
+ """The text contents of the output message.
31
+
32
+ .. warning::
33
+ SHOULD NOT BE SET DIRECTLY!
34
+ """
31
35
  message: BaseMessage
32
36
  """The message output by the chat model."""
33
37
  # Override type to be ChatGeneration, ignore mypy error as this is intentional
@@ -11,7 +11,8 @@ from langchain_core.utils._merge import merge_dicts
11
11
  class Generation(Serializable):
12
12
  """A single text generation output.
13
13
 
14
- Generation represents the response from an "old-fashioned" LLM that
14
+ Generation represents the response from an
15
+ `"old-fashioned" LLM <https://python.langchain.com/docs/concepts/text_llms/>__` that
15
16
  generates regular text (not chat messages).
16
17
 
17
18
  This model is used internally by chat model and will eventually
@@ -15,9 +15,9 @@ from langchain_core.outputs.run_info import RunInfo
15
15
  class LLMResult(BaseModel):
16
16
  """A container for results of an LLM call.
17
17
 
18
- Both chat models and LLMs generate an LLMResult object. This object contains
19
- the generated outputs and any additional information that the model provider
20
- wants to return.
18
+ Both chat models and LLMs generate an LLMResult object. This object contains the
19
+ generated outputs and any additional information that the model provider wants to
20
+ return.
21
21
  """
22
22
 
23
23
  generations: list[
@@ -25,17 +25,16 @@ class LLMResult(BaseModel):
25
25
  ]
26
26
  """Generated outputs.
27
27
 
28
- The first dimension of the list represents completions for different input
29
- prompts.
28
+ The first dimension of the list represents completions for different input prompts.
30
29
 
31
- The second dimension of the list represents different candidate generations
32
- for a given prompt.
30
+ The second dimension of the list represents different candidate generations for a
31
+ given prompt.
33
32
 
34
- When returned from an LLM the type is list[list[Generation]].
35
- When returned from a chat model the type is list[list[ChatGeneration]].
33
+ - When returned from **an LLM**, the type is ``list[list[Generation]]``.
34
+ - When returned from a **chat model**, the type is ``list[list[ChatGeneration]]``.
36
35
 
37
- ChatGeneration is a subclass of Generation that has a field for a structured
38
- chat message.
36
+ ChatGeneration is a subclass of Generation that has a field for a structured chat
37
+ message.
39
38
  """
40
39
  llm_output: Optional[dict] = None
41
40
  """For arbitrary LLM provider specific output.
@@ -43,9 +42,8 @@ class LLMResult(BaseModel):
43
42
  This dictionary is a free-form dictionary that can contain any information that the
44
43
  provider wants to return. It is not standardized and is provider-specific.
45
44
 
46
- Users should generally avoid relying on this field and instead rely on
47
- accessing relevant information from standardized fields present in
48
- AIMessage.
45
+ Users should generally avoid relying on this field and instead rely on accessing
46
+ relevant information from standardized fields present in AIMessage.
49
47
  """
50
48
  run: Optional[list[RunInfo]] = None
51
49
  """List of metadata info for model call for each input."""
@@ -146,13 +146,12 @@ class InMemoryRateLimiter(BaseRateLimiter):
146
146
 
147
147
  Args:
148
148
  requests_per_second: The number of tokens to add per second to the bucket.
149
- Must be at least 1. The tokens represent "credit" that can be used
150
- to make requests.
149
+ The tokens represent "credit" that can be used to make requests.
151
150
  check_every_n_seconds: check whether the tokens are available
152
151
  every this many seconds. Can be a float to represent
153
152
  fractions of a second.
154
153
  max_bucket_size: The maximum number of tokens that can be in the bucket.
155
- This is used to prevent bursts of requests.
154
+ Must be at least 1. Used to prevent bursts of requests.
156
155
  """
157
156
  # Number of requests that we can make per second.
158
157
  self.requests_per_second = requests_per_second
@@ -197,7 +197,14 @@ class StructuredTool(BaseTool):
197
197
  description_ = source_function.__doc__ or None
198
198
  if description_ is None and args_schema:
199
199
  if isinstance(args_schema, type) and is_basemodel_subclass(args_schema):
200
- description_ = args_schema.__doc__ or None
200
+ description_ = args_schema.__doc__
201
+ if (
202
+ description_
203
+ and "A base class for creating Pydantic models" in description_
204
+ ):
205
+ description_ = ""
206
+ elif not description_:
207
+ description_ = None
201
208
  elif isinstance(args_schema, dict):
202
209
  description_ = args_schema.get("description")
203
210
  else:
@@ -0,0 +1,122 @@
1
+ """Utilities for JSON Schema."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from copy import deepcopy
6
+ from typing import TYPE_CHECKING, Any, Optional
7
+
8
+ if TYPE_CHECKING:
9
+ from collections.abc import Sequence
10
+
11
+
12
+ def _retrieve_ref(path: str, schema: dict) -> dict:
13
+ components = path.split("/")
14
+ if components[0] != "#":
15
+ msg = (
16
+ "ref paths are expected to be URI fragments, meaning they should start "
17
+ "with #."
18
+ )
19
+ raise ValueError(msg)
20
+ out = schema
21
+ for component in components[1:]:
22
+ if component in out:
23
+ out = out[component]
24
+ elif component.isdigit():
25
+ index = int(component)
26
+ if (isinstance(out, list) and 0 <= index < len(out)) or (
27
+ isinstance(out, dict) and index in out
28
+ ):
29
+ out = out[index]
30
+ else:
31
+ msg = f"Reference '{path}' not found."
32
+ raise KeyError(msg)
33
+ else:
34
+ msg = f"Reference '{path}' not found."
35
+ raise KeyError(msg)
36
+ return deepcopy(out)
37
+
38
+
39
+ def _dereference_refs_helper(
40
+ obj: Any,
41
+ full_schema: dict[str, Any],
42
+ processed_refs: Optional[set[str]],
43
+ skip_keys: Sequence[str],
44
+ shallow_refs: bool, # noqa: FBT001
45
+ ) -> Any:
46
+ """Inline every pure {'$ref':...}.
47
+
48
+ But:
49
+ - if shallow_refs=True: only break cycles, do not inline nested refs
50
+ - if shallow_refs=False: deep-inline all nested refs
51
+
52
+ Also skip recursion under any key in skip_keys.
53
+ """
54
+ if processed_refs is None:
55
+ processed_refs = set()
56
+
57
+ # 1) Pure $ref node?
58
+ if isinstance(obj, dict) and set(obj.keys()) == {"$ref"}:
59
+ ref_path = obj["$ref"]
60
+ # cycle?
61
+ if ref_path in processed_refs:
62
+ return {}
63
+ processed_refs.add(ref_path)
64
+
65
+ # grab + copy the target
66
+ target = deepcopy(_retrieve_ref(ref_path, full_schema))
67
+
68
+ # deep inlining: recurse into everything
69
+ result = _dereference_refs_helper(
70
+ target, full_schema, processed_refs, skip_keys, shallow_refs
71
+ )
72
+
73
+ processed_refs.remove(ref_path)
74
+ return result
75
+
76
+ # 2) Not a pure-$ref: recurse, skipping any keys in skip_keys
77
+ if isinstance(obj, dict):
78
+ out: dict[str, Any] = {}
79
+ for k, v in obj.items():
80
+ if k in skip_keys:
81
+ # do not recurse under this key
82
+ out[k] = deepcopy(v)
83
+ elif isinstance(v, (dict, list)):
84
+ out[k] = _dereference_refs_helper(
85
+ v, full_schema, processed_refs, skip_keys, shallow_refs
86
+ )
87
+ else:
88
+ out[k] = v
89
+ return out
90
+
91
+ if isinstance(obj, list):
92
+ return [
93
+ _dereference_refs_helper(
94
+ item, full_schema, processed_refs, skip_keys, shallow_refs
95
+ )
96
+ for item in obj
97
+ ]
98
+
99
+ return obj
100
+
101
+
102
+ def dereference_refs(
103
+ schema_obj: dict,
104
+ *,
105
+ full_schema: Optional[dict] = None,
106
+ skip_keys: Optional[Sequence[str]] = None,
107
+ ) -> dict:
108
+ """Try to substitute $refs in JSON Schema.
109
+
110
+ Args:
111
+ schema_obj: The fragment to dereference.
112
+ full_schema: The complete schema (defaults to schema_obj).
113
+ skip_keys:
114
+ - If None (the default), we skip recursion under '$defs' *and* only
115
+ shallow-inline refs.
116
+ - If provided (even as an empty list), we will recurse under every key and
117
+ deep-inline all refs.
118
+ """
119
+ full = full_schema or schema_obj
120
+ keys_to_skip = list(skip_keys) if skip_keys is not None else ["$defs"]
121
+ shallow = skip_keys is None
122
+ return _dereference_refs_helper(schema_obj, full, None, keys_to_skip, shallow)
@@ -150,6 +150,11 @@ def parse_tag(template: str, l_del: str, r_del: str) -> tuple[tuple[str, str], s
150
150
  msg = f"unclosed tag at line {_CURRENT_LINE}"
151
151
  raise ChevronError(msg) from e
152
152
 
153
+ # Check for empty tags
154
+ if not tag.strip():
155
+ msg = f"empty tag at line {_CURRENT_LINE}"
156
+ raise ChevronError(msg)
157
+
153
158
  # Find the type meaning of the first character
154
159
  tag_type = tag_types.get(tag[0], "variable")
155
160
 
@@ -7,6 +7,7 @@ as they can change without notice.
7
7
  from __future__ import annotations
8
8
 
9
9
  import logging
10
+ import warnings
10
11
  from typing import TYPE_CHECKING, Union
11
12
 
12
13
  if TYPE_CHECKING:
@@ -46,6 +47,23 @@ def _cosine_similarity(x: Matrix, y: Matrix) -> np.ndarray:
46
47
 
47
48
  x = np.array(x)
48
49
  y = np.array(y)
50
+
51
+ # Check for NaN
52
+ if np.any(np.isnan(x)) or np.any(np.isnan(y)):
53
+ warnings.warn(
54
+ "NaN found in input arrays, unexpected return might follow",
55
+ category=RuntimeWarning,
56
+ stacklevel=2,
57
+ )
58
+
59
+ # Check for Inf
60
+ if np.any(np.isinf(x)) or np.any(np.isinf(y)):
61
+ warnings.warn(
62
+ "Inf found in input arrays, unexpected return might follow",
63
+ category=RuntimeWarning,
64
+ stacklevel=2,
65
+ )
66
+
49
67
  if x.shape[1] != y.shape[1]:
50
68
  msg = (
51
69
  f"Number of columns in X and Y must be the same. X has shape {x.shape} "
@@ -1,3 +1,3 @@
1
1
  """langchain-core version information and utilities."""
2
2
 
3
- VERSION = "0.3.69"
3
+ VERSION = "0.3.70"
@@ -17,7 +17,7 @@ dependencies = [
17
17
  "pydantic>=2.7.4",
18
18
  ]
19
19
  name = "langchain-core"
20
- version = "0.3.69"
20
+ version = "0.3.70"
21
21
  description = "Building applications with LLMs through composability"
22
22
  readme = "README.md"
23
23
 
@@ -1,5 +1,6 @@
1
1
  """Tests for verifying that testing utility code works as expected."""
2
2
 
3
+ import time
3
4
  from itertools import cycle
4
5
  from typing import Any, Optional, Union
5
6
  from uuid import UUID
@@ -9,10 +10,11 @@ from typing_extensions import override
9
10
  from langchain_core.callbacks.base import AsyncCallbackHandler
10
11
  from langchain_core.language_models import (
11
12
  FakeListChatModel,
13
+ FakeMessagesListChatModel,
12
14
  GenericFakeChatModel,
13
15
  ParrotFakeChatModel,
14
16
  )
15
- from langchain_core.messages import AIMessage, AIMessageChunk, BaseMessage
17
+ from langchain_core.messages import AIMessage, AIMessageChunk, BaseMessage, HumanMessage
16
18
  from langchain_core.outputs import ChatGenerationChunk, GenerationChunk
17
19
  from tests.unit_tests.stubs import (
18
20
  _any_id_ai_message,
@@ -230,3 +232,18 @@ def test_fake_list_chat_model_batch() -> None:
230
232
  fake = FakeListChatModel(responses=["a", "b", "c"])
231
233
  resp = fake.batch(["1", "2", "3"])
232
234
  assert resp == expected
235
+
236
+
237
+ def test_fake_messages_list_chat_model_sleep_delay() -> None:
238
+ sleep_time = 0.1
239
+ model = FakeMessagesListChatModel(
240
+ responses=[AIMessage(content="A"), AIMessage(content="B")],
241
+ sleep=sleep_time,
242
+ )
243
+ messages = [HumanMessage(content="C")]
244
+
245
+ start = time.time()
246
+ model.invoke(messages)
247
+ elapsed = time.time() - start
248
+
249
+ assert elapsed >= sleep_time