Christophe Bornet
03e8327e01
core: Ruff preview fixes ( #31877 )
...
Auto-fixes from `uv run ruff check --fix --unsafe-fixes --preview`
---------
Co-authored-by: Mason Daugherty <mason@langchain.dev>
2025-07-07 13:02:40 -04:00
Christophe Bornet
ba144c9d7f
langchain: Add ruff rule RUF ( #31874 )
...
All auto-fixes
See https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
---------
Co-authored-by: Mason Daugherty <mason@langchain.dev>
2025-07-07 12:49:38 -04:00
Christophe Bornet
ed35372580
langchain: Add ruff rules FBT ( #31885 )
...
* Fixed for private functions and in tests
* Added noqa escapes for public functions
See https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt
Co-authored-by: Mason Daugherty <mason@langchain.dev>
2025-07-07 12:35:55 -04:00
Christophe Bornet
56bbfd9723
langchain: Add ruff rule RET ( #31875 )
...
All auto-fixes
See https://docs.astral.sh/ruff/rules/#flake8-return-ret
---------
Co-authored-by: Mason Daugherty <github@mdrxy.com>
2025-07-07 15:33:18 +00:00
Christophe Bornet
fceebbb387
langchain: Add ruff rules C4 ( #31879 )
...
All auto-fixes
See https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
---------
Co-authored-by: Mason Daugherty <mason@langchain.dev>
2025-07-07 10:55:52 -04:00
Christophe Bornet
4134b36db8
core: make ruff rule PLW1510 unfixable ( #31868 )
...
See
https://github.com/astral-sh/ruff/discussions/17087#discussioncomment-12675815
Tha autofix is misleading: it chooses to add `check=False` to keep the
runtime behavior but in reality it hides the fact that most probably the
user would prefer `check=True`.
2025-07-07 10:28:30 -04:00
Christophe Bornet
9368b92b2c
standard-tests: Ruff autofixes ( #31862 )
...
Auto-fixes from ruff with rule ALL
2025-07-07 10:27:39 -04:00
Christophe Bornet
2df3fdf40d
langchain: Add ruff rules SIM ( #31881 )
...
See https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
Co-authored-by: Mason Daugherty <mason@langchain.dev>
2025-07-07 10:27:04 -04:00
Christophe Bornet
f06380516f
langchain: Add ruff rules A ( #31888 )
...
See https://docs.astral.sh/ruff/rules/#flake8-builtins-a
---------
Co-authored-by: Mason Daugherty <mason@langchain.dev>
2025-07-07 10:20:27 -04:00
Christophe Bornet
49c316667d
langchain: Add ruff rules EM ( #31873 )
...
All auto-fixes.
See https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
---------
Co-authored-by: Mason Daugherty <mason@langchain.dev>
2025-07-07 10:13:56 -04:00
Christophe Bornet
1276bf3e1d
standard-tests: Add ruff rules PGH ( #31869 )
...
See https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
2025-07-07 10:07:39 -04:00
Christophe Bornet
53c75abba2
langchain: Add ruff rules PIE ( #31880 )
...
All auto-fixes
See https://docs.astral.sh/ruff/rules/#flake8-pie-pie
2025-07-07 10:07:12 -04:00
Christophe Bornet
a46a2b8bda
cli: Ruff autofixes ( #31863 )
...
Auto-fixes from ruff with rule ALL
2025-07-07 10:06:34 -04:00
Christophe Bornet
451c90fefa
text-splitters: Ruff autofixes ( #31858 )
...
Auto-fixes from ruff with rule `ALL`
2025-07-07 10:06:08 -04:00
Christophe Bornet
8aed3b61a9
core: Bump ruff version to 0.12 ( #31846 )
2025-07-07 10:02:51 -04:00
Michael Li
73552883c3
cli: fix dockerfile incorrect copy ( #31883 )
2025-07-06 21:20:57 -04:00
m27315
013ce2c47f
huggingface: fix HuggingFaceEndpoint._astream() got multiple values for argument 'stop' ( #31385 )
2025-07-06 15:18:53 +00:00
Christophe Bornet
bf05229029
langchain: Add ruff rule W ( #31876 )
...
All auto-fixes
See https://docs.astral.sh/ruff/rules/#warning-w
Co-authored-by: Chester Curme <chester.curme@gmail.com>
2025-07-05 21:57:30 +00:00
ccurme
3f4b355eef
anthropic[patch]: pass back in citations in multi-turn conversations ( #31882 )
...
Also adds VCR cassettes for some heavy tests.
2025-07-05 17:33:22 -04:00
Christophe Bornet
46fe09f013
cli: Bump ruff version to 0.12 ( #31864 )
2025-07-05 17:15:24 -04:00
Christophe Bornet
df5cc024fd
langchain: Bump ruff version to 0.12 ( #31867 )
2025-07-05 17:13:55 -04:00
Christophe Bornet
a15c3e0856
text-splitters: Bump ruff version to 0.12 ( #31866 )
2025-07-05 17:13:08 -04:00
Christophe Bornet
e1eb3f8d6f
standard-tests: Bump ruff version to 0.12 ( #31865 )
2025-07-05 17:12:00 -04:00
NeatGuyCoding
64815445e4
langchain[patch]: fix a bug where now.replace(day=now.day - 1)
would raise a ValueError
when now.day
is equal to 1 ( #31878 )
2025-07-05 14:54:26 -04:00
Viet Hoang
15dc684d34
docs: Integration with GreenNode Serverless AI ( #31836 )
2025-07-05 13:48:35 -04:00
Mohammad Mohtashim
b26d2250ba
core[patch]: Int Combine when Merging Dicts ( #31572 )
...
- **Description:** Combining the Int Types by adding them which makes
the most sense.
- **Issue:** #31565
2025-07-04 14:44:16 -04:00
Mason Daugherty
6a5073b227
langchain[patch]: Add bandit rules ( #31818 )
...
Integrate Bandit for security analysis, suppress warnings for specific issues, and address potential vulnerabilities such as hardcoded passwords and SQL injection risks. Adjust documentation and formatting for clarity.
2025-07-03 14:20:33 -04:00
ccurme
ade642b7c5
Revert "infra: temporarily skip tests" ( #31854 )
...
Reverts langchain-ai/langchain#31853
2025-07-03 13:55:29 -04:00
ccurme
c9f45dc323
infra: temporarily skip tests ( #31853 )
...
Tests failed twice with different timeout errors.
2025-07-03 13:39:14 -04:00
ccurme
f88fff0b8a
anthropic: release 0.3.17 ( #31852 )
2025-07-03 13:18:43 -04:00
ccurme
2090f85789
core: release 0.3.68 ( #31848 )
...
Also add `search_result` to recognized tool message block types.
2025-07-03 12:36:25 -04:00
Mason Daugherty
572020c4d8
ollama: add validate_model_on_init
, catch more errors ( #31784 )
...
* Ensure access to local model during `ChatOllama` instantiation
(#27720 ). This adds a new param `validate_model_on_init` (default:
`true`)
* Catch a few more errors from the Ollama client to assist users
2025-07-03 11:07:11 -04:00
Mason Daugherty
1a3a8db3c9
docs: anthropic formatting cleanup ( #31847 )
...
inline URLs, capitalization, code blocks
2025-07-03 14:50:23 +00:00
Christophe Bornet
ee3709535d
text-splitters: bump spacy version to 3.8.7 ( #31834 )
...
This allows to use spacy with Python 3.13
2025-07-03 10:13:25 -04:00
Christophe Bornet
b8e9b4adfc
cli: Add ruff rule UP (pyupgrade) ( #31843 )
...
See https://docs.astral.sh/ruff/rules/#pyupgrade-up
All auto-fixed
Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
2025-07-03 14:12:46 +00:00
Christophe Bornet
cd7dce687a
standard-tests: Add ruff rule UP (pyupgrade) ( #31842 )
...
See https://docs.astral.sh/ruff/rules/#pyupgrade-up
All auto-fixed
2025-07-03 10:12:31 -04:00
Christophe Bornet
802d2bf249
text-splitters: Add ruff rule UP (pyupgrade) ( #31841 )
...
See https://docs.astral.sh/ruff/rules/#pyupgrade-up
All auto-fixed except `typing.AbstractSet` -> `collections.abc.Set`
2025-07-03 10:11:35 -04:00
Mason Daugherty
911b0b69ea
groq: Add service tier option to ChatGroq ( #31801 )
...
- Allows users to select a [flex
processing](https://console.groq.com/docs/flex-processing ) service tier
2025-07-03 10:11:18 -04:00
Eugene Yurtsev
10ec5c8f02
text-splitters: 0.3.9 ( #31844 )
...
Release langchain-text-splitters 0.3.9
2025-07-03 10:02:35 -04:00
Christophe Bornet
46745f91b5
core: Use parametric tests in test_openai_tools ( #31839 )
2025-07-03 08:43:46 -04:00
Cole Murray
43eef43550
security: Remove xslt_path and harden XML parsers in HTMLSectionSplitter: package: langchain-text-splitters ( #31819 )
...
## Summary
- Removes the `xslt_path` parameter from HTMLSectionSplitter to
eliminate XXE attack vector
- Hardens XML/HTML parsers with secure configurations to prevent XXE
attacks
- Adds comprehensive security tests to ensure the vulnerability is fixed
## Context
This PR addresses a critical XXE vulnerability discovered in the
HTMLSectionSplitter component. The vulnerability allowed attackers to:
- Read sensitive local files (SSH keys, passwords, configuration files)
- Perform Server-Side Request Forgery (SSRF) attacks
- Exfiltrate data to attacker-controlled servers
## Changes Made
1. **Removed `xslt_path` parameter** - This eliminates the primary
attack vector where users could supply malicious XSLT files
2. **Hardened XML parsers** - Added security configurations to prevent
XXE attacks even with the default XSLT:
- `no_network=True` - Blocks network access
- `resolve_entities=False` - Prevents entity expansion -
`load_dtd=False` - Disables DTD processing -
`XSLTAccessControl.DENY_ALL` - Blocks all file/network I/O in XSLT
transformations
3. **Added security tests** - New test file `test_html_security.py` with
comprehensive tests for various XXE attack vectors
4. **Updated existing tests** - Modified tests that were using the
removed `xslt_path` parameter
## Test Plan
- [x] All existing tests pass
- [x] New security tests verify XXE attacks are blocked
- [x] Code passes linting and formatting checks
- [x] Tested with both old and new versions of lxml
Twitter handle: @_colemurray
2025-07-02 15:24:08 -04:00
Eugene Yurtsev
73fefe0295
core[path]: Use context manager for FileCallbackHandler ( #31813 )
...
Recommend using context manager for FileCallbackHandler to avoid opening
too many file descriptors
---------
Co-authored-by: Mason Daugherty <github@mdrxy.com>
2025-07-02 13:31:58 -04:00
Mason Daugherty
eb12294583
langchain-xai[patch]: Add ruff bandit rules to linter ( #31816 )
...
- Add ruff bandit rules
- Some formatting
2025-07-01 18:59:06 +00:00
Mason Daugherty
86a698d1b6
langchain-qdrant[patch]: Add ruff bandit rules to linter ( #31815 )
...
- Add ruff bandit rules
- Address a few s101s
- Some formatting
2025-07-01 18:42:55 +00:00
Mason Daugherty
b03e326231
langchain-prompty[patch]: Add ruff bandit rules to linter ( #31814 )
...
- Add ruff bandit rules
- Address some s101 assertion warnings
- Address s506 by using `yaml.safe_load()`
2025-07-01 18:32:02 +00:00
Mason Daugherty
3190c4132f
langchain-perplexity[patch]: Add ruff bandit rules to linter ( #31812 )
...
- Add ruff bandit rules
2025-07-01 18:17:28 +00:00
Mason Daugherty
f30fe07620
update pyproject.toml flake8 comment ( #31810 )
2025-07-01 18:16:38 +00:00
Mason Daugherty
d0dce5315f
langchain-ollama[patch]: Add ruff bandit rules to linter ( #31811 )
...
- Add ruff bandit rules
2025-07-01 18:16:07 +00:00
Mason Daugherty
c9e1ce2966
groq: release 0.3.5 ( #31809 )
2025-07-01 13:21:23 -04:00
Mason Daugherty
404d8408f4
langchain-nomic[patch]: Add ruff bandit rules to linter ( #31805 )
...
- Add ruff bandit rules
- Some formatting
2025-07-01 11:39:11 -04:00
Mason Daugherty
0279af60b5
langchain-mistralai[patch]: Add ruff bandit rules to linter, formatting ( #31803 )
...
- Add ruff bandit rules
- Address a s101 error
- Formatting
2025-07-01 11:08:01 -04:00
Mason Daugherty
425ee52581
langchain-huggingface[patch]: Add ruff bandit rules to linter ( #31798 )
...
- Add ruff bandit rules
2025-07-01 11:07:52 -04:00
Mason Daugherty
0efaa483e4
langchain-groq[patch]: Add ruff bandit rules to linter ( #31797 )
...
- Add ruff bandit rules
- Address s105 errors
2025-07-01 11:07:42 -04:00
Mason Daugherty
479b6fd7c5
langchain-fireworks[patch]: Add ruff bandit rules to linter ( #31796 )
...
- Add ruff bandit rules
- Address a s113 error
2025-07-01 11:07:26 -04:00
Mason Daugherty
33c9bf1adc
langchain-openai[patch]: Add ruff bandit rules to linter ( #31788 )
2025-06-30 14:01:32 -04:00
Mason Daugherty
645e25f624
langchain-anthropic[patch]: Add ruff bandit rules ( #31789 )
2025-06-30 14:00:53 -04:00
Mason Daugherty
247673ddb8
chroma: add ruff bandit rules ( #31790 )
2025-06-30 14:00:08 -04:00
Mason Daugherty
1a5120dc9d
langchain-deepseek[patch]: add ruff bandit rules ( #31792 )
...
add ruff bandit rules
2025-06-30 13:59:35 -04:00
Mason Daugherty
6572399174
langchain-exa: add ruff bandit rules ( #31793 )
...
Add ruff bandit rules
2025-06-30 13:58:38 -04:00
ccurme
04cc674e80
core: release 0.3.67 ( #31791 )
2025-06-30 12:00:39 -04:00
ccurme
46cef90f7b
core: expose tool message recognized block types ( #31787 )
2025-06-30 11:19:34 -04:00
Yiwei
375f53adac
IBM DB2 vector store documentation addition ( #31008 )
2025-06-27 18:34:32 +00:00
ccurme
9f17fabc43
openai: release 0.3.27 ( #31769 )
...
To pick up https://github.com/langchain-ai/langchain/pull/31756 .
2025-06-27 13:44:45 -04:00
Andrew Jaeger
0189c50570
openai[fix]: Correctly set usage metadata for OpenAI Responses API ( #31756 )
2025-06-27 15:35:14 +00:00
Mason Daugherty
9aa75eaef3
docs: enhance docstring for disable_streaming
parameter in BaseChatModel ( #31759 )
...
Resolves #31758
2025-06-27 11:27:41 -04:00
ccurme
e8e89b0b82
docs: updates from langchain-openai 0.3.26 ( #31764 )
2025-06-27 11:27:25 -04:00
Mason Daugherty
e1aff00cc1
groq: support reasoning_effort
, update docs for clarity ( #31754 )
...
- There was some ambiguous wording that has been updated to hopefully
clarify the functionality of `reasoning_format` in ChatGroq.
- Added support for `reasoning_effort`
- Added links to see models capable of `reasoning_format` and
`reasoning_effort`
- Other minor nits
2025-06-27 09:43:40 -04:00
ccurme
ea1345a58b
openai[patch]: update cassette ( #31752 )
...
Following changes in `openai==1.92`.
2025-06-26 14:52:12 -04:00
ccurme
066be383e3
openai[patch]: update test following release of openai 1.92 ( #31751 )
...
Added new required fields for `ResponseFunctionWebSearch`
2025-06-26 18:22:58 +00:00
ccurme
61feaa4656
openai: release 0.3.26 ( #31749 )
2025-06-26 13:51:51 -04:00
ccurme
88d5f3edcc
openai[patch]: allow specification of output format for Responses API ( #31686 )
2025-06-26 13:41:43 -04:00
Mason Daugherty
59c2b81627
docs: fix some inline links ( #31748 )
2025-06-26 13:35:14 -04:00
ccurme
0ae434be21
anthropic: release 0.3.16 ( #31744 )
2025-06-26 09:09:29 -04:00
Martin Schaer
421554007f
docs: Update surrealdb vectorestore documentation ( #31199 )
2025-06-25 20:16:43 +00:00
Mason Daugherty
2fb27b63f5
ollama: update tests, docs ( #31736 )
...
- docs: for the Ollama notebooks, improve the specificity of some links,
add `homebrew` install info, update some wording
- tests: reduce number of local models needed to run in half from 4 → 2
(shedding 8gb of required installs)
- bump deps (non-breaking) in anticipation of upcoming "thinking" PR
2025-06-25 20:13:20 +00:00
ccurme
a1f3147989
docs: update sort order for integrations table ( #31737 )
...
Pull latest download statistics.
2025-06-25 16:03:36 -04:00
ccurme
84500704ab
openai[patch]: fix bug where function call IDs were not populated ( #31735 )
...
(optional) IDs were getting dropped in some cases.
2025-06-25 19:08:27 +00:00
ccurme
0bf223d6cf
openai[patch]: add attribute to always use previous_response_id ( #31734 )
2025-06-25 19:01:43 +00:00
ccurme
b02bd67788
anthropic[patch]: cache clients ( #31659 )
2025-06-25 14:49:02 -04:00
Michael Li
990a69d9d7
docs: fix typo in globals.py ( #31728 )
2025-06-25 11:47:02 -04:00
Mason Daugherty
3c3320ae30
fix: update import paths for ChatOllama to use langchain_ollama instead of community ( #31721 )
2025-06-24 16:19:31 -04:00
ccurme
e09abf8170
anthropic[patch]: add benchmark ( #31718 )
...
Account for lazy loading of clients in init time benchmark
2025-06-24 15:17:22 -04:00
Eugene Yurtsev
9164e6f906
core[patch]: Add additional hashing options to indexing API, warn on SHA-1 ( #31649 )
...
Add additional hashing options to the indexing API, warn on SHA-1
Requires:
- Bumping langchain-core version
- bumping min langchain-core in langchain
---------
Co-authored-by: ccurme <chester.curme@gmail.com>
2025-06-24 14:44:06 -04:00
Mason Daugherty
8878a7b143
docs: ollama nits ( #31714 )
2025-06-24 13:19:15 -04:00
Mason Daugherty
6d71b6b6ee
standard-tests: refactoring and fixes ( #31703 )
...
- `libs/core/langchain_core/messages/base.py`: add model name to
examples [per
docs](https://python.langchain.com/api_reference/standard_tests/integration_tests/langchain_tests.integration_tests.chat_models.ChatModelIntegrationTests.html#langchain_tests.integration_tests.chat_models.ChatModelIntegrationTests.test_usage_metadata )
("0.3.17: Additionally check for the presence of model_name in the
response metadata, which is needed for usage tracking in callback
handlers")
- `libs/core/langchain_core/utils/function_calling.py`: correct typo
-
`libs/standard-tests/langchain_tests/integration_tests/chat_models.py`:
- `magic_function(input)` -> `magic_function(_input)` to prevent warning
about redefining built in `input`
- relocate a few tests for better grouping and narrative flow
- suppress some type hint warnings following suit from similar tests
- fix a few more typos
- validate not only that `model_name` is defined, but that it is not
empty (test_usage_metadata)
2025-06-23 23:22:31 +00:00
Christophe Bornet
c7e82ad95d
core: Use parametrized test in test_correct_get_tracer_project ( #31513 )
2025-06-23 18:55:57 -04:00
joshy-deshaw
8a0782c46c
openai[patch]: fix dropping response headers while streaming / Azure ( #31580 )
2025-06-23 17:59:58 -04:00
Mason Daugherty
8868701c16
docs: updated ChatGroq docs and example ( #31710 )
2025-06-23 20:36:46 +00:00
ccurme
ee83993b91
docs: document Anthropic cache TTL count details ( #31708 )
2025-06-23 20:16:42 +00:00
Mason Daugherty
e6191d58e7
groq: release 0.3.4 ( #31709 )
...
bump groq dependency to ensure reasoning is supported
2025-06-23 19:30:05 +00:00
Mason Daugherty
40bb7d00fc
groq: release 0.3.3 ( #31707 )
2025-06-23 14:54:56 -04:00
Christophe Bornet
b1cc972567
core[patch]: Improve RunnableWithMessageHistory
init arg types ( #31639 )
...
`Runnable`'s `Input` is contravariant so we need to enumerate all
possible inputs and it's not possible to put them in a `Union`.
Also, it's better to only require a runnable that
accepts`list[BaseMessage]` instead of a broader `Sequence[BaseMessage]`
as internally the runnable is only called with a list.
2025-06-23 13:45:52 -04:00
Mason Daugherty
dcf5c7b472
groq: add support for accessing reasoning output from Groq models ( #31662 )
...
**Description:** return
[reasoning](https://console.groq.com/docs/reasoning ) output in
`additional_kwargs` as `reasoning_content`
**Issue:** Resolves #31052
2025-06-23 11:33:12 -04:00
ccurme
643741497a
openai: release 0.3.25 ( #31702 )
2025-06-23 10:55:48 -04:00
ccurme
b268ab6a28
openai[patch]: fix client caching when request_timeout is specified via httpx.Timeout ( #31698 )
...
Resolves https://github.com/langchain-ai/langchain/issues/31697
2025-06-23 14:37:49 +00:00
Li-Kuang Chen
4ee6112161
openai[patch]: Improve error message when response type is malformed ( #31619 )
2025-06-21 14:15:21 -04:00
dennism-tulcolabs
9de4f22205
langchain[patch]: smith.evaluation.progress.ProgressBarCallback: Make output after progress bar ends configurable ( #31583 )
2025-06-20 19:24:35 -04:00
Mikhail
6105a5841b
core: fix get_buffer_string
output for structured message content ( #31600 )
2025-06-20 23:21:50 +00:00
ccurme
cf5a442e4c
langchain: release 0.3.26 ( #31695 )
2025-06-20 18:19:47 -04:00
Bagatur
5271fd76f1
core[patch]: check before removing tags ( #31691 )
2025-06-20 17:46:50 -04:00