langchain-core 1.0.0a6__py3-none-any.whl → 1.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- langchain_core/__init__.py +1 -1
- langchain_core/_api/__init__.py +3 -4
- langchain_core/_api/beta_decorator.py +23 -26
- langchain_core/_api/deprecation.py +51 -64
- langchain_core/_api/path.py +3 -6
- langchain_core/_import_utils.py +3 -4
- langchain_core/agents.py +55 -48
- langchain_core/caches.py +65 -66
- langchain_core/callbacks/__init__.py +1 -8
- langchain_core/callbacks/base.py +321 -336
- langchain_core/callbacks/file.py +44 -44
- langchain_core/callbacks/manager.py +454 -514
- langchain_core/callbacks/stdout.py +29 -30
- langchain_core/callbacks/streaming_stdout.py +32 -32
- langchain_core/callbacks/usage.py +60 -57
- langchain_core/chat_history.py +53 -68
- langchain_core/document_loaders/base.py +27 -25
- langchain_core/document_loaders/blob_loaders.py +1 -1
- langchain_core/document_loaders/langsmith.py +44 -48
- langchain_core/documents/__init__.py +23 -3
- langchain_core/documents/base.py +102 -94
- langchain_core/documents/compressor.py +10 -10
- langchain_core/documents/transformers.py +34 -35
- langchain_core/embeddings/fake.py +50 -54
- langchain_core/example_selectors/length_based.py +2 -2
- langchain_core/example_selectors/semantic_similarity.py +28 -32
- langchain_core/exceptions.py +21 -20
- langchain_core/globals.py +3 -151
- langchain_core/indexing/__init__.py +1 -1
- langchain_core/indexing/api.py +121 -126
- langchain_core/indexing/base.py +73 -75
- langchain_core/indexing/in_memory.py +4 -6
- langchain_core/language_models/__init__.py +14 -29
- langchain_core/language_models/_utils.py +58 -61
- langchain_core/language_models/base.py +82 -172
- langchain_core/language_models/chat_models.py +329 -402
- langchain_core/language_models/fake.py +11 -11
- langchain_core/language_models/fake_chat_models.py +42 -36
- langchain_core/language_models/llms.py +189 -269
- langchain_core/load/dump.py +9 -12
- langchain_core/load/load.py +18 -28
- langchain_core/load/mapping.py +2 -4
- langchain_core/load/serializable.py +42 -40
- langchain_core/messages/__init__.py +10 -16
- langchain_core/messages/ai.py +148 -148
- langchain_core/messages/base.py +53 -51
- langchain_core/messages/block_translators/__init__.py +19 -22
- langchain_core/messages/block_translators/anthropic.py +6 -6
- langchain_core/messages/block_translators/bedrock_converse.py +5 -5
- langchain_core/messages/block_translators/google_genai.py +10 -7
- langchain_core/messages/block_translators/google_vertexai.py +4 -32
- langchain_core/messages/block_translators/groq.py +117 -21
- langchain_core/messages/block_translators/langchain_v0.py +5 -5
- langchain_core/messages/block_translators/openai.py +11 -11
- langchain_core/messages/chat.py +2 -6
- langchain_core/messages/content.py +339 -330
- langchain_core/messages/function.py +6 -10
- langchain_core/messages/human.py +24 -31
- langchain_core/messages/modifier.py +2 -2
- langchain_core/messages/system.py +19 -29
- langchain_core/messages/tool.py +74 -90
- langchain_core/messages/utils.py +484 -510
- langchain_core/output_parsers/__init__.py +13 -10
- langchain_core/output_parsers/base.py +61 -61
- langchain_core/output_parsers/format_instructions.py +9 -4
- langchain_core/output_parsers/json.py +12 -10
- langchain_core/output_parsers/list.py +21 -23
- langchain_core/output_parsers/openai_functions.py +49 -47
- langchain_core/output_parsers/openai_tools.py +30 -23
- langchain_core/output_parsers/pydantic.py +13 -14
- langchain_core/output_parsers/string.py +5 -5
- langchain_core/output_parsers/transform.py +15 -17
- langchain_core/output_parsers/xml.py +35 -34
- langchain_core/outputs/__init__.py +1 -1
- langchain_core/outputs/chat_generation.py +18 -18
- langchain_core/outputs/chat_result.py +1 -3
- langchain_core/outputs/generation.py +16 -16
- langchain_core/outputs/llm_result.py +10 -10
- langchain_core/prompt_values.py +13 -19
- langchain_core/prompts/__init__.py +3 -27
- langchain_core/prompts/base.py +81 -86
- langchain_core/prompts/chat.py +308 -351
- langchain_core/prompts/dict.py +6 -6
- langchain_core/prompts/few_shot.py +81 -88
- langchain_core/prompts/few_shot_with_templates.py +11 -13
- langchain_core/prompts/image.py +12 -14
- langchain_core/prompts/loading.py +4 -6
- langchain_core/prompts/message.py +7 -7
- langchain_core/prompts/prompt.py +24 -39
- langchain_core/prompts/string.py +26 -10
- langchain_core/prompts/structured.py +49 -53
- langchain_core/rate_limiters.py +51 -60
- langchain_core/retrievers.py +61 -198
- langchain_core/runnables/base.py +1551 -1656
- langchain_core/runnables/branch.py +68 -70
- langchain_core/runnables/config.py +72 -89
- langchain_core/runnables/configurable.py +145 -161
- langchain_core/runnables/fallbacks.py +102 -96
- langchain_core/runnables/graph.py +91 -97
- langchain_core/runnables/graph_ascii.py +27 -28
- langchain_core/runnables/graph_mermaid.py +42 -51
- langchain_core/runnables/graph_png.py +43 -16
- langchain_core/runnables/history.py +175 -177
- langchain_core/runnables/passthrough.py +151 -167
- langchain_core/runnables/retry.py +46 -51
- langchain_core/runnables/router.py +30 -35
- langchain_core/runnables/schema.py +75 -80
- langchain_core/runnables/utils.py +60 -67
- langchain_core/stores.py +85 -121
- langchain_core/structured_query.py +8 -8
- langchain_core/sys_info.py +29 -29
- langchain_core/tools/__init__.py +1 -14
- langchain_core/tools/base.py +306 -245
- langchain_core/tools/convert.py +160 -155
- langchain_core/tools/render.py +10 -10
- langchain_core/tools/retriever.py +12 -11
- langchain_core/tools/simple.py +19 -24
- langchain_core/tools/structured.py +32 -39
- langchain_core/tracers/__init__.py +1 -9
- langchain_core/tracers/base.py +97 -99
- langchain_core/tracers/context.py +29 -52
- langchain_core/tracers/core.py +49 -53
- langchain_core/tracers/evaluation.py +11 -11
- langchain_core/tracers/event_stream.py +65 -64
- langchain_core/tracers/langchain.py +21 -21
- langchain_core/tracers/log_stream.py +45 -45
- langchain_core/tracers/memory_stream.py +3 -3
- langchain_core/tracers/root_listeners.py +16 -16
- langchain_core/tracers/run_collector.py +2 -4
- langchain_core/tracers/schemas.py +0 -129
- langchain_core/tracers/stdout.py +3 -3
- langchain_core/utils/__init__.py +1 -4
- langchain_core/utils/_merge.py +2 -2
- langchain_core/utils/aiter.py +57 -61
- langchain_core/utils/env.py +9 -9
- langchain_core/utils/function_calling.py +94 -188
- langchain_core/utils/html.py +7 -8
- langchain_core/utils/input.py +9 -6
- langchain_core/utils/interactive_env.py +1 -1
- langchain_core/utils/iter.py +36 -40
- langchain_core/utils/json.py +4 -3
- langchain_core/utils/json_schema.py +9 -9
- langchain_core/utils/mustache.py +8 -10
- langchain_core/utils/pydantic.py +35 -37
- langchain_core/utils/strings.py +6 -9
- langchain_core/utils/usage.py +1 -1
- langchain_core/utils/utils.py +66 -62
- langchain_core/vectorstores/base.py +182 -216
- langchain_core/vectorstores/in_memory.py +101 -176
- langchain_core/vectorstores/utils.py +5 -5
- langchain_core/version.py +1 -1
- langchain_core-1.0.4.dist-info/METADATA +69 -0
- langchain_core-1.0.4.dist-info/RECORD +172 -0
- {langchain_core-1.0.0a6.dist-info → langchain_core-1.0.4.dist-info}/WHEEL +1 -1
- langchain_core/memory.py +0 -120
- langchain_core/messages/block_translators/ollama.py +0 -47
- langchain_core/prompts/pipeline.py +0 -138
- langchain_core/pydantic_v1/__init__.py +0 -30
- langchain_core/pydantic_v1/dataclasses.py +0 -23
- langchain_core/pydantic_v1/main.py +0 -23
- langchain_core/tracers/langchain_v1.py +0 -31
- langchain_core/utils/loading.py +0 -35
- langchain_core-1.0.0a6.dist-info/METADATA +0 -67
- langchain_core-1.0.0a6.dist-info/RECORD +0 -181
- langchain_core-1.0.0a6.dist-info/entry_points.txt +0 -4
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
langchain_core/__init__.py,sha256=5oThb0zpZmmoQFL0jqYB3GgBrXAJUSj5ZJ2GwVnR7IQ,711
|
|
2
|
+
langchain_core/_import_utils.py,sha256=PdYzgXd1wraCcECcMvJQpthmN3i__5h7mYVmFyLpq_s,1423
|
|
3
|
+
langchain_core/agents.py,sha256=rDGe9yGoJ58oimbSYS-AHIEdNYmMcP2qkOBT6hv1YlA,8411
|
|
4
|
+
langchain_core/caches.py,sha256=1KMHqAR79--0QfHkShgROFhY1iySKbRCg0J1TnQccXY,9704
|
|
5
|
+
langchain_core/chat_history.py,sha256=4qHGs0z4pQBHhQHX6kypGZu1GxcM76yn6gGaOe-uZ0w,8475
|
|
6
|
+
langchain_core/chat_loaders.py,sha256=b57Gl3KGPxq9gYJjetsHfJm1I6kSqi7bDE91fJJOR84,601
|
|
7
|
+
langchain_core/chat_sessions.py,sha256=YEO3ck5_wRGd3a2EnGD7M_wTvNC_4T1IVjQWekagwaM,564
|
|
8
|
+
langchain_core/env.py,sha256=RHExSWJ2bW-6Wxb6UyBGxU5flLoNYOAeslZ9iTjomQE,598
|
|
9
|
+
langchain_core/exceptions.py,sha256=z6EngfvINRQkIBWDfK6JE5CvAM8pfun1MOBWuPLqRVk,3340
|
|
10
|
+
langchain_core/globals.py,sha256=jO27FstGK1cyzNT096GD9lFq2YgNxY1DZ6NtA_yKdR8,1852
|
|
11
|
+
langchain_core/prompt_values.py,sha256=K1GsNqDsE6X3vlyl7JCz-zAdpKn4v3z8RmEVglEAsfQ,3846
|
|
12
|
+
langchain_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
langchain_core/rate_limiters.py,sha256=_4yijdFLvg0Qw7gNvXcKsystymJrgS76vUwRIgVSnjY,9379
|
|
14
|
+
langchain_core/retrievers.py,sha256=SXnCc_85rNcLeMa-SjvkijXpFw-I7SVTWYgV1gJQimg,11125
|
|
15
|
+
langchain_core/stores.py,sha256=g8aa_VvXf93-Q25QMXX_sBoKC99nu3FtyC4INOUJ3WY,9181
|
|
16
|
+
langchain_core/structured_query.py,sha256=mat7BKovKjckzMn3-I1El49yeGjg3cqk4ptpJHAPA-4,5123
|
|
17
|
+
langchain_core/sys_info.py,sha256=SEFI7XL2qpx1lis6cB45o6ZKtRCZWVXwEngU3UGMgrE,3806
|
|
18
|
+
langchain_core/version.py,sha256=jsSUK0COG4FbOhVVZciwojkcMijh4NASlpjwDN7HBpA,75
|
|
19
|
+
langchain_core/_api/__init__.py,sha256=PYm_j7qRRKh5ca0TTra5UF-nko3ieZZZ5EeAFAinm3o,1973
|
|
20
|
+
langchain_core/_api/beta_decorator.py,sha256=IJgG2_kRb2eBmvHfarDjanJY4k1jwoPJWSOHZ5SLB4U,8664
|
|
21
|
+
langchain_core/_api/deprecation.py,sha256=nReAhxZ1dBwLhHdGAaqqRpf7aLQJ1dw4UtqmrRqeNLE,20296
|
|
22
|
+
langchain_core/_api/internal.py,sha256=aOZkYANu747LyWzyAk-0KE4RjdTYj18Wtlh7F9_qyPM,683
|
|
23
|
+
langchain_core/_api/path.py,sha256=y3dAvsG4JS0BuWErpJ5KhxCykJX2i03kYdeDU-Iup3Y,1349
|
|
24
|
+
langchain_core/callbacks/__init__.py,sha256=8FK0gmkWnbDYWrShBQowg0OK06Hprdim3sxiOla80xk,4225
|
|
25
|
+
langchain_core/callbacks/base.py,sha256=I0LBEFdUiFKxya1G4026Fp47Uz3qfcgg8pCr28-UQL0,34017
|
|
26
|
+
langchain_core/callbacks/file.py,sha256=eD1TBPnEzms0amUV_GnNbfLOPF7Et7Z-sCv6fl-7h38,8332
|
|
27
|
+
langchain_core/callbacks/manager.py,sha256=w5PuRBT9VwLmOSj-ZJ57ZXDGjxPtCCSOquWM2xUtlpY,85312
|
|
28
|
+
langchain_core/callbacks/stdout.py,sha256=dy7jTcYFVKpaYesJoakEcAraBLwhjFR5Efjw91EZY8c,3695
|
|
29
|
+
langchain_core/callbacks/streaming_stdout.py,sha256=ylgpp4Bhs5Gv1aNeZWuuC2FU7C3IO7Q9CpEDxCgdFXY,4310
|
|
30
|
+
langchain_core/callbacks/usage.py,sha256=NGtm_P287FAEGXd6Ci4ZGouywYtNwsoHKno6O9H_zg8,5073
|
|
31
|
+
langchain_core/document_loaders/__init__.py,sha256=DkZPp9cEVmsnz9SM1xtuefH_fGQFvA2WtpRG6iePPBs,975
|
|
32
|
+
langchain_core/document_loaders/base.py,sha256=jxmjKXl4mu5EaHwzSrQgNMz7HH2PNvj5RKSrdTXvXDs,4764
|
|
33
|
+
langchain_core/document_loaders/blob_loaders.py,sha256=9u5VaQ7hNrdzO2fKCJsUZecQQg6FU50D43TSvFr7sD4,1079
|
|
34
|
+
langchain_core/document_loaders/langsmith.py,sha256=Vmz_cBSTZzKDDVFXrz26PtUTtSky7Vz6rJ9LfT_CeaE,5258
|
|
35
|
+
langchain_core/documents/__init__.py,sha256=c2DA_AHhYVFQQxbyujXl3Uu4w3hJkWpWWoXNOKbwz00,1940
|
|
36
|
+
langchain_core/documents/base.py,sha256=P9Zt75YL40nNFhZ9w0B-1EzjFlsCkOymsCpCti2SABc,11099
|
|
37
|
+
langchain_core/documents/compressor.py,sha256=2y-Vyf9woO4rSJ2W8mcdE5XDANVgfkWU0pLGJmmPvhw,2017
|
|
38
|
+
langchain_core/documents/transformers.py,sha256=wtwHxIPVYXM-_XmCP9K3NpUhquUoB6y2PFg6MKYbbnI,2543
|
|
39
|
+
langchain_core/embeddings/__init__.py,sha256=0SfcdkVSSXmTFXznUyeZq_b1ajpwIGDueGAAfwyMpUY,774
|
|
40
|
+
langchain_core/embeddings/embeddings.py,sha256=u50T2VxLLyfGBCKcVtWfSiZrtKua8sOSHwSSHRKtcno,2405
|
|
41
|
+
langchain_core/embeddings/fake.py,sha256=PCpx32UPKRZzdBjVCzLFM-qTd3CsoLhIM1QTjCGash0,3886
|
|
42
|
+
langchain_core/example_selectors/__init__.py,sha256=k8y0chtEhaHf8Y1_nZVDsb9CWDdRIWFb9U806mnbGvo,1394
|
|
43
|
+
langchain_core/example_selectors/base.py,sha256=4wRCERHak6Ci5JEKHeidQ_pbBgzQyc-vnQsz2sqBFzA,1716
|
|
44
|
+
langchain_core/example_selectors/length_based.py,sha256=IcM89ho2xmFLan2-wL29YyUfRwSCg4z8hWLqerx-YSc,3366
|
|
45
|
+
langchain_core/example_selectors/semantic_similarity.py,sha256=Rh_-8vZi58gwn7Qa3Tk30zsvx7RiPIjFWw2_sfwKHfQ,13577
|
|
46
|
+
langchain_core/indexing/__init__.py,sha256=KD9ArRpfVccb1fyk2t1QWqrBv1dfyk_Zg9fuSt-BzLQ,1276
|
|
47
|
+
langchain_core/indexing/api.py,sha256=ci6jS21Fxi63tszZR0EvRq8pHLedW1dIaL0srMgUIUE,38381
|
|
48
|
+
langchain_core/indexing/base.py,sha256=rHZNecyskIjRR8L4B5Q-XQgeoVZFI1HUjfox_ExIebM,22449
|
|
49
|
+
langchain_core/indexing/in_memory.py,sha256=eML8Wtg9m4nOI7RFdoyXWxgxSfrOCEUJn-ipoRbkJOc,3283
|
|
50
|
+
langchain_core/language_models/__init__.py,sha256=vhD0sTo9w2VKoR63NojWywv8jfoJEcP6inIkNtY6qa0,3296
|
|
51
|
+
langchain_core/language_models/_utils.py,sha256=6Xpqb0fO4KKnA6mX5XfHbmm2xs2TizcqVGfxaj42sOA,11045
|
|
52
|
+
langchain_core/language_models/base.py,sha256=Srzk6Rp4XIAMXHYU2cSbbceFKytuXHU4Y9jgaVSIXJQ,11014
|
|
53
|
+
langchain_core/language_models/chat_models.py,sha256=KuMG91oqZL3dMSf1qRBtY3R6WyI3WVqDF8PqFiJ8a0E,72405
|
|
54
|
+
langchain_core/language_models/fake.py,sha256=hb2yU3snYPTueZiJ-0KI0MKHYBNm6zdUw7xe8WqguEY,3732
|
|
55
|
+
langchain_core/language_models/fake_chat_models.py,sha256=kzvrYAI6gVaY76PPTApMWTn8ZCgJymOPsUaPZLlali4,13509
|
|
56
|
+
langchain_core/language_models/llms.py,sha256=7nCj0J38aFF--ATYab7e4GZNnlRjxBrLmFu6Rwa9dh4,54118
|
|
57
|
+
langchain_core/load/__init__.py,sha256=m3_6Fk2gpYZO0xqyTnZzdQigvsYHjMariLq_L2KwJFk,1150
|
|
58
|
+
langchain_core/load/dump.py,sha256=DEO-m_bBPyzFCIvxJND-p4iGuNISeWbl8jzcDICt3Bw,2616
|
|
59
|
+
langchain_core/load/load.py,sha256=LQJqeERSO5mlqImCDMLXDwmtpvEssVJJi3Iau7qpY4M,9283
|
|
60
|
+
langchain_core/load/mapping.py,sha256=SqBaAWAM2aV_Wgy80DAlS-39tJkHLcCyM45bVVnN12w,29513
|
|
61
|
+
langchain_core/load/serializable.py,sha256=pm0kA1HZ_wOp0TkJvTbj5bxu0hFWZ0OzQV1BKbVK4jM,11683
|
|
62
|
+
langchain_core/messages/__init__.py,sha256=hrsxGO0wLEIr81gpu2cL89kV6PeiW1yY-G0rhqYYXms,5723
|
|
63
|
+
langchain_core/messages/ai.py,sha256=vS4GXL0K_dganLZxo_RBVWaVbVKwU4lfey-6jSCqkYo,27458
|
|
64
|
+
langchain_core/messages/base.py,sha256=j4_GZ6kn6n4ZczZE8O_-1mNNd2BrkaKBIX4pPnBNJKE,16447
|
|
65
|
+
langchain_core/messages/chat.py,sha256=t9az-R1De2HdiEhhpGyIFonCqY03UAkqMdvttx11rhM,2204
|
|
66
|
+
langchain_core/messages/content.py,sha256=M4icC9tEEVBORdcm_W0MqL6QFTFxnx1tpzh7JGvGNAo,41962
|
|
67
|
+
langchain_core/messages/function.py,sha256=RlkcFREWGgAlnD0psOOWc2kQa7wVZ-kJBl-mi-UIcdw,2094
|
|
68
|
+
langchain_core/messages/human.py,sha256=Sgx58Kwlb1y_YaeOXavz1D0V2ald_TAdqlC5zQI_Rz4,2130
|
|
69
|
+
langchain_core/messages/modifier.py,sha256=8d3mhHnKMDU9Xkw_M3-uf5WBtqA4dZj81tD7A6Zgo_o,875
|
|
70
|
+
langchain_core/messages/system.py,sha256=x8OBdba68Nt3SiO7aNTaDREq3iDjDV4XyRoqb-ZOmgo,2140
|
|
71
|
+
langchain_core/messages/tool.py,sha256=MMklOAPd2e0OAGxM3Iode_Bm3bC74_icN3HnL2FPCig,12584
|
|
72
|
+
langchain_core/messages/utils.py,sha256=CXARduPzvNERth0wcqOUJt06RwFCNEGQPdVdfsfaG9A,68766
|
|
73
|
+
langchain_core/messages/block_translators/__init__.py,sha256=_CxgFIR8hrxROFl1dzRNwkL4cgL-TxxpYQBn-26zP4A,4244
|
|
74
|
+
langchain_core/messages/block_translators/anthropic.py,sha256=eN304DgrEFTRl12f4PmU4P8ASTUngMkE7HC9-gpYUGk,19131
|
|
75
|
+
langchain_core/messages/block_translators/bedrock.py,sha256=yLjYwtCsYGHBEj9CSXHCZYLmwsA4F6D6NTT5kE11Bww,3511
|
|
76
|
+
langchain_core/messages/block_translators/bedrock_converse.py,sha256=YN7xfKPbxjVJujOzEuXbDx3QiDql1ldbLCYQ6bgH6FI,11994
|
|
77
|
+
langchain_core/messages/block_translators/google_genai.py,sha256=STcn7J0kZf25M8rYwL02pxth-nbAAeQ_MXqjBdAStL4,22271
|
|
78
|
+
langchain_core/messages/block_translators/google_vertexai.py,sha256=2RzpKFKi1991aWGK8osdkKq8bKadmy8q86kR3r0f6K4,632
|
|
79
|
+
langchain_core/messages/block_translators/groq.py,sha256=s7xCVITYV2W3CqZpc3OO7hXQRICLqNi8hyPofT2OvqM,5444
|
|
80
|
+
langchain_core/messages/block_translators/langchain_v0.py,sha256=WAoQGt1qZ5rVZD5n1A1z0dR-DpN6vgrn-gSII1CxhCA,11658
|
|
81
|
+
langchain_core/messages/block_translators/openai.py,sha256=YAb6lgCJvFYZg5tjhQbN-VmHyBJSnJgFTE5JO2k9ht4,39261
|
|
82
|
+
langchain_core/output_parsers/__init__.py,sha256=g5MPrD8sJK8jeZRCICvWRp-dtAq1jqy-fF-wS5egr5Q,3487
|
|
83
|
+
langchain_core/output_parsers/base.py,sha256=HeXUl8zdqaYG_KOPWmi-A4YWyDhPuGD78ZOLoH6XoLQ,11161
|
|
84
|
+
langchain_core/output_parsers/format_instructions.py,sha256=HK-KjPfQfBNj0V_ato0_GN7PFsC-Wixt8V2Q515FdJk,1108
|
|
85
|
+
langchain_core/output_parsers/json.py,sha256=cN9skZzIJZOyhUnmFwo_0YPemRwICdQa2a_28pphLlU,4648
|
|
86
|
+
langchain_core/output_parsers/list.py,sha256=uF6V2MAfu7zdKCIFeve4QbE5mFZkYBPwPqF9qjFqCck,7253
|
|
87
|
+
langchain_core/output_parsers/openai_functions.py,sha256=4tyd1riGCOjEOftIsMT1jbrXNv1HWrcGhHEg-K1M4Tw,10597
|
|
88
|
+
langchain_core/output_parsers/openai_tools.py,sha256=Pc80ZIdal27NG-zCFcQ8eKAV9HfoLdOV4hGs8JUthWU,12817
|
|
89
|
+
langchain_core/output_parsers/pydantic.py,sha256=5dDtxNPGqFXIkvSoAGU9sPDc1yJrYmpMaO9m7CPokrE,4444
|
|
90
|
+
langchain_core/output_parsers/string.py,sha256=8XgjoeKSc39TN8HMXjMgxcE0vvP6b4kk9GZ6HmnAKDQ,969
|
|
91
|
+
langchain_core/output_parsers/transform.py,sha256=FyYvkS1KnAHX9afF1qqdJbUBa_xUyDTvspPQBq8G5uM,5835
|
|
92
|
+
langchain_core/output_parsers/xml.py,sha256=3OATmB5Ej_6FNCJwkKLX-tyBH1pA2PvdS3JyVKWn-Lc,10974
|
|
93
|
+
langchain_core/outputs/__init__.py,sha256=CLL4IYb-N18gSXLscJVNWDL2LapGieXJF5EhG8uQSvE,2115
|
|
94
|
+
langchain_core/outputs/chat_generation.py,sha256=sD-wCAFWuzADKM7swf9EEaNJmRsEAfZT6tLi00UfPDY,4733
|
|
95
|
+
langchain_core/outputs/chat_result.py,sha256=ZXLGUtb5xqJdoCtAX1XeiJf20ELx6gui7DUHH0rKnv8,1324
|
|
96
|
+
langchain_core/outputs/generation.py,sha256=q_TAIL0_NRkfCK6zsMVJ69G6iiDcJ0TTgoWRlcUtOf0,2564
|
|
97
|
+
langchain_core/outputs/llm_result.py,sha256=srdoHk-Vk2Xh40XMYAgfsFwGFmvyk2NOkUkvb6U_xZ8,3894
|
|
98
|
+
langchain_core/outputs/run_info.py,sha256=xCMWdsHfgnnodaf4OCMvZaWUfS836X7mV15JPkqvZjo,594
|
|
99
|
+
langchain_core/prompts/__init__.py,sha256=gXRJkxl6z7AYTGyyQAF0DQYpbwCUvfCFwXFfhSekzDw,3033
|
|
100
|
+
langchain_core/prompts/base.py,sha256=83WlSPJ3c23S5ctHtcThuiVFSuTOYV3aGFOliY8S5bQ,15772
|
|
101
|
+
langchain_core/prompts/chat.py,sha256=hE9ZsoyfhN4CcapDsWLsj5e_3QmqWY_Th0bV2LVnMMI,50242
|
|
102
|
+
langchain_core/prompts/dict.py,sha256=kSMonougSG-o7BZP1PG9L_Vxkf-Xwzjhn1dHJ9j4Cs8,4700
|
|
103
|
+
langchain_core/prompts/few_shot.py,sha256=FaVMuen4eG0B-lnSr2-jGC_JMOhYoK1tfG-pJgYfcmg,15794
|
|
104
|
+
langchain_core/prompts/few_shot_with_templates.py,sha256=aKDMxKFmmK8mzAP6I35vpxQUApLs-9AGKCgNcYK9GlA,7804
|
|
105
|
+
langchain_core/prompts/image.py,sha256=L_5yGsI68Y0pwthA3AS0mQXFMXtvW_kBRItFS6Vpk14,4780
|
|
106
|
+
langchain_core/prompts/loading.py,sha256=hvNsDvqLz5wJA1EywW2wCwKUhJgUzNcIKfp5VEVOEGc,6889
|
|
107
|
+
langchain_core/prompts/message.py,sha256=lonlnWOjDYjmxltD_NA2Z24XiiracUj912nQIF47eQE,2632
|
|
108
|
+
langchain_core/prompts/prompt.py,sha256=TcQZNc-Y6c7CMJwY1HwMvRYU4NcbMdCw6YS37Tc3pWk,10948
|
|
109
|
+
langchain_core/prompts/string.py,sha256=aXr9xhZo4WZqvsBqMWb6Nag5C5Ukqz2fMTRqDx8JaHc,10974
|
|
110
|
+
langchain_core/prompts/structured.py,sha256=Uzh1PBLXzGyZ-4m4W-cMHz8nqL1XmMri8OOkoSSJiq8,5790
|
|
111
|
+
langchain_core/runnables/__init__.py,sha256=efTnFjwN_QSAv5ThLmKuWeu8P1BLARH-cWKZBuimfDM,3858
|
|
112
|
+
langchain_core/runnables/base.py,sha256=vUR1HWB28OkWBWNm03qLCYaewCAWrNguqH9ob-7vJsY,216503
|
|
113
|
+
langchain_core/runnables/branch.py,sha256=Wviy59agVKhbwD_GlMZz-HP5pXZgw5oI5MJb1nyQiuc,15776
|
|
114
|
+
langchain_core/runnables/config.py,sha256=w2f2BeYbiXIuXxYJCrmSDIh7LgwSyF-7p92W-sxrbKU,19103
|
|
115
|
+
langchain_core/runnables/configurable.py,sha256=1FalcSplZ2EITuV-g-TxMoDiS3eZT32OF33ZLjxftd0,24053
|
|
116
|
+
langchain_core/runnables/fallbacks.py,sha256=60WZ8RoIlE69HsYqAyLncbdh0OhcBxbwvV3NYZogdyk,24468
|
|
117
|
+
langchain_core/runnables/graph.py,sha256=mLQcI0XbUDYDXHnDbsybdo1odqSlkitcBEfglY56ihA,22950
|
|
118
|
+
langchain_core/runnables/graph_ascii.py,sha256=le9njNqnDYtu1znTWGIyZYstEaiYuxBk9Qx8r7yfoXc,10328
|
|
119
|
+
langchain_core/runnables/graph_mermaid.py,sha256=k615r8Q641pb_rpjTlmVc5fTlMco-1IIxQI8t3kBceE,16725
|
|
120
|
+
langchain_core/runnables/graph_png.py,sha256=pdt7_sRPJw38vkKixdb1yYB78kaxIA5ijnAdjJFt3l4,6473
|
|
121
|
+
langchain_core/runnables/history.py,sha256=5vvSniD6rjPai3bnxp2WxyTMW2jSHxqN0cZflnjoJs4,24264
|
|
122
|
+
langchain_core/runnables/passthrough.py,sha256=OwSGfJAz1uh54ORppmrQozMe5xDOpM2iB2HhjGkdnjo,26230
|
|
123
|
+
langchain_core/runnables/retry.py,sha256=eG2LUH0cgIzH7Xe7aVbdYww-04f_o74GRd1VxTocjjU,13682
|
|
124
|
+
langchain_core/runnables/router.py,sha256=oY_PZb3Mh5Z7j4eBVMO_sXP_f6EapxV0NHknhdQw2rA,7134
|
|
125
|
+
langchain_core/runnables/schema.py,sha256=elc_pen9QvLkM2MoH7QqjRMqDS0yylwjvbl_gdeOD5Y,5719
|
|
126
|
+
langchain_core/runnables/utils.py,sha256=p_QDnwJ7XcO7bl-QBdoSksNJixeMlYcr41ZAPmZTMiU,22176
|
|
127
|
+
langchain_core/tools/__init__.py,sha256=qe2E9VwZ7hpdkToz96oSJ080a0de9oQwSO9FP1XnmM0,2518
|
|
128
|
+
langchain_core/tools/base.py,sha256=ejOqr0b-gJC1keQ666HgJv0kl_Q-F2WLhFs5UXlk5ts,51395
|
|
129
|
+
langchain_core/tools/convert.py,sha256=xuvdirFB3a3A_qPN14-msXAvVt0dSUPMzD9iQUZzX8E,16258
|
|
130
|
+
langchain_core/tools/render.py,sha256=gD3pXYWjCaDKsYq_MZ-yCRXl1wUJbOh6dJobda9VjYM,1817
|
|
131
|
+
langchain_core/tools/retriever.py,sha256=hPdBhK8QBK2bRpyNMtq7VtA1qnTRQurRMRjPbVDNG-k,3791
|
|
132
|
+
langchain_core/tools/simple.py,sha256=U9R5jIUcZMXKMV5Ezu8G2MX_0ot2nrtvhjgaGHkA53o,6623
|
|
133
|
+
langchain_core/tools/structured.py,sha256=KV9u6S33rI0VBPwpA6ZmPtt08j8LZjMDnEgX5EhiDaw,9205
|
|
134
|
+
langchain_core/tracers/__init__.py,sha256=Yf0CQ-IcBa8f9lu0wMA_looT6Q8we3C0yd-xMP3c0Sc,1362
|
|
135
|
+
langchain_core/tracers/_streaming.py,sha256=U9pWQDJNUDH4oOYF3zvUMUtgkCecJzXQvfo-wYARmhQ,982
|
|
136
|
+
langchain_core/tracers/base.py,sha256=cywwNDlynmidmhOCQ8A1J0qhnvN_orWNB8z2UjvCEGs,25454
|
|
137
|
+
langchain_core/tracers/context.py,sha256=-7pbOA3QR0OIeehpD9eMpqugGgwLc_XxMjVQRg8GAJI,6194
|
|
138
|
+
langchain_core/tracers/core.py,sha256=doyEB6enQVeGYFbC5EmC_gVGq6tcZQpYXm4bXVaI11c,23306
|
|
139
|
+
langchain_core/tracers/evaluation.py,sha256=XmoPqBNFg6H-9K46fWanABAEVUgbob9S7qU-DPcL4RM,8367
|
|
140
|
+
langchain_core/tracers/event_stream.py,sha256=bzsu65tlXntEw2tfzSFDpbYVd638RkSBX59V4VoaZLQ,34966
|
|
141
|
+
langchain_core/tracers/langchain.py,sha256=juy0i7aryBuqWuML9EiNrAI6SAv2qllt5hAE6mC_0HQ,10477
|
|
142
|
+
langchain_core/tracers/log_stream.py,sha256=9Z43KQD7ZWwEZIUwaFmcFlcoscH1HlKRk6HQPm_xzs8,25425
|
|
143
|
+
langchain_core/tracers/memory_stream.py,sha256=4bPh6Fhoq84Ul03wIasEju34GHKXj_c9xTIm6nAFG-8,4995
|
|
144
|
+
langchain_core/tracers/root_listeners.py,sha256=6ZE56m7zyVzMXtUPztifkX409rdaXTXZcJIYlS69xls,4097
|
|
145
|
+
langchain_core/tracers/run_collector.py,sha256=Uy8lwFLDgMtLmzIi9RlBY-xXs9NRQoNSNekluuZzqxI,1265
|
|
146
|
+
langchain_core/tracers/schemas.py,sha256=-B159J_A1pLdmN6GLR3yM2S_KozJWawKaFc7vI2xXaU,191
|
|
147
|
+
langchain_core/tracers/stdout.py,sha256=E8TXpAiKJeLf8hnnBLUie0dINY8V2d7iPyGu5O0OwYg,6715
|
|
148
|
+
langchain_core/utils/__init__.py,sha256=yn6ZGHMxi7MjqojSBkT2sCxYRpo76zAIBcKnTRaJ2Pc,3041
|
|
149
|
+
langchain_core/utils/_merge.py,sha256=9wTZdkuG45azGBze7OZFFIoCiidHi3roe6TQiQ5bcV0,7536
|
|
150
|
+
langchain_core/utils/aiter.py,sha256=gfFyGWro42FB4R66_tWSyW8XrLLzV7EI9EmLvI8dFGI,10574
|
|
151
|
+
langchain_core/utils/env.py,sha256=pQTqZLCjcueoxTd8epc3cr0lRn8njJf_A-bOQfHWPXw,2458
|
|
152
|
+
langchain_core/utils/formatting.py,sha256=fkieArzKXxSsLcEa3B-MX60O4ZLeeLjiPtVtxCJPcOU,1480
|
|
153
|
+
langchain_core/utils/function_calling.py,sha256=N_Fv9fpTTai1FffQQUZPfaW9qnpD-V9nkYy4_0v0xPw,27546
|
|
154
|
+
langchain_core/utils/html.py,sha256=ReIdqTTC8r-AfsqynFjCIaFC9t9sI_vYnmz3DanpVqQ,3714
|
|
155
|
+
langchain_core/utils/image.py,sha256=1MH8Lbg0f2HfhTC4zobKMvpVoHRfpsyvWHq9ae4xENo,532
|
|
156
|
+
langchain_core/utils/input.py,sha256=PYuiFKHhygAkM5yp5vxHqJe5Qnz1oay7k5cwx7hGocs,1999
|
|
157
|
+
langchain_core/utils/interactive_env.py,sha256=LBgNICNAwgwDMOdlVD12TtZfSboPOKXaBS2Jn-bsXQ8,289
|
|
158
|
+
langchain_core/utils/iter.py,sha256=jqtyfA2129a5ftfuRovpUBEslCGaeuiiGr8bkT-iozI,7300
|
|
159
|
+
langchain_core/utils/json.py,sha256=Jsa-EuPLj5sSYDOAIzM7g1-7gsgfXgCs8KLNQ3x1-O4,6533
|
|
160
|
+
langchain_core/utils/json_schema.py,sha256=d0yHW6D_IoM7sLGOLxSGcSpAnaYROaqbwmjk7XhvZZ4,9071
|
|
161
|
+
langchain_core/utils/mustache.py,sha256=2LgatBIOa1bGU4EaL5xrS076NWqfQkB4Mtencmc3mtQ,21262
|
|
162
|
+
langchain_core/utils/pydantic.py,sha256=XyzBLtf_5MhOvGCfHiIlMgb7-0PKUpx-aU3NQlS3Dxo,18465
|
|
163
|
+
langchain_core/utils/strings.py,sha256=DGhj7CxgxcYIdvMu3Ug93BtayNFaRvyIecgIaxZOa1g,1721
|
|
164
|
+
langchain_core/utils/usage.py,sha256=vB674Eu69xDGx6JBJlySp6cnePkxCD0Wz26mi502NAM,1211
|
|
165
|
+
langchain_core/utils/utils.py,sha256=EqczXbgT_IqCkZOU1MJ33mrp2ZHUAeUkVXol4y-euc0,16192
|
|
166
|
+
langchain_core/vectorstores/__init__.py,sha256=5P0eoeoH5LHab64JjmEeWa6SxX4eMy-etAP1MEHsETY,804
|
|
167
|
+
langchain_core/vectorstores/base.py,sha256=fNFdTXoKeQ-ok8TBtpdueVtmkJAEjTH_eccvcdpCovE,40784
|
|
168
|
+
langchain_core/vectorstores/in_memory.py,sha256=FCNG8w50qGS0ZCwIcTmaU5QFprkuLS7ntlgH3YUIkzc,15719
|
|
169
|
+
langchain_core/vectorstores/utils.py,sha256=XXpQ2mxado6vrLmZWVTstcxrurBtoHcBZEORITAHWw0,4931
|
|
170
|
+
langchain_core-1.0.4.dist-info/METADATA,sha256=M9RKsUpIcOh8wjMvm6sX_x7pPMqprzhgVLp2X3_wOEk,3478
|
|
171
|
+
langchain_core-1.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
172
|
+
langchain_core-1.0.4.dist-info/RECORD,,
|
langchain_core/memory.py
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"""**Memory** maintains Chain state, incorporating context from past runs.
|
|
2
|
-
|
|
3
|
-
This module contains memory abstractions from LangChain v0.0.x.
|
|
4
|
-
|
|
5
|
-
These abstractions are now deprecated and will be removed in LangChain v1.0.0.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from __future__ import annotations
|
|
9
|
-
|
|
10
|
-
from abc import ABC, abstractmethod
|
|
11
|
-
from typing import Any
|
|
12
|
-
|
|
13
|
-
from pydantic import ConfigDict
|
|
14
|
-
|
|
15
|
-
from langchain_core._api import deprecated
|
|
16
|
-
from langchain_core.load.serializable import Serializable
|
|
17
|
-
from langchain_core.runnables import run_in_executor
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@deprecated(
|
|
21
|
-
since="0.3.3",
|
|
22
|
-
removal="1.0.0",
|
|
23
|
-
message=(
|
|
24
|
-
"Please see the migration guide at: "
|
|
25
|
-
"https://python.langchain.com/docs/versions/migrating_memory/"
|
|
26
|
-
),
|
|
27
|
-
)
|
|
28
|
-
class BaseMemory(Serializable, ABC):
|
|
29
|
-
"""Abstract base class for memory in Chains.
|
|
30
|
-
|
|
31
|
-
Memory refers to state in Chains. Memory can be used to store information about
|
|
32
|
-
past executions of a Chain and inject that information into the inputs of
|
|
33
|
-
future executions of the Chain. For example, for conversational Chains Memory
|
|
34
|
-
can be used to store conversations and automatically add them to future model
|
|
35
|
-
prompts so that the model has the necessary context to respond coherently to
|
|
36
|
-
the latest input.
|
|
37
|
-
|
|
38
|
-
Example:
|
|
39
|
-
.. code-block:: python
|
|
40
|
-
|
|
41
|
-
class SimpleMemory(BaseMemory):
|
|
42
|
-
memories: dict[str, Any] = dict()
|
|
43
|
-
|
|
44
|
-
@property
|
|
45
|
-
def memory_variables(self) -> list[str]:
|
|
46
|
-
return list(self.memories.keys())
|
|
47
|
-
|
|
48
|
-
def load_memory_variables(
|
|
49
|
-
self, inputs: dict[str, Any]
|
|
50
|
-
) -> dict[str, str]:
|
|
51
|
-
return self.memories
|
|
52
|
-
|
|
53
|
-
def save_context(
|
|
54
|
-
self, inputs: dict[str, Any], outputs: dict[str, str]
|
|
55
|
-
) -> None:
|
|
56
|
-
pass
|
|
57
|
-
|
|
58
|
-
def clear(self) -> None:
|
|
59
|
-
pass
|
|
60
|
-
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
model_config = ConfigDict(
|
|
64
|
-
arbitrary_types_allowed=True,
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
@property
|
|
68
|
-
@abstractmethod
|
|
69
|
-
def memory_variables(self) -> list[str]:
|
|
70
|
-
"""The string keys this memory class will add to chain inputs."""
|
|
71
|
-
|
|
72
|
-
@abstractmethod
|
|
73
|
-
def load_memory_variables(self, inputs: dict[str, Any]) -> dict[str, Any]:
|
|
74
|
-
"""Return key-value pairs given the text input to the chain.
|
|
75
|
-
|
|
76
|
-
Args:
|
|
77
|
-
inputs: The inputs to the chain.
|
|
78
|
-
|
|
79
|
-
Returns:
|
|
80
|
-
A dictionary of key-value pairs.
|
|
81
|
-
"""
|
|
82
|
-
|
|
83
|
-
async def aload_memory_variables(self, inputs: dict[str, Any]) -> dict[str, Any]:
|
|
84
|
-
"""Async return key-value pairs given the text input to the chain.
|
|
85
|
-
|
|
86
|
-
Args:
|
|
87
|
-
inputs: The inputs to the chain.
|
|
88
|
-
|
|
89
|
-
Returns:
|
|
90
|
-
A dictionary of key-value pairs.
|
|
91
|
-
"""
|
|
92
|
-
return await run_in_executor(None, self.load_memory_variables, inputs)
|
|
93
|
-
|
|
94
|
-
@abstractmethod
|
|
95
|
-
def save_context(self, inputs: dict[str, Any], outputs: dict[str, str]) -> None:
|
|
96
|
-
"""Save the context of this chain run to memory.
|
|
97
|
-
|
|
98
|
-
Args:
|
|
99
|
-
inputs: The inputs to the chain.
|
|
100
|
-
outputs: The outputs of the chain.
|
|
101
|
-
"""
|
|
102
|
-
|
|
103
|
-
async def asave_context(
|
|
104
|
-
self, inputs: dict[str, Any], outputs: dict[str, str]
|
|
105
|
-
) -> None:
|
|
106
|
-
"""Async save the context of this chain run to memory.
|
|
107
|
-
|
|
108
|
-
Args:
|
|
109
|
-
inputs: The inputs to the chain.
|
|
110
|
-
outputs: The outputs of the chain.
|
|
111
|
-
"""
|
|
112
|
-
await run_in_executor(None, self.save_context, inputs, outputs)
|
|
113
|
-
|
|
114
|
-
@abstractmethod
|
|
115
|
-
def clear(self) -> None:
|
|
116
|
-
"""Clear memory contents."""
|
|
117
|
-
|
|
118
|
-
async def aclear(self) -> None:
|
|
119
|
-
"""Async clear memory contents."""
|
|
120
|
-
await run_in_executor(None, self.clear)
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"""Derivations of standard content blocks from Ollama content."""
|
|
2
|
-
|
|
3
|
-
import warnings
|
|
4
|
-
|
|
5
|
-
from langchain_core.messages import AIMessage, AIMessageChunk
|
|
6
|
-
from langchain_core.messages import content as types
|
|
7
|
-
|
|
8
|
-
WARNED = False
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def translate_content(message: AIMessage) -> list[types.ContentBlock]: # noqa: ARG001
|
|
12
|
-
"""Derive standard content blocks from a message with Ollama content."""
|
|
13
|
-
global WARNED # noqa: PLW0603
|
|
14
|
-
if not WARNED:
|
|
15
|
-
warning_message = (
|
|
16
|
-
"Content block standardization is not yet fully supported for Ollama."
|
|
17
|
-
)
|
|
18
|
-
warnings.warn(warning_message, stacklevel=2)
|
|
19
|
-
WARNED = True
|
|
20
|
-
raise NotImplementedError
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def translate_content_chunk(message: AIMessageChunk) -> list[types.ContentBlock]: # noqa: ARG001
|
|
24
|
-
"""Derive standard content blocks from a message chunk with Ollama content."""
|
|
25
|
-
global WARNED # noqa: PLW0603
|
|
26
|
-
if not WARNED:
|
|
27
|
-
warning_message = (
|
|
28
|
-
"Content block standardization is not yet fully supported for Ollama."
|
|
29
|
-
)
|
|
30
|
-
warnings.warn(warning_message, stacklevel=2)
|
|
31
|
-
WARNED = True
|
|
32
|
-
raise NotImplementedError
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def _register_ollama_translator() -> None:
|
|
36
|
-
"""Register the Ollama translator with the central registry.
|
|
37
|
-
|
|
38
|
-
Run automatically when the module is imported.
|
|
39
|
-
"""
|
|
40
|
-
from langchain_core.messages.block_translators import ( # noqa: PLC0415
|
|
41
|
-
register_translator,
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
register_translator("ollama", translate_content, translate_content_chunk)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
_register_ollama_translator()
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"""[DEPRECATED] Pipeline prompt template."""
|
|
2
|
-
|
|
3
|
-
from typing import Any
|
|
4
|
-
|
|
5
|
-
from pydantic import model_validator
|
|
6
|
-
|
|
7
|
-
from langchain_core._api.deprecation import deprecated
|
|
8
|
-
from langchain_core.prompt_values import PromptValue
|
|
9
|
-
from langchain_core.prompts.base import BasePromptTemplate
|
|
10
|
-
from langchain_core.prompts.chat import BaseChatPromptTemplate
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_inputs(inputs: dict, input_variables: list[str]) -> dict:
|
|
14
|
-
return {k: inputs[k] for k in input_variables}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@deprecated(
|
|
18
|
-
since="0.3.22",
|
|
19
|
-
removal="1.0",
|
|
20
|
-
message=(
|
|
21
|
-
"This class is deprecated in favor of chaining individual prompts together."
|
|
22
|
-
),
|
|
23
|
-
)
|
|
24
|
-
class PipelinePromptTemplate(BasePromptTemplate):
|
|
25
|
-
"""Pipeline prompt template.
|
|
26
|
-
|
|
27
|
-
This has been deprecated in favor of chaining individual prompts together in your
|
|
28
|
-
code; e.g. using a for loop, you could do:
|
|
29
|
-
|
|
30
|
-
.. code-block:: python
|
|
31
|
-
|
|
32
|
-
my_input = {"key": "value"}
|
|
33
|
-
for name, prompt in pipeline_prompts:
|
|
34
|
-
my_input[name] = prompt.invoke(my_input).to_string()
|
|
35
|
-
my_output = final_prompt.invoke(my_input)
|
|
36
|
-
|
|
37
|
-
Prompt template for composing multiple prompt templates together.
|
|
38
|
-
|
|
39
|
-
This can be useful when you want to reuse parts of prompts.
|
|
40
|
-
|
|
41
|
-
A PipelinePrompt consists of two main parts:
|
|
42
|
-
|
|
43
|
-
- final_prompt: This is the final prompt that is returned
|
|
44
|
-
- pipeline_prompts: This is a list of tuples, consisting
|
|
45
|
-
of a string (``name``) and a Prompt Template.
|
|
46
|
-
Each PromptTemplate will be formatted and then passed
|
|
47
|
-
to future prompt templates as a variable with
|
|
48
|
-
the same name as ``name``
|
|
49
|
-
|
|
50
|
-
"""
|
|
51
|
-
|
|
52
|
-
final_prompt: BasePromptTemplate
|
|
53
|
-
"""The final prompt that is returned."""
|
|
54
|
-
pipeline_prompts: list[tuple[str, BasePromptTemplate]]
|
|
55
|
-
"""A list of tuples, consisting of a string (``name``) and a Prompt Template."""
|
|
56
|
-
|
|
57
|
-
@classmethod
|
|
58
|
-
def get_lc_namespace(cls) -> list[str]:
|
|
59
|
-
"""Get the namespace of the langchain object.
|
|
60
|
-
|
|
61
|
-
Returns:
|
|
62
|
-
``["langchain", "prompts", "pipeline"]``
|
|
63
|
-
"""
|
|
64
|
-
return ["langchain", "prompts", "pipeline"]
|
|
65
|
-
|
|
66
|
-
@model_validator(mode="before")
|
|
67
|
-
@classmethod
|
|
68
|
-
def get_input_variables(cls, values: dict) -> Any:
|
|
69
|
-
"""Get input variables."""
|
|
70
|
-
created_variables = set()
|
|
71
|
-
all_variables = set()
|
|
72
|
-
for k, prompt in values["pipeline_prompts"]:
|
|
73
|
-
created_variables.add(k)
|
|
74
|
-
all_variables.update(prompt.input_variables)
|
|
75
|
-
values["input_variables"] = list(all_variables.difference(created_variables))
|
|
76
|
-
return values
|
|
77
|
-
|
|
78
|
-
def format_prompt(self, **kwargs: Any) -> PromptValue:
|
|
79
|
-
"""Format the prompt with the inputs.
|
|
80
|
-
|
|
81
|
-
Args:
|
|
82
|
-
kwargs: Any arguments to be passed to the prompt template.
|
|
83
|
-
|
|
84
|
-
Returns:
|
|
85
|
-
A formatted string.
|
|
86
|
-
"""
|
|
87
|
-
for k, prompt in self.pipeline_prompts:
|
|
88
|
-
inputs = _get_inputs(kwargs, prompt.input_variables)
|
|
89
|
-
if isinstance(prompt, BaseChatPromptTemplate):
|
|
90
|
-
kwargs[k] = prompt.format_messages(**inputs)
|
|
91
|
-
else:
|
|
92
|
-
kwargs[k] = prompt.format(**inputs)
|
|
93
|
-
inputs = _get_inputs(kwargs, self.final_prompt.input_variables)
|
|
94
|
-
return self.final_prompt.format_prompt(**inputs)
|
|
95
|
-
|
|
96
|
-
async def aformat_prompt(self, **kwargs: Any) -> PromptValue:
|
|
97
|
-
"""Async format the prompt with the inputs.
|
|
98
|
-
|
|
99
|
-
Args:
|
|
100
|
-
kwargs: Any arguments to be passed to the prompt template.
|
|
101
|
-
|
|
102
|
-
Returns:
|
|
103
|
-
A formatted string.
|
|
104
|
-
"""
|
|
105
|
-
for k, prompt in self.pipeline_prompts:
|
|
106
|
-
inputs = _get_inputs(kwargs, prompt.input_variables)
|
|
107
|
-
if isinstance(prompt, BaseChatPromptTemplate):
|
|
108
|
-
kwargs[k] = await prompt.aformat_messages(**inputs)
|
|
109
|
-
else:
|
|
110
|
-
kwargs[k] = await prompt.aformat(**inputs)
|
|
111
|
-
inputs = _get_inputs(kwargs, self.final_prompt.input_variables)
|
|
112
|
-
return await self.final_prompt.aformat_prompt(**inputs)
|
|
113
|
-
|
|
114
|
-
def format(self, **kwargs: Any) -> str:
|
|
115
|
-
"""Format the prompt with the inputs.
|
|
116
|
-
|
|
117
|
-
Args:
|
|
118
|
-
kwargs: Any arguments to be passed to the prompt template.
|
|
119
|
-
|
|
120
|
-
Returns:
|
|
121
|
-
A formatted string.
|
|
122
|
-
"""
|
|
123
|
-
return self.format_prompt(**kwargs).to_string()
|
|
124
|
-
|
|
125
|
-
async def aformat(self, **kwargs: Any) -> str:
|
|
126
|
-
"""Async format the prompt with the inputs.
|
|
127
|
-
|
|
128
|
-
Args:
|
|
129
|
-
kwargs: Any arguments to be passed to the prompt template.
|
|
130
|
-
|
|
131
|
-
Returns:
|
|
132
|
-
A formatted string.
|
|
133
|
-
"""
|
|
134
|
-
return (await self.aformat_prompt(**kwargs)).to_string()
|
|
135
|
-
|
|
136
|
-
@property
|
|
137
|
-
def _prompt_type(self) -> str:
|
|
138
|
-
raise ValueError
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"""Pydantic v1 compatibility shim."""
|
|
2
|
-
|
|
3
|
-
from importlib import metadata
|
|
4
|
-
|
|
5
|
-
from pydantic.v1 import * # noqa: F403
|
|
6
|
-
|
|
7
|
-
from langchain_core._api.deprecation import warn_deprecated
|
|
8
|
-
|
|
9
|
-
try:
|
|
10
|
-
_PYDANTIC_MAJOR_VERSION: int = int(metadata.version("pydantic").split(".")[0])
|
|
11
|
-
except metadata.PackageNotFoundError:
|
|
12
|
-
_PYDANTIC_MAJOR_VERSION = 0
|
|
13
|
-
|
|
14
|
-
warn_deprecated(
|
|
15
|
-
"0.3.0",
|
|
16
|
-
removal="1.0.0",
|
|
17
|
-
alternative="pydantic.v1 or pydantic",
|
|
18
|
-
message=(
|
|
19
|
-
"As of langchain-core 0.3.0, LangChain uses pydantic v2 internally. "
|
|
20
|
-
"The langchain_core.pydantic_v1 module was a "
|
|
21
|
-
"compatibility shim for pydantic v1, and should no longer be used. "
|
|
22
|
-
"Please update the code to import from Pydantic directly.\n\n"
|
|
23
|
-
"For example, replace imports like: "
|
|
24
|
-
"`from langchain_core.pydantic_v1 import BaseModel`\n"
|
|
25
|
-
"with: `from pydantic import BaseModel`\n"
|
|
26
|
-
"or the v1 compatibility namespace if you are working in a code base "
|
|
27
|
-
"that has not been fully upgraded to pydantic 2 yet. "
|
|
28
|
-
"\tfrom pydantic.v1 import BaseModel\n"
|
|
29
|
-
),
|
|
30
|
-
)
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"""Pydantic v1 compatibility shim."""
|
|
2
|
-
|
|
3
|
-
from pydantic.v1.dataclasses import * # noqa: F403
|
|
4
|
-
|
|
5
|
-
from langchain_core._api import warn_deprecated
|
|
6
|
-
|
|
7
|
-
warn_deprecated(
|
|
8
|
-
"0.3.0",
|
|
9
|
-
removal="1.0.0",
|
|
10
|
-
alternative="pydantic.v1 or pydantic",
|
|
11
|
-
message=(
|
|
12
|
-
"As of langchain-core 0.3.0, LangChain uses pydantic v2 internally. "
|
|
13
|
-
"The langchain_core.pydantic_v1 module was a "
|
|
14
|
-
"compatibility shim for pydantic v1, and should no longer be used. "
|
|
15
|
-
"Please update the code to import from Pydantic directly.\n\n"
|
|
16
|
-
"For example, replace imports like: "
|
|
17
|
-
"`from langchain_core.pydantic_v1 import BaseModel`\n"
|
|
18
|
-
"with: `from pydantic import BaseModel`\n"
|
|
19
|
-
"or the v1 compatibility namespace if you are working in a code base "
|
|
20
|
-
"that has not been fully upgraded to pydantic 2 yet. "
|
|
21
|
-
"\tfrom pydantic.v1 import BaseModel\n"
|
|
22
|
-
),
|
|
23
|
-
)
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"""Pydantic v1 compatibility shim."""
|
|
2
|
-
|
|
3
|
-
from pydantic.v1.main import * # noqa: F403
|
|
4
|
-
|
|
5
|
-
from langchain_core._api import warn_deprecated
|
|
6
|
-
|
|
7
|
-
warn_deprecated(
|
|
8
|
-
"0.3.0",
|
|
9
|
-
removal="1.0.0",
|
|
10
|
-
alternative="pydantic.v1 or pydantic",
|
|
11
|
-
message=(
|
|
12
|
-
"As of langchain-core 0.3.0, LangChain uses pydantic v2 internally. "
|
|
13
|
-
"The langchain_core.pydantic_v1 module was a "
|
|
14
|
-
"compatibility shim for pydantic v1, and should no longer be used. "
|
|
15
|
-
"Please update the code to import from Pydantic directly.\n\n"
|
|
16
|
-
"For example, replace imports like: "
|
|
17
|
-
"`from langchain_core.pydantic_v1 import BaseModel`\n"
|
|
18
|
-
"with: `from pydantic import BaseModel`\n"
|
|
19
|
-
"or the v1 compatibility namespace if you are working in a code base "
|
|
20
|
-
"that has not been fully upgraded to pydantic 2 yet. "
|
|
21
|
-
"\tfrom pydantic.v1 import BaseModel\n"
|
|
22
|
-
),
|
|
23
|
-
)
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"""This module is deprecated and will be removed in a future release.
|
|
2
|
-
|
|
3
|
-
Please use LangChainTracer instead.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from typing import Any
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def get_headers(*args: Any, **kwargs: Any) -> Any: # noqa: ARG001
|
|
10
|
-
"""Throw an error because this has been replaced by get_headers.
|
|
11
|
-
|
|
12
|
-
Raises:
|
|
13
|
-
RuntimeError: Always, because this function is deprecated.
|
|
14
|
-
"""
|
|
15
|
-
msg = (
|
|
16
|
-
"get_headers for LangChainTracerV1 is no longer supported. "
|
|
17
|
-
"Please use LangChainTracer instead."
|
|
18
|
-
)
|
|
19
|
-
raise RuntimeError(msg)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def LangChainTracerV1(*args: Any, **kwargs: Any) -> Any: # noqa: N802,ARG001
|
|
23
|
-
"""Throw an error because this has been replaced by ``LangChainTracer``.
|
|
24
|
-
|
|
25
|
-
Raises:
|
|
26
|
-
RuntimeError: Always, because this class is deprecated.
|
|
27
|
-
"""
|
|
28
|
-
msg = (
|
|
29
|
-
"LangChainTracerV1 is no longer supported. Please use LangChainTracer instead."
|
|
30
|
-
)
|
|
31
|
-
raise RuntimeError(msg)
|
langchain_core/utils/loading.py
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"""Utilities for loading configurations from langchain_core-hub."""
|
|
2
|
-
|
|
3
|
-
import warnings
|
|
4
|
-
from typing import Any
|
|
5
|
-
|
|
6
|
-
from langchain_core._api.deprecation import deprecated
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@deprecated(
|
|
10
|
-
since="0.1.30",
|
|
11
|
-
removal="1.0",
|
|
12
|
-
message=(
|
|
13
|
-
"Using the hwchase17/langchain-hub "
|
|
14
|
-
"repo for prompts is deprecated. Please use "
|
|
15
|
-
"<https://smith.langchain.com/hub> instead."
|
|
16
|
-
),
|
|
17
|
-
)
|
|
18
|
-
def try_load_from_hub(
|
|
19
|
-
*args: Any, # noqa: ARG001
|
|
20
|
-
**kwargs: Any, # noqa: ARG001
|
|
21
|
-
) -> Any:
|
|
22
|
-
"""[DEPRECATED] Try to load from the old Hub.
|
|
23
|
-
|
|
24
|
-
Returns:
|
|
25
|
-
None always, indicating that we shouldn't load from the old hub.
|
|
26
|
-
"""
|
|
27
|
-
warnings.warn(
|
|
28
|
-
"Loading from the deprecated github-based Hub is no longer supported. "
|
|
29
|
-
"Please use the new LangChain Hub at https://smith.langchain.com/hub instead.",
|
|
30
|
-
DeprecationWarning,
|
|
31
|
-
stacklevel=2,
|
|
32
|
-
)
|
|
33
|
-
# return None, which indicates that we shouldn't load from old hub
|
|
34
|
-
# and might just be a filepath for e.g. load_chain
|
|
35
|
-
return None
|