langchain 0.3.24__py3-none-any.whl → 0.3.25__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.

Potentially problematic release.


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

@@ -584,6 +584,9 @@ class OpenAIAssistantRunnable(RunnableSerializable[dict, OutputType]):
584
584
  answer: Any = [
585
585
  msg_content for msg in new_messages for msg_content in msg.content
586
586
  ]
587
+ attachments = [
588
+ attachment for msg in new_messages for attachment in msg.attachments
589
+ ]
587
590
  if all(
588
591
  (
589
592
  isinstance(content, openai.types.beta.threads.TextContentBlock)
@@ -601,6 +604,7 @@ class OpenAIAssistantRunnable(RunnableSerializable[dict, OutputType]):
601
604
  "output": answer,
602
605
  "thread_id": run.thread_id,
603
606
  "run_id": run.id,
607
+ "attachments": attachments,
604
608
  },
605
609
  log="",
606
610
  run_id=run.id,
@@ -35,6 +35,8 @@ def create_sql_query_chain(
35
35
  db: SQLDatabase,
36
36
  prompt: Optional[BasePromptTemplate] = None,
37
37
  k: int = 5,
38
+ *,
39
+ get_col_comments: Optional[bool] = None,
38
40
  ) -> Runnable[Union[SQLInput, SQLInputWithTables, dict[str, Any]], str]:
39
41
  """Create a chain that generates SQL queries.
40
42
 
@@ -59,6 +61,8 @@ def create_sql_query_chain(
59
61
  prompt: The prompt to use. If none is provided, will choose one
60
62
  based on dialect. Defaults to None. See Prompt section below for more.
61
63
  k: The number of results per select statement to return. Defaults to 5.
64
+ get_col_comments: Whether to retrieve column comments along with table info.
65
+ Defaults to False.
62
66
 
63
67
  Returns:
64
68
  A chain that takes in a question and generates a SQL query that answers
@@ -127,10 +131,22 @@ def create_sql_query_chain(
127
131
  if "dialect" in prompt_to_use.input_variables:
128
132
  prompt_to_use = prompt_to_use.partial(dialect=db.dialect)
129
133
 
134
+ table_info_kwargs = {}
135
+ if get_col_comments:
136
+ if db.dialect not in ("postgresql", "mysql", "oracle"):
137
+ raise ValueError(
138
+ f"get_col_comments=True is only supported for dialects "
139
+ f"'postgresql', 'mysql', and 'oracle'. Received dialect: "
140
+ f"{db.dialect}"
141
+ )
142
+ else:
143
+ table_info_kwargs["get_col_comments"] = True
144
+
130
145
  inputs = {
131
146
  "input": lambda x: x["question"] + "\nSQLQuery: ",
132
147
  "table_info": lambda x: db.get_table_info(
133
- table_names=x.get("table_names_to_use")
148
+ table_names=x.get("table_names_to_use"),
149
+ **table_info_kwargs,
134
150
  ),
135
151
  }
136
152
  return (
@@ -2,7 +2,6 @@ import functools
2
2
  from importlib import util
3
3
  from typing import Any, Optional, Union
4
4
 
5
- from langchain_core._api import beta
6
5
  from langchain_core.embeddings import Embeddings
7
6
  from langchain_core.runnables import Runnable
8
7
 
@@ -116,7 +115,6 @@ def _check_pkg(pkg: str) -> None:
116
115
  )
117
116
 
118
117
 
119
- @beta()
120
118
  def init_embeddings(
121
119
  model: str,
122
120
  *,
@@ -331,7 +331,7 @@ def _validate_example_inputs_for_language_model(
331
331
  input_mapper: Optional[Callable[[dict], Any]],
332
332
  ) -> None:
333
333
  if input_mapper:
334
- prompt_input = input_mapper(first_example.inputs)
334
+ prompt_input = input_mapper(first_example.inputs or {})
335
335
  if not isinstance(prompt_input, str) and not (
336
336
  isinstance(prompt_input, list)
337
337
  and all(isinstance(msg, BaseMessage) for msg in prompt_input)
@@ -344,10 +344,10 @@ def _validate_example_inputs_for_language_model(
344
344
  )
345
345
  else:
346
346
  try:
347
- _get_prompt(first_example.inputs)
347
+ _get_prompt(first_example.inputs or {})
348
348
  except InputFormatError:
349
349
  try:
350
- _get_messages(first_example.inputs)
350
+ _get_messages(first_example.inputs or {})
351
351
  except InputFormatError:
352
352
  raise InputFormatError(
353
353
  "Example inputs do not match language model input format. "
@@ -366,7 +366,7 @@ def _validate_example_inputs_for_chain(
366
366
  ) -> None:
367
367
  """Validate that the example inputs match the chain input keys."""
368
368
  if input_mapper:
369
- first_inputs = input_mapper(first_example.inputs)
369
+ first_inputs = input_mapper(first_example.inputs or {})
370
370
  missing_keys = set(chain.input_keys).difference(first_inputs)
371
371
  if not isinstance(first_inputs, dict):
372
372
  raise InputFormatError(
@@ -780,7 +780,7 @@ async def _arun_llm_or_chain(
780
780
  if isinstance(llm_or_chain_factory, BaseLanguageModel):
781
781
  output: Any = await _arun_llm(
782
782
  llm_or_chain_factory,
783
- example.inputs,
783
+ example.inputs or {},
784
784
  tags=config["tags"],
785
785
  callbacks=config["callbacks"],
786
786
  input_mapper=input_mapper,
@@ -790,7 +790,7 @@ async def _arun_llm_or_chain(
790
790
  chain = llm_or_chain_factory()
791
791
  output = await _arun_chain(
792
792
  chain,
793
- example.inputs,
793
+ example.inputs or {},
794
794
  tags=config["tags"],
795
795
  callbacks=config["callbacks"],
796
796
  input_mapper=input_mapper,
@@ -932,7 +932,7 @@ def _run_llm_or_chain(
932
932
  if isinstance(llm_or_chain_factory, BaseLanguageModel):
933
933
  output: Any = _run_llm(
934
934
  llm_or_chain_factory,
935
- example.inputs,
935
+ example.inputs or {},
936
936
  config["callbacks"],
937
937
  tags=config["tags"],
938
938
  input_mapper=input_mapper,
@@ -942,7 +942,7 @@ def _run_llm_or_chain(
942
942
  chain = llm_or_chain_factory()
943
943
  output = _run_chain(
944
944
  chain,
945
- example.inputs,
945
+ example.inputs or {},
946
946
  config["callbacks"],
947
947
  tags=config["tags"],
948
948
  input_mapper=input_mapper,
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import uuid
5
6
  from abc import abstractmethod
6
7
  from typing import Any, Optional
7
8
 
@@ -325,7 +326,10 @@ class StringRunEvaluatorChain(Chain, RunEvaluator):
325
326
  return feedback
326
327
 
327
328
  def evaluate_run(
328
- self, run: Run, example: Optional[Example] = None
329
+ self,
330
+ run: Run,
331
+ example: Optional[Example] = None,
332
+ evaluator_run_id: Optional[uuid.UUID] = None,
329
333
  ) -> EvaluationResult:
330
334
  """Evaluate an example."""
331
335
  try:
@@ -339,7 +343,10 @@ class StringRunEvaluatorChain(Chain, RunEvaluator):
339
343
  )
340
344
 
341
345
  async def aevaluate_run(
342
- self, run: Run, example: Optional[Example] = None
346
+ self,
347
+ run: Run,
348
+ example: Optional[Example] = None,
349
+ evaluator_run_id: Optional[uuid.UUID] = None,
343
350
  ) -> EvaluationResult:
344
351
  """Evaluate an example."""
345
352
  try:
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain
3
- Version: 0.3.24
3
+ Version: 0.3.25
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/langchain
7
7
  Project-URL: Release Notes, https://github.com/langchain-ai/langchain/releases?q=tag%3A%22langchain%3D%3D0%22&expanded=true
8
8
  Project-URL: repository, https://github.com/langchain-ai/langchain
9
- Requires-Python: <4.0,>=3.9
10
- Requires-Dist: langchain-core<1.0.0,>=0.3.55
9
+ Requires-Python: >=3.9
10
+ Requires-Dist: langchain-core<1.0.0,>=0.3.58
11
11
  Requires-Dist: langchain-text-splitters<1.0.0,>=0.3.8
12
12
  Requires-Dist: langsmith<0.4,>=0.1.17
13
13
  Requires-Dist: pydantic<3.0.0,>=2.7.4
@@ -1,7 +1,7 @@
1
- langchain-0.3.24.dist-info/METADATA,sha256=_BuNOYbGhysW_lJakq9aeBWMg9pVocC43MrWhywexSY,7846
2
- langchain-0.3.24.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- langchain-0.3.24.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- langchain-0.3.24.dist-info/licenses/LICENSE,sha256=TsZ-TKbmch26hJssqCJhWXyGph7iFLvyFBYAa3stBHg,1067
1
+ langchain-0.3.25.dist-info/METADATA,sha256=Vy4OJSZ6ar5e5kZjTvEYYOalLiD6ATd88kJkfuxyKKs,7841
2
+ langchain-0.3.25.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ langchain-0.3.25.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ langchain-0.3.25.dist-info/licenses/LICENSE,sha256=TsZ-TKbmch26hJssqCJhWXyGph7iFLvyFBYAa3stBHg,1067
5
5
  langchain/__init__.py,sha256=4cqV-N_QJnfjk52DqtR2e72vsmJC1R6PkflvRdLjZQI,13709
6
6
  langchain/_api/__init__.py,sha256=0FuHuMNUBMrst1Y1nm5yZzQr2xbLmb7rxMsimqKBXhs,733
7
7
  langchain/_api/deprecation.py,sha256=K9VCkmMs_ebfd_wCJppKq4Ahw-mlXkukbsQ69iQVxT0,1246
@@ -115,7 +115,7 @@ langchain/agents/mrkl/base.py,sha256=kkXmm8T_3RyhqT-8l1vWe4QUfONkKI28Q_Om03IzT3k
115
115
  langchain/agents/mrkl/output_parser.py,sha256=YQGSjQq5pR4kFUg1HrOS3laV6xgtHgtIOQ_TtJY0UFI,3720
116
116
  langchain/agents/mrkl/prompt.py,sha256=2dTMP2lAWiLvCtuEijgQRjbKDlbPEnmx77duMwdJ7e4,641
117
117
  langchain/agents/openai_assistant/__init__.py,sha256=Xssaqoxrix3hn1gKSOLmDRQzTxAoJk0ProGXmXQe8Mw,114
118
- langchain/agents/openai_assistant/base.py,sha256=JZcvnubJ08pxK1qomH7wKPQOFKKgmtcdDiA5x9_lnAE,30377
118
+ langchain/agents/openai_assistant/base.py,sha256=aGosEMmbyNH5Dd6uhylTZ9MeLpsP8GcP11VkWAxpJbE,30552
119
119
  langchain/agents/openai_functions_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
120
  langchain/agents/openai_functions_agent/agent_token_buffer_memory.py,sha256=_Czey8clGH7ldn1yl_8_L-RVSCGGHiKeRWxmdeQ1phw,3752
121
121
  langchain/agents/openai_functions_agent/base.py,sha256=nPzAvXXiqiuE0oY2H_kdtrFtxTjG_T_2JrYXJgpSCYA,13446
@@ -338,7 +338,7 @@ langchain/chains/router/multi_retrieval_qa.py,sha256=0LMZinYl0G7tDYh-I6eBOy54oxk
338
338
  langchain/chains/sequential.py,sha256=mroXm1uj-D3iA_MxiZT_FnTMngYLcEQWA8loclbqvcs,7487
339
339
  langchain/chains/sql_database/__init__.py,sha256=jQotWN4EWMD98Jk-f7rqh5YtbXbP9XXA0ypLGq8NgrM,47
340
340
  langchain/chains/sql_database/prompt.py,sha256=q3C6BbmWtNYXWV-9qHnyux5trsM3fjlRLuYNPTlpdR4,15454
341
- langchain/chains/sql_database/query.py,sha256=1KoRNhP6S0Z2y-nm5XQ6DKEsCxcXq38H_q9twF0pXb8,5423
341
+ langchain/chains/sql_database/query.py,sha256=kSEveCV-Y2b3mwe-sfT20UI57_jByaTucmYmzywLsEY,6037
342
342
  langchain/chains/structured_output/__init__.py,sha256=-6nFe-gznavFc3XCMv8XkEzuXoto2rI8Q-bcruVPOR8,204
343
343
  langchain/chains/structured_output/base.py,sha256=qnALOtvJq5SEN5aRfzU3cdxGB9dmEr_jrHt-FMlilA8,25472
344
344
  langchain/chains/summarize/__init__.py,sha256=mg1lKtH_x-oJ5qvKY6OD7g9kkqbjMVbL3l3OhfozSQM,151
@@ -581,7 +581,7 @@ langchain/embeddings/aleph_alpha.py,sha256=_yTqGDHsHbh83Zp0MjJ497ilIxkEJm5ccmxOW
581
581
  langchain/embeddings/awa.py,sha256=1cnMiwKKU3ml3Zz5s5WIpcZSlYNVFFGCaeJilrxN8HE,626
582
582
  langchain/embeddings/azure_openai.py,sha256=tmICp-NOrxoVFENBy4F_0-c0l3znf8bOtBBo-UZhajg,650
583
583
  langchain/embeddings/baidu_qianfan_endpoint.py,sha256=w7BeE53d7o9Y8Xf0cZntmmziih7oBJcmF-jBW70KJlc,662
584
- langchain/embeddings/base.py,sha256=eyxUE6H5dZm48buj_FDjG_HlL2y2FKdYnyc4EJ7j3Og,7537
584
+ langchain/embeddings/base.py,sha256=g1TgfcjKScPiWXWVUuoYS7U5uAudp5eGdS38cUVL9e0,7492
585
585
  langchain/embeddings/bedrock.py,sha256=tCBm3vcN0B21Ga6KvNwhgJpgjobC2VEcmPApUmwXO4E,638
586
586
  langchain/embeddings/bookend.py,sha256=qWaQXZw9Gq11kEdfIO71h1H0NaXqVKm45TiStxd2xaM,638
587
587
  langchain/embeddings/cache.py,sha256=m_ftj2XV7WzeYjjT4mrubIJ95Nd3KR5dN53BDhXAC6w,10208
@@ -989,8 +989,8 @@ langchain/smith/evaluation/__init__.py,sha256=z9uREFLECT3nu7WKmGV4aSEXUTTeaCOLx8
989
989
  langchain/smith/evaluation/config.py,sha256=u0TKCnNiY-GCKE-Q-QEBb0AvnG9XndoISqOzT-qf2fA,13464
990
990
  langchain/smith/evaluation/name_generation.py,sha256=IWocrWNjWnV8GhHJ7BrbGcWK1v9TUikzubpSBNz4Px4,9936
991
991
  langchain/smith/evaluation/progress.py,sha256=OVEISP5s6u4nVN2aMrTCdkjpcpsi2KxdcL01ITJOa1o,3331
992
- langchain/smith/evaluation/runner_utils.py,sha256=h6YF-stTuS7-fFYwKWLcCWXoZwjA4taqw2AuFRWF_hs,54172
993
- langchain/smith/evaluation/string_run_evaluator.py,sha256=cFgXichGj0nEuJXs0q88Lh930E5YEGIjRbCU1fHPoKc,17101
992
+ langchain/smith/evaluation/runner_utils.py,sha256=iujxPpHYY8Hrs8MUtf5qmJUApH85iu7EZBSv0OLy_Vo,54220
993
+ langchain/smith/evaluation/string_run_evaluator.py,sha256=jz9FJyskTx5kh5FSH1XnnlBbc1M2C-kv-fW7TP3Y8nQ,17255
994
994
  langchain/smith/evaluation/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
995
995
  langchain/sql_database.py,sha256=PbNTfJjIUemMO9ZkLiMIpKF-9GJ7Kto3ShcQrLPoOqk,664
996
996
  langchain/storage/__init__.py,sha256=Wm7zDu_UBenWVknjoTiRpafsDgubMJdB1oEuV88aVyk,1585
@@ -1339,4 +1339,4 @@ langchain/vectorstores/xata.py,sha256=HW_Oi5Hz8rH2JaUhRNWQ-3hLYmNzD8eAz6K5YqPArm
1339
1339
  langchain/vectorstores/yellowbrick.py,sha256=-lnjGcRE8Q1nEPOTdbKYTw5noS2cy2ce1ePOU804-_o,624
1340
1340
  langchain/vectorstores/zep.py,sha256=RJ2auxoA6uHHLEZknw3_jeFmYJYVt-PWKMBcNMGV6TM,798
1341
1341
  langchain/vectorstores/zilliz.py,sha256=XhPPIUfKPFJw0_svCoBgCnNkkBLoRVVcyuMfOnE5IxU,609
1342
- langchain-0.3.24.dist-info/RECORD,,
1342
+ langchain-0.3.25.dist-info/RECORD,,