From 8f68a0852826e1275f109c2caa07946b2cb0bf0e Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Thu, 14 Aug 2025 16:15:27 -0400 Subject: [PATCH 1/8] chore: add Chat LangChain to `README.md` (#32545) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index be0ec26c3ab..9183f0bafed 100644 --- a/README.md +++ b/README.md @@ -83,3 +83,4 @@ concepts behind the LangChain framework. - [LangChain Forum](https://forum.langchain.com/): Connect with the community and share all of your technical questions, ideas, and feedback. - [API Reference](https://python.langchain.com/api_reference/): Detailed reference on navigating base packages and integrations for LangChain. +- [Chat LangChain](https://chat.langchain.com/): Ask questions & chat with our documentation From a0331285d714ab37738ada934cc040dfd13f1d5e Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Thu, 14 Aug 2025 16:28:36 -0400 Subject: [PATCH 2/8] fix(core): Support no-args tools by defaulting args to empty dict (#32530) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Supersedes #32408 Description: This PR ensures that tool calls without explicitly provided `args` will default to an empty dictionary (`{}`), allowing tools with no parameters (e.g. `def foo() -> str`) to be registered and invoked without validation errors. This change improves compatibility with agent frameworks that may omit the `args` field when generating tool calls. Issue: See [langgraph#5722](https://github.com/langchain-ai/langgraph/issues/5722) – LangGraph currently emits tool calls without `args`, which leads to validation errors when tools with no parameters are invoked. This PR ensures compatibility by defaulting `args` to `{}` when missing. Dependencies: None --------- Thank you for contributing to LangChain! Follow these steps to mark your pull request as ready for review. **If any of these steps are not completed, your PR will not be considered for review.** - [ ] **PR title**: Follows the format: {TYPE}({SCOPE}): {DESCRIPTION} - Examples: - feat(core): add multi-tenant support - fix(cli): resolve flag parsing error - docs(openai): update API usage examples - Allowed `{TYPE}` values: - feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert, release - Allowed `{SCOPE}` values (optional): - core, cli, langchain, standard-tests, docs, anthropic, chroma, deepseek, exa, fireworks, groq, huggingface, mistralai, nomic, ollama, openai, perplexity, prompty, qdrant, xai - Note: the `{DESCRIPTION}` must not start with an uppercase letter. - Once you've written the title, please delete this checklist item; do not include it in the PR. - [ ] **PR message**: ***Delete this entire checklist*** and replace with - **Description:** a description of the change. Include a [closing keyword](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) if applicable to a relevant issue. - **Issue:** the issue # it fixes, if applicable (e.g. Fixes #123) - **Dependencies:** any dependencies required for this change - **Twitter handle:** if your PR gets announced, and you'd like a mention, we'll gladly shout you out! - [ ] **Add tests and docs**: If you're adding a new integration, you must include: 1. A test for the integration, preferably unit tests that do not rely on network access, 2. An example notebook showing its use. It lives in `docs/docs/integrations` directory. - [ ] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. **We will not consider a PR unless these three are passing in CI.** See [contribution guidelines](https://python.langchain.com/docs/contributing/) for more. Additional guidelines: - Make sure optional dependencies are imported within a function. - Please do not add dependencies to `pyproject.toml` files (even optional ones) unless they are **required** for unit tests. - Most PRs should not touch more than one package. - Changes should be backwards compatible. --------- Signed-off-by: jitokim Co-authored-by: jito Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- libs/core/langchain_core/messages/ai.py | 5 ++++- libs/core/tests/unit_tests/test_messages.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/core/langchain_core/messages/ai.py b/libs/core/langchain_core/messages/ai.py index c81187dc3f6..27ae49dca9f 100644 --- a/libs/core/langchain_core/messages/ai.py +++ b/libs/core/langchain_core/messages/ai.py @@ -358,7 +358,10 @@ class AIMessageChunk(AIMessage, BaseMessageChunk): for chunk in self.tool_call_chunks: try: - args_ = parse_partial_json(chunk["args"]) if chunk["args"] != "" else {} # type: ignore[arg-type] + if chunk["args"] is not None and chunk["args"] != "": + args_ = parse_partial_json(chunk["args"]) + else: + args_ = {} if isinstance(args_, dict): tool_calls.append( create_tool_call( diff --git a/libs/core/tests/unit_tests/test_messages.py b/libs/core/tests/unit_tests/test_messages.py index 0656a2f2e97..807f52ae10d 100644 --- a/libs/core/tests/unit_tests/test_messages.py +++ b/libs/core/tests/unit_tests/test_messages.py @@ -455,9 +455,9 @@ def test_message_chunk_to_message() -> None: tool_calls=[ create_tool_call(name="tool1", args={"a": 1}, id="1"), create_tool_call(name="tool2", args={}, id="2"), + create_tool_call(name="tool3", args={}, id="3"), ], invalid_tool_calls=[ - create_invalid_tool_call(name="tool3", args=None, id="3", error=None), create_invalid_tool_call(name="tool4", args="abc", id="4", error=None), ], ) From 2bd8096faa80442cf6f7380cd122607d8b2608ec Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Thu, 14 Aug 2025 16:35:57 -0400 Subject: [PATCH 3/8] docs: add pre-commit setup instructions to the dev setup guide (#32553) --- docs/docs/contributing/how_to/code/setup.mdx | 43 ++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/docs/docs/contributing/how_to/code/setup.mdx b/docs/docs/contributing/how_to/code/setup.mdx index ed59f414da1..830ceccb23c 100644 --- a/docs/docs/contributing/how_to/code/setup.mdx +++ b/docs/docs/contributing/how_to/code/setup.mdx @@ -223,6 +223,49 @@ If codespell is incorrectly flagging a word, you can skip spellcheck for that wo ignore-words-list = 'momento,collison,ned,foor,reworkd,parth,whats,aapply,mysogyny,unsecure' ``` +### Pre-commit + +We use [pre-commit](https://pre-commit.com/) to ensure commits are formatted/linted. + +#### Installing Pre-commit + +First, install pre-commit: + +```bash +# Option 1: Using uv (recommended) +uv tool install pre-commit + +# Option 2: Using Homebrew (globally for macOS/Linux) +brew install pre-commit + +# Option 3: Using pip +pip install pre-commit +``` + +Then install the git hook scripts: + +```bash +pre-commit install +``` + +#### How Pre-commit Works + +Once installed, pre-commit will automatically run on every `git commit`. Hooks are specified in `.pre-commit-config.yaml` and will: + +- Format code using `ruff` for the specific library/package you're modifying +- Only run on files that have changed +- Prevent commits if formatting fails + +#### Skipping Pre-commit + +In exceptional cases, you can skip pre-commit hooks with: + +```bash +git commit --no-verify +``` + +However, this is discouraged as the CI system will still enforce the same formatting rules. + ## Working with optional dependencies `langchain`, `langchain-community`, and `langchain-experimental` rely on optional dependencies to keep these packages lightweight. From 06ba80ff682df9b08d8f9a521f91183153a64d99 Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Thu, 14 Aug 2025 19:41:37 -0400 Subject: [PATCH 4/8] docs: formatting Tavily (#32555) --- .../integrations/tools/tavily_extract.ipynb | 20 +++-- .../integrations/tools/tavily_search.ipynb | 75 +++++++++++-------- 2 files changed, 55 insertions(+), 40 deletions(-) diff --git a/docs/docs/integrations/tools/tavily_extract.ipynb b/docs/docs/integrations/tools/tavily_extract.ipynb index 406e95ba7de..e6732d8d348 100644 --- a/docs/docs/integrations/tools/tavily_extract.ipynb +++ b/docs/docs/integrations/tools/tavily_extract.ipynb @@ -96,7 +96,7 @@ "\n", "The tool accepts various parameters during instantiation:\n", "\n", - "- `extract_depth` (optional, str): The depth of the extraction, either \"basic\" or \"advanced\". Default is \"basic \".\n", + "- `extract_depth` (optional, str): The depth of the extraction, either `'basic'` or `'advanced'`. Default is `'basic'`.\n", "- `include_images` (optional, bool): Whether to include images in the extraction. Default is False.\n", "\n", "For a comprehensive overview of the available parameters, refer to the [Tavily Extract API documentation](https://docs.tavily.com/documentation/api-reference/endpoint/extract)" @@ -136,7 +136,11 @@ "- `urls` (required): A list of URLs to extract content from. \n", "- Both `extract_depth` and `include_images` can also be set during invocation\n", "\n", - "NOTE: The optional arguments are available for agents to dynamically set, if you set an argument during instantiation and then invoke the tool with a different value, the tool will use the value you passed during invocation." + ":::note\n", + "\n", + "The optional arguments are available for agents to dynamically set, if you set an argument during instantiation and then invoke the tool with a different value, the tool will use the value you passed during invocation.\n", + "\n", + ":::" ] }, { @@ -171,7 +175,7 @@ "source": [ "### [Invoke with ToolCall](/docs/concepts/tools)\n", "\n", - "We can also invoke the tool with a model-generated ToolCall, in which case a ToolMessage will be returned:" + "We can also invoke the tool with a model-generated `ToolCall`, in which case a `ToolMessage` will be returned:" ] }, { @@ -253,10 +257,10 @@ "name": "stdout", "output_type": "stream", "text": [ - "================================\u001B[1m Human Message \u001B[0m=================================\n", + "================================\u001b[1m Human Message \u001b[0m=================================\n", "\n", "['https://en.wikipedia.org/wiki/Albert_Einstein','https://en.wikipedia.org/wiki/Theoretical_physics']\n", - "==================================\u001B[1m Ai Message \u001B[0m==================================\n", + "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "Tool Calls:\n", " tavily_extract (call_BAK906Cpy8fDZttwqYTMdkKp)\n", " Call ID: call_BAK906Cpy8fDZttwqYTMdkKp\n", @@ -270,11 +274,11 @@ " urls: ['https://en.wikipedia.org/wiki/Theoretical_physics']\n", " extract_depth: advanced\n", " include_images: False\n", - "=================================\u001B[1m Tool Message \u001B[0m=================================\n", + "=================================\u001b[1m Tool Message \u001b[0m=================================\n", "Name: tavily_extract\n", "\n", "{\"results\": [{\"url\": \"https://en.wikipedia.org/wiki/Theoretical_physics\", \"raw_content\": \"Published Time: 2003-09-21T15:11:11Z\\nTheoretical physics - Wikipedia\\nJump to content\\nMain menu\\nMain menu\\nmove to sidebar hide\\nNavigation\\n\\nMain page\\nContents\\nCurrent events\\nRandom article\\nAbout Wikipedia\\nContact us\\n\\nContribute\\n\\nHelp\\nLearn to edit\\nCommunity portal\\nRecent changes\\nUpload file\\nSpecial pages\\n\\n \\nSearch\\nSearch\\nAppearance\\n\\nDonate\\nCreate account\\nLog in\\n\\nPersonal tools\\n\\nDonate\\nCreate account\\nLog in\\n\\nPages for logged out editors learn more\\n\\nContributions\\nTalk\\n\\nContents\\nmove to sidebar hide\\n\\n(Top)\\n\\n1 Overview\\n\\n\\n2 History\\n\\n\\n3 Mainstream theoriesToggle Mainstream theories subsection\\n\\n3.1 Examples\\n\\n\\n\\n4 Proposed theories\\n\\n\\n5 Fringe theoriesToggle Fringe theories subsection\\n\\n5.1 Examples\\n\\n\\n\\n6 Thought experiments vs real experiments\\n\\n\\n7 See also\\n\\n\\n8 Notes\\n\\n\\n9 References\\n\\n\\n10 Further reading\\n\\n\\n11 External links\\n\\n\\nToggle the table of contents\\nTheoretical physics\\n77 languages\\n\\nAfrikaans\\nالعربية\\nAsturianu\\nAzərbaycanca\\nবাংলা\\nBasa Banyumasan\\nБеларуская\\nБеларуская (тарашкевіца)\\nभोजपुरी\\nБългарски\\nBosanski\\nBrezhoneg\\nCatalà\\nЧӑвашла\\nČeština\\nDansk\\nDeutsch\\nEesti\\nΕλληνικά\\nEspañol\\nEsperanto\\nEuskara\\nفارسی\\nFrançais\\nFrysk\\nGalego\\n한국어\\nՀայերեն\\nहिन्दी\\nHrvatski\\nBahasa Indonesia\\nInterlingua\\nItaliano\\nעברית\\nҚазақша\\nKurdî\\nLatina\\nLatviešu\\nLietuvių\\nMagyar\\nМакедонски\\nმარგალური\\nBahasa Melayu\\nМонгол\\nNederlands\\n日本語\\nNorsk bokmål\\nNorsk nynorsk\\nਪੰਜਾਬੀ\\nپنجابی\\nPolski\\nPortuguês\\nRomână\\nРусский\\nScots\\nShqip\\nSlovenčina\\nSlovenščina\\nکوردی\\nСрпски / srpski\\nSrpskohrvatski / српскохрватски\\nSunda\\nSuomi\\nSvenska\\nTagalog\\nதமிழ்\\nТатарча / tatarça\\nไทย\\nTürkçe\\nУкраїнська\\nاردو\\nTiếng Việt\\nWinaray\\n吴语\\n粵語\\nZazaki\\n中文\\n\\nEdit links\\n\\nArticle\\nTalk\\n\\nEnglish\\n\\nRead\\nEdit\\nView history\\n\\nTools\\nTools\\nmove to sidebar hide\\nActions\\n\\nRead\\nEdit\\nView history\\n\\nGeneral\\n\\nWhat links here\\nRelated changes\\nUpload file\\nPermanent link\\nPage information\\nCite this page\\nGet shortened URL\\nDownload QR code\\n\\nPrint/export\\n\\nDownload as PDF\\nPrintable version\\n\\nIn other projects\\n\\nWikimedia Commons\\nWikiversity\\nWikidata item\\n\\nAppearance\\nmove to sidebar hide\\nFrom Wikipedia, the free encyclopedia\\nBranch of physics\\n\\nVisual representation of a Schwarzschild wormhole. Wormholes have never been observed, but they are predicted to exist through mathematical models and scientific theory.\\nTheoretical physics is a branch of physics that employs mathematical models and abstractions of physical objects and systems to rationalize, explain, and predict natural phenomena. This is in contrast to experimental physics, which uses experimental tools to probe these phenomena.\\nThe advancement of science generally depends on the interplay between experimental studies and theory. In some cases, theoretical physics adheres to standards of mathematical rigour while giving little weight to experiments and observations.[a] For example, while developing special relativity, Albert Einstein was concerned with the Lorentz transformation which left Maxwell's equations invariant, but was apparently uninterested in the Michelson–Morley experiment on Earth's drift through a luminiferous aether.[1] Conversely, Einstein was awarded the Nobel Prize for explaining the photoelectric effect, previously an experimental result lacking a theoretical formulation.[2]\\nOverview\\n[edit]\\nA physical theory is a model of physical events. It is judged by the extent to which its predictions agree with empirical observations. The quality of a physical theory is also judged on its ability to make new predictions which can be verified by new observations. A physical theory differs from a mathematical theorem in that while both are based on some form of axioms, judgment of mathematical applicability is not based on agreement with any experimental results.[3][4] A physical theory similarly differs from a mathematical theory, in the sense that the word \\\"theory\\\" has a different meaning in mathematical terms.[b]\\n\\nR i c \\\\= k g {\\\\displaystyle \\\\mathrm {Ric} =kg} The equations for an Einstein manifold, used in general relativity to describe the curvature of spacetime\\n\\nA physical theory involves one or more relationships between various measurable quantities. Archimedes realized that a ship floats by displacing its mass of water, Pythagoras understood the relation between the length of a vibrating string and the musical tone it produces.[5][6] Other examples include entropy as a measure of the uncertainty regarding the positions and motions of unseen particles and the quantum mechanical idea that (action and) energy are not continuously variable.\\nTheoretical physics consists of several different approaches. In this regard, theoretical particle physics forms a good example. For instance: \\\"phenomenologists\\\" might employ (semi-) empirical formulas and heuristics to agree with experimental results, often without deep physical understanding.[c] \\\"Modelers\\\" (also called \\\"model-builders\\\") often appear much like phenomenologists, but try to model speculative theories that have certain desirable features (rather than on experimental data), or apply the techniques of mathematical modeling to physics problems.[d] Some attempt to create approximate theories, called effective theories, because fully developed theories may be regarded as unsolvable or too complicated. Other theorists may try to unify, formalise, reinterpret or generalise extant theories, or create completely new ones altogether.[e] Sometimes the vision provided by pure mathematical systems can provide clues to how a physical system might be modeled;[f] e.g., the notion, due to Riemann and others, that space itself might be curved. Theoretical problems that need computational investigation are often the concern of computational physics.\\nTheoretical advances may consist in setting aside old, incorrect paradigms (e.g., aether theory of light propagation, caloric theory of heat, burning consisting of evolving phlogiston, or astronomical bodies revolving around the Earth) or may be an alternative model that provides answers that are more accurate or that can be more widely applied. In the latter case, a correspondence principle will be required to recover the previously known result.[7][8] Sometimes though, advances may proceed along different paths. For example, an essentially correct theory may need some conceptual or factual revisions; atomic theory, first postulated millennia ago (by several thinkers in Greece and India) and the two-fluid theory of electricity[9] are two cases in this point. However, an exception to all the above is the wave–particle duality, a theory combining aspects of different, opposing models via the Bohr complementarity principle.\\n\\nRelationship between mathematics and physics\\nPhysical theories become accepted if they are able to make correct predictions and no (or few) incorrect ones. The theory should have, at least as a secondary objective, a certain economy and elegance (compare to mathematical beauty), a notion sometimes called \\\"Occam's razor\\\" after the 13th-century English philosopher William of Occam (or Ockham), in which the simpler of two theories that describe the same matter just as adequately is preferred (but conceptual simplicity may mean mathematical complexity).[10] They are also more likely to be accepted if they connect a wide range of phenomena. Testing the consequences of a theory is part of the scientific method.\\nPhysical theories can be grouped into three categories: mainstream theories, proposed theories and fringe theories.\\nHistory\\n[edit]\\nFurther information: History of physics\\nTheoretical physics began at least 2,300 years ago, under the Pre-socratic philosophy, and continued by Plato and Aristotle, whose views held sway for a millennium. During the rise of medieval universities, the only acknowledged intellectual disciplines were the seven liberal arts of the Trivium like grammar, logic, and rhetoric and of the Quadrivium like arithmetic, geometry, music and astronomy. During the Middle Ages and Renaissance, the concept of experimental science, the counterpoint to theory, began with scholars such as Ibn al-Haytham and Francis Bacon. As the Scientific Revolution gathered pace, the concepts of matter, energy, space, time and causality slowly began to acquire the form we know today, and other sciences spun off from the rubric of natural philosophy. Thus began the modern era of theory with the Copernican paradigm shift in astronomy, soon followed by Johannes Kepler's expressions for planetary orbits, which summarized the meticulous observations of Tycho Brahe; the works of these men (alongside Galileo's) can perhaps be considered to constitute the Scientific Revolution.\\nThe great push toward the modern concept of explanation started with Galileo, one of the few physicists who was both a consummate theoretician and a great experimentalist. The analytic geometry and mechanics of Descartes were incorporated into the calculus and mechanics of Isaac Newton, another theoretician/experimentalist of the highest order, writing Principia Mathematica.[11] In it contained a grand synthesis of the work of Copernicus, Galileo and Kepler; as well as Newton's theories of mechanics and gravitation, which held sway as worldviews until the early 20th century. Simultaneously, progress was also made in optics (in particular colour theory and the ancient science of geometrical optics), courtesy of Newton, Descartes and the Dutchmen Snell and Huygens. In the 18th and 19th centuries Joseph-Louis Lagrange, Leonhard Euler and William Rowan Hamilton would extend the theory of classical mechanics considerably.[12] They picked up the interactive intertwining of mathematics and physics begun two millennia earlier by Pythagoras.\\nAmong the great conceptual achievements of the 19th and 20th centuries were the consolidation of the idea of energy (as well as its global conservation) by the inclusion of heat, electricity and magnetism, and then light. The laws of thermodynamics, and most importantly the introduction of the singular concept of entropy began to provide a macroscopic explanation for the properties of matter. Statistical mechanics (followed by statistical physics and Quantum statistical mechanics) emerged as an offshoot of thermodynamics late in the 19th century. Another important event in the 19th century was the discovery of electromagnetic theory, unifying the previously separate phenomena of electricity, magnetism and light.\\nThe pillars of modern physics, and perhaps the most revolutionary theories in the history of physics, have been relativity theory and quantum mechanics. Newtonian mechanics was subsumed under special relativity and Newton's gravity was given a kinematic explanation by general relativity. Quantum mechanics led to an understanding of blackbody radiation (which indeed, was an original motivation for the theory) and of anomalies in the specific heats of solids — and finally to an understanding of the internal structures of atoms and molecules. Quantum mechanics soon gave way to the formulation of quantum field theory (QFT), begun in the late 1920s. In the aftermath of World War 2, more progress brought much renewed interest in QFT, which had since the early efforts, stagnated. The same period also saw fresh attacks on the problems of superconductivity and phase transitions, as well as the first applications of QFT in the area of theoretical condensed matter. The 1960s and 70s saw the formulation of the Standard model of particle physics using QFT and progress in condensed matter physics (theoretical foundations of superconductivity and critical phenomena, among others), in parallel to the applications of relativity to problems in astronomy and cosmology respectively.\\nAll of these achievements depended on the theoretical physics as a moving force both to suggest experiments and to consolidate results — often by ingenious application of existing mathematics, or, as in the case of Descartes and Newton (with Leibniz), by inventing new mathematics. Fourier's studies of heat conduction led to a new branch of mathematics: infinite, orthogonal series.[13]\\nModern theoretical physics attempts to unify theories and explain phenomena in further attempts to understand the Universe, from the cosmological to the elementary particle scale. Where experimentation cannot be done, theoretical physics still tries to advance through the use of mathematical models.\\nMainstream theories\\n[edit]\\nMainstream theories (sometimes referred to as central theories) are the body of knowledge of both factual and scientific views and possess a usual scientific quality of the tests of repeatability, consistency with existing well-established science and experimentation. There do exist mainstream theories that are generally accepted theories based solely upon their effects explaining a wide variety of data, although the detection, explanation, and possible composition are subjects of debate.\\nExamples\\n[edit]\\n\\nBig Bang\\nChaos theory\\nClassical mechanics\\nClassical field theory\\nDynamo theory\\nField theory\\nGinzburg–Landau theory\\nKinetic theory of gases\\nClassical electromagnetism\\nPerturbation theory (quantum mechanics)\\nPhysical cosmology\\nQuantum chromodynamics\\nQuantum complexity theory\\nQuantum electrodynamics\\nQuantum field theory\\nQuantum field theory in curved spacetime\\nQuantum information theory\\nQuantum mechanics\\nQuantum thermodynamics\\nRelativistic quantum mechanics\\nScattering theory\\nStandard Model\\nStatistical physics\\nTheory of relativity\\nWave–particle duality\\n\\nProposed theories\\n[edit]\\nThe proposed theories of physics are usually relatively new theories which deal with the study of physics which include scientific approaches, means for determining the validity of models and new types of reasoning used to arrive at the theory. However, some proposed theories include theories that have been around for decades and have eluded methods of discovery and testing. Proposed theories can include fringe theories in the process of becoming established (and, sometimes, gaining wider acceptance). Proposed theories usually have not been tested. In addition to the theories like those listed below, there are also different interpretations of quantum mechanics, which may or may not be considered different theories since it is debatable whether they yield different predictions for physical experiments, even in principle. For example, AdS/CFT correspondence, Chern–Simons theory, graviton, magnetic monopole, string theory, theory of everything.\\nFringe theories\\n[edit]\\nFringe theories include any new area of scientific endeavor in the process of becoming established and some proposed theories. It can include speculative sciences. This includes physics fields and physical theories presented in accordance with known evidence, and a body of associated predictions have been made according to that theory.\\nSome fringe theories go on to become a widely accepted part of physics. Other fringe theories end up being disproven. Some fringe theories are a form of protoscience and others are a form of pseudoscience. The falsification of the original theory sometimes leads to reformulation of the theory.\\nExamples\\n[edit]\\n\\nAether (classical element)\\nLuminiferous aether\\n\\n\\nDigital physics\\nElectrogravitics\\nStochastic electrodynamics\\nTesla's dynamic theory of gravity\\n\\nThought experiments vs real experiments\\n[edit]\\nMain article: Thought experiment\\n\\\"Thought\\\" experiments are situations created in one's mind, asking a question akin to \\\"suppose you are in this situation, assuming such is true, what would follow?\\\". They are usually created to investigate phenomena that are not readily experienced in every-day situations. Famous examples of such thought experiments are Schrödinger's cat, the EPR thought experiment, simple illustrations of time dilation, and so on. These usually lead to real experiments designed to verify that the conclusion (and therefore the assumptions) of the thought experiments are correct. The EPR thought experiment led to the Bell inequalities, which were then tested to various degrees of rigor, leading to the acceptance of the current formulation of quantum mechanics and probabilism as a working hypothesis.\\nSee also\\n[edit]\\n\\nList of theoretical physicists\\nPhilosophy of physics\\nSymmetry in quantum mechanics\\nTimeline of developments in theoretical physics\\nDouble field theory\\n\\nNotes\\n[edit]\\n\\n^ There is some debate as to whether or not theoretical physics uses mathematics to build intuition and illustrativeness to extract physical insight (especially when normal experience fails), rather than as a tool in formalizing theories. This links to the question of it using mathematics in a less formally rigorous, and more intuitive or heuristic way than, say, mathematical physics.\\n^ Sometimes the word \\\"theory\\\" can be used ambiguously in this sense, not to describe scientific theories, but research (sub)fields and programmes. Examples: relativity theory, quantum field theory, string theory.\\n^ The work of Johann Balmer and Johannes Rydberg in spectroscopy, and the semi-empirical mass formula of nuclear physics are good candidates for examples of this approach.\\n^ The Ptolemaic and Copernican models of the Solar system, the Bohr model of hydrogen atoms and nuclear shell model are good candidates for examples of this approach.\\n^ Arguably these are the most celebrated theories in physics: Newton's theory of gravitation, Einstein's theory of relativity and Maxwell's theory of electromagnetism share some of these attributes.\\n^ This approach is often favoured by (pure) mathematicians and mathematical physicists.\\n\\nReferences\\n[edit]\\n\\n^ van Dongen, Jeroen (2009). \\\"On the role of the Michelson-Morley experiment: Einstein in Chicago\\\". Archive for History of Exact Sciences. 63 (6): 655–663. arXiv:0908.1545. doi:10.1007/s00407-009-0050-5.\\n^ \\\"The Nobel Prize in Physics 1921\\\". The Nobel Foundation. Retrieved 2008-10-09.\\n^ Theorems and Theories Archived 2014-08-19 at the Wayback Machine, Sam Nelson.\\n^ Mark C. Chu-Carroll, March 13, 2007:Theories, Theorems, Lemmas, and Corollaries. Good Math, Bad Math blog.\\n^ Singiresu S. Rao (2007). Vibration of Continuous Systems (illustrated ed.). John Wiley & Sons. 5,12. ISBN 978-0471771715. ISBN 9780471771715\\n^ Eli Maor (2007). The Pythagorean Theorem: A 4,000-year History (illustrated ed.). Princeton University Press. pp. 18–20. ISBN 978-0691125268. ISBN 9780691125268\\n^ Bokulich, Alisa, \\\"Bohr's Correspondence Principle\\\", The Stanford Encyclopedia of Philosophy (Spring 2014 Edition), Edward N. Zalta (ed.)\\n^ Enc. Britannica (1994), pg 844.\\n^ Enc. Britannica (1994), pg 834.\\n^ Simplicity in the Philosophy of Science (retrieved 19 Aug 2014), Internet Encyclopedia of Philosophy.\\n^ See 'Correspondence of Isaac Newton, vol.2, 1676–1687' ed. H W Turnbull, Cambridge University Press 1960; at page 297, document #235, letter from Hooke to Newton dated 24 November 1679.\\n^ Penrose, R (2004). The Road to Reality. Jonathan Cape. p. 471.\\n^ Penrose, R (2004). \\\"9: Fourier decompositions and hyperfunctions\\\". The Road to Reality. Jonathan Cape.\\n\\nFurther reading\\n[edit]\\n\\nPhysical Sciences. Encyclopædia Britannica (Macropaedia). Vol. 25 (15th ed.). 1994.\\nDuhem, Pierre. La théorie physique - Son objet, sa structure, (in French). 2nd edition - 1914. English translation: The physical theory - its purpose, its structure. Republished by Joseph Vrin philosophical bookstore (1981), ISBN 2711602214.\\nFeynman, et al. The Feynman Lectures on Physics (3 vol.). First edition: Addison–Wesley, (1964, 1966).\\n\\nBestselling three-volume textbook covering the span of physics. Reference for both (under)graduate student and professional researcher alike.\\n\\nLandau et al. Course of Theoretical Physics.\\n\\nFamous series of books dealing with theoretical concepts in physics covering 10 volumes, translated into many languages and reprinted over many editions. Often known simply as \\\"Landau and Lifschits\\\" or \\\"Landau-Lifschits\\\" in the literature.\\n\\nLongair, MS. Theoretical Concepts in Physics: An Alternative View of Theoretical Reasoning in Physics. Cambridge University Press; 2d edition (4 Dec 2003). ISBN 052152878X. ISBN 978-0521528788\\nPlanck, Max (1909). Eight Lectures on theoretical physics. Library of Alexandria. ISBN 1465521887, ISBN 9781465521880.\\n\\nA set of lectures given in 1909 at Columbia University.\\n\\nSommerfeld, Arnold. Vorlesungen über theoretische Physik (Lectures on Theoretical Physics); German, 6 volumes.\\n\\nA series of lessons from a master educator of theoretical physicists.\\nExternal links\\n[edit]\\n\\nWikibooks has a book on the topic of: Introduction to Theoretical Physics\\n\\nMIT Center for Theoretical Physics\\nHow to become a GOOD Theoretical Physicist, a website made by Gerard 't Hooft\\n\\n| \\n* v\\n* t\\n* e\\nTheoretical physics\\n|\\n| --- |\\n| Structure | \\n\\nPhysics\\nModern\\nTheoretical\\nExperimental\\nComputational\\n\\n\\nTheory\\nList of theoretical physicists\\nPhilosophy of physics\\nTimeline of developments in theoretical physics\\n\\n|\\n| Concepts | \\n\\nDouble field theory\\nT-duality\\nInstanton\\nSelf-organized criticality\\nSupersymmetry\\nSymmetry in quantum mechanics\\nDimensionless physical constant\\n\\n|\\n| Theories and disciplines | \\n\\nRelativistic mechanics\\nSpecial\\nGeneral\\n\\n\\nNuclear physics\\nParticle physics\\nQuantum mechanics\\nString theory\\n\\n|\\n| Subatomic | \\n\\nQuantum field theory\\nSchrödinger equation\\n\\n|\\n| Spaces and objects | \\n\\nTopological space\\nList of manifolds\\nKnot (mathematics)\\nPoisson manifold\\nDifferentiable manifold\\nGeneral topology\\n\\n|\\n| Particles | \\n\\nBosons\\nGluons\\nMesons\\n\\n\\nFermions\\nQuarks\\nLeptons\\n\\n\\nChirality\\nin physics\\n\\n\\nHelicity\\nQuasiparticle\\n\\n|\\n| Processes, interactions | \\n\\nStrong interaction\\nWeak interaction\\nNuclear force\\nFifth force\\nMontonen–Olive duality\\n\\n|\\n| Spacetime | \\n\\nWormhole\\nOrientability\\nCauchy horizon\\nQuantum mechanics of time travel\\nQuantum gravity\\nChronology protection conjecture\\nCausal dynamical triangulation\\nRetrocausality\\nTime reversal symmetry\\nWheeler–Feynman time-symmetric theory\\nMinkowski spacetime\\nTime in physics\\nFour-dimensionalism\\nTipler time machine\\n\\n|\\n| Mathematics | \\n\\nTensors\\nLanglands program\\nRiemann zeta function\\n\\n|\\n| Classic physics | \\n\\nPhysics\\nResearch\\n\\n\\nApplied\\nEngineering\\n\\n\\nAtomic, molecular, and optical physics\\nAtomic\\nMolecular\\nModern optics\\n\\n\\nElectrodynamics\\nMechanics\\nCondensed matter physics\\nSolid-state physics\\nCrystallography\\n\\n\\n\\n|\\n| Other namespaces | \\n\\nTemplates: {{Relativity}}\\n{{Time travel}}\\nCategories: Topological spaces\\nFiction about physics\\n\\n|\\n| Related | \\n\\nGravity\\nStrong force\\nWeak force\\n\\n|\\n| \\n* v\\n* t\\n* e\\nMajor branches of physics\\n|\\n| --- |\\n| Divisions | \\n\\nPure\\nApplied\\nEngineering\\n\\n\\n\\n|\\n| Approaches | \\n\\nExperimental\\nTheoretical\\nComputational\\n\\n\\n\\n|\\n| Classical | \\n\\nClassical mechanics\\nNewtonian\\nAnalytical\\nCelestial\\nContinuum\\n\\n\\nAcoustics\\nClassical electromagnetism\\nClassical optics\\nRay\\nWave\\n\\n\\nThermodynamics\\nStatistical\\nNon-equilibrium\\n\\n\\n\\n|\\n| Modern | \\n\\nRelativistic mechanics\\nSpecial\\nGeneral\\n\\n\\nNuclear physics\\nParticle physics\\nQuantum mechanics\\nAtomic, molecular, and optical physics\\nAtomic\\nMolecular\\nModern optics\\n\\n\\nCondensed matter physics\\nSolid-state physics\\nCrystallography\\n\\n\\n\\n|\\n| Interdisciplinary | \\n\\nAstrophysics\\nAtmospheric physics\\nBiophysics\\nChemical physics\\nGeophysics\\nMaterials science\\nMathematical physics\\nMedical physics\\nOcean physics\\nQuantum information science\\n\\n|\\n| Related | \\n\\nHistory of physics\\nNobel Prize in Physics\\nPhilosophy of physics\\nPhysics education\\nresearch\\n\\n\\nTimeline of physics discoveries\\n\\n|\\nAuthority control databases: National GermanyJapanCzech Republic\\nRetrieved from \\\"https://en.wikipedia.org/w/index.php?title=Theoretical_physics&oldid=1276330074\\\"\\nCategory:\\n\\nTheoretical physics\\n\\nHidden categories:\\n\\nWebarchive template wayback links\\nArticles with short description\\n\\nShort description is different from Wikidata\\n\\n\\nThis page was last edited on 18 February 2025, at 05:59 (UTC).\\n\\n\\nText is available under the Creative Commons Attribution-ShareAlike 4.0 License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.\\n\\n\\nPrivacy policy\\n\\nAbout Wikipedia\\nDisclaimers\\nContact Wikipedia\\nCode of Conduct\\nDevelopers\\nStatistics\\nCookie statement\\n\\nMobile view\\n\\n\\n\\n\\n\\n\\nSearch\\nSearch\\nToggle the table of contents\\nTheoretical physics\\n\\n77 languages Add topic\", \"images\": []}], \"failed_results\": [], \"response_time\": 0.01}\n", - "==================================\u001B[1m Ai Message \u001B[0m==================================\n", + "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", "Here is a summary of the content from the Wikipedia pages on Albert Einstein and Theoretical Physics:\n", "\n", @@ -320,7 +324,7 @@ "source": [ "## API reference\n", "\n", - "For detailed documentation of all Tavily Search API features and configurations head to the API reference: https://docs.tavily.com/documentation/api-reference/endpoint/extract" + "For detailed documentation of all Tavily Search API features and configurations head to the [API reference](https://docs.tavily.com/documentation/api-reference/endpoint/extract)." ] } ], diff --git a/docs/docs/integrations/tools/tavily_search.ipynb b/docs/docs/integrations/tools/tavily_search.ipynb index 001d6473099..e8de3f3ebca 100644 --- a/docs/docs/integrations/tools/tavily_search.ipynb +++ b/docs/docs/integrations/tools/tavily_search.ipynb @@ -73,8 +73,9 @@ ] }, { - "metadata": {}, "cell_type": "markdown", + "id": "72461be913bfaf2b", + "metadata": {}, "source": [ "## Instantiation\n", "\n", @@ -83,26 +84,26 @@ "Instantiation\n", "The tool accepts various parameters during instantiation:\n", "\n", - "- max_results (optional, int): Maximum number of search results to return. Default is 5.\n", - "- topic (optional, str): Category of the search. Can be \"general\", \"news\", or \"finance\". Default is \"general\".\n", - "- include_answer (optional, bool): Include an answer to original query in results. Default is False.\n", - "- include_raw_content (optional, bool): Include cleaned and parsed HTML of each search result. Default is False.\n", - "- include_images (optional, bool): Include a list of query related images in the response. Default is False.\n", - "- include_image_descriptions (optional, bool): Include descriptive text for each image. Default is False.\n", - "- search_depth (optional, str): Depth of the search, either \"basic\" or \"advanced\". Default is \"basic\".\n", - "- time_range (optional, str): The time range back from the current date to filter results - \"day\", \"week\", \"month\", or \"year\". Default is None.\n", - "- include_domains (optional, List[str]): List of domains to specifically include. Default is None.\n", - "- exclude_domains (optional, List[str]): List of domains to specifically exclude. Default is None.\n", + "- `max_results` (optional, int): Maximum number of search results to return. Default is 5.\n", + "- `topic` (optional, str): Category of the search. Can be `'general'`, `'news'`, or `'finance'`. Default is `'general'`.\n", + "- `include_answer` (optional, bool): Include an answer to original query in results. Default is False.\n", + "- `include_raw_content` (optional, bool): Include cleaned and parsed HTML of each search result. Default is False.\n", + "- `include_images` (optional, bool): Include a list of query related images in the response. Default is False.\n", + "- `include_image_descriptions` (optional, bool): Include descriptive text for each image. Default is False.\n", + "- `search_depth` (optional, str): Depth of the search, either `'basic'` or `'advanced'`. Default is `'basic'`.\n", + "- `time_range` (optional, str): The time range back from the current date to filter results - `'day'`, `'week'`, `'month'`, or `'year'`. Default is None.\n", + "- `include_domains` (optional, List[str]): List of domains to specifically include. Default is None.\n", + "- `exclude_domains` (optional, List[str]): List of domains to specifically exclude. Default is None.\n", "\n", "For a comprehensive overview of the available parameters, refer to the [Tavily Search API documentation](https://docs.tavily.com/documentation/api-reference/endpoint/search)" - ], - "id": "72461be913bfaf2b" + ] }, { - "metadata": {}, "cell_type": "code", - "outputs": [], "execution_count": null, + "id": "dc382e5426394836", + "metadata": {}, + "outputs": [], "source": [ "from langchain_tavily import TavilySearch\n", "\n", @@ -118,12 +119,12 @@ " # include_domains=None,\n", " # exclude_domains=None\n", ")" - ], - "id": "dc382e5426394836" + ] }, { - "metadata": {}, "cell_type": "markdown", + "id": "f997d2733b63f655", + "metadata": {}, "source": [ "## Invocation\n", "\n", @@ -134,18 +135,22 @@ "- The following arguments can also be set during invocation : `include_images`, `search_depth` , `time_range`, `include_domains`, `exclude_domains`, `include_images`\n", "- For reliability and performance reasons, certain parameters that affect response size cannot be modified during invocation: `include_answer` and `include_raw_content`. These limitations prevent unexpected context window issues and ensure consistent results.\n", "\n", + ":::note\n", "\n", - "NOTE: The optional arguments are available for agents to dynamically set, if you set an argument during instantiation and then invoke the tool with a different value, the tool will use the value you passed during invocation." - ], - "id": "f997d2733b63f655" + "The optional arguments are available for agents to dynamically set, if you set an argument during instantiation and then invoke the tool with a different value, the tool will use the value you passed during invocation.\n", + "\n", + ":::" + ] }, { - "metadata": {}, "cell_type": "code", - "outputs": [], "execution_count": null, - "source": "tool.invoke({\"query\": \"What happened at the last wimbledon\"})", - "id": "5e75399230ab9fc1" + "id": "5e75399230ab9fc1", + "metadata": {}, + "outputs": [], + "source": [ + "tool.invoke({\"query\": \"What happened at the last wimbledon\"})" + ] }, { "cell_type": "markdown", @@ -154,7 +159,7 @@ "source": [ "### [Invoke with ToolCall](/docs/concepts/tools)\n", "\n", - "We can also invoke the tool with a model-generated ToolCall, in which case a ToolMessage will be returned:" + "We can also invoke the tool with a model-generated `ToolCall`, in which case a `ToolMessage` will be returned:" ] }, { @@ -233,7 +238,7 @@ "id": "1020a506-473b-4e6a-a563-7aaf92c4d183", "metadata": {}, "source": [ - "We will need to install langgraph:" + "We will need to install `langgraph`:" ] }, { @@ -256,21 +261,21 @@ "name": "stdout", "output_type": "stream", "text": [ - "================================\u001B[1m Human Message \u001B[0m=================================\n", + "================================\u001b[1m Human Message \u001b[0m=================================\n", "\n", "What nation hosted the Euro 2024? Include only wikipedia sources.\n", - "==================================\u001B[1m Ai Message \u001B[0m==================================\n", + "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "Tool Calls:\n", " tavily_search (call_yxmR4K2uadsQ8LKoyi8JyoLD)\n", " Call ID: call_yxmR4K2uadsQ8LKoyi8JyoLD\n", " Args:\n", " query: Euro 2024 host nation\n", " include_domains: ['wikipedia.org']\n", - "=================================\u001B[1m Tool Message \u001B[0m=================================\n", + "=================================\u001b[1m Tool Message \u001b[0m=================================\n", "Name: tavily_search\n", "\n", "{\"query\": \"Euro 2024 host nation\", \"follow_up_questions\": null, \"answer\": null, \"images\": [], \"results\": [{\"title\": \"UEFA Euro 2024 - Wikipedia\", \"url\": \"https://en.wikipedia.org/wiki/UEFA_Euro_2024\", \"content\": \"Tournament details Host country Germany Dates 14 June – 14 July Teams 24 Venue(s) 10 (in 10 host cities) Final positions Champions Spain (4th title) Runners-up England Tournament statistics Matches played 51 Goals scored 117 (2.29 per match) Attendance 2,681,288 (52,574 per match) Top scorer(s) Harry Kane Georges Mikautadze Jamal Musiala Cody Gakpo Ivan Schranz Dani Olmo (3 goals each) Best player(s) Rodri Best young player Lamine Yamal ← 2020 2028 → The 2024 UEFA European Football Championship, commonly referred to as UEFA Euro 2024 (stylised as UEFA EURO 2024) or simply Euro 2024, was the 17th UEFA European Championship, the quadrennial international football championship organised by UEFA for the European men's national teams of their member associations. Germany hosted the tournament, which took place from 14 June to 14 July 2024. The tournament involved 24 teams, with Georgia making their European Championship debut. [4] Host nation Germany were eliminated by Spain in the quarter-finals; Spain went on to win the tournament for a record fourth time after defeating England 2–1 in the final.\", \"score\": 0.9104262, \"raw_content\": null}, {\"title\": \"UEFA Euro 2024 - Simple English Wikipedia, the free encyclopedia\", \"url\": \"https://simple.wikipedia.org/wiki/UEFA_Euro_2024\", \"content\": \"The 2024 UEFA European Football Championship, also known as UEFA Euro 2024 or simply Euro 2024, was the 17th edition of the UEFA European Championship. Germany was hosting the tournament. ... The UEFA Executive Committee voted for the host in a secret ballot, with only a simple majority (more than half of the valid votes) required to determine\", \"score\": 0.81418616, \"raw_content\": null}, {\"title\": \"Championnat d'Europe de football 2024 — Wikipédia\", \"url\": \"https://fr.wikipedia.org/wiki/Championnat_d'Europe_de_football_2024\", \"content\": \"Le Championnat d'Europe de l'UEFA de football 2024 est la 17 e édition du Championnat d'Europe de football, communément abrégé en Euro 2024, compétition organisée par l'UEFA et rassemblant les meilleures équipes nationales masculines européennes. L'Allemagne est désignée pays organisateur de la compétition le 27 septembre 2018. C'est la troisième fois que des matches du Championnat\", \"score\": 0.8055255, \"raw_content\": null}, {\"title\": \"UEFA Euro 2024 bids - Wikipedia\", \"url\": \"https://en.wikipedia.org/wiki/UEFA_Euro_2024_bids\", \"content\": \"The bidding process of UEFA Euro 2024 ended on 27 September 2018 in Nyon, Switzerland, when Germany was announced to be the host. [1] Two bids came before the deadline, 3 March 2017, which were Germany and Turkey as single bids. ... Press agencies revealed on 24 October 2013, that the European football governing body UEFA would have decided on\", \"score\": 0.7882741, \"raw_content\": null}, {\"title\": \"2024 UEFA European Under-19 Championship - Wikipedia\", \"url\": \"https://en.wikipedia.org/wiki/2024_UEFA_European_Under-19_Championship\", \"content\": \"The 2024 UEFA European Under-19 Championship (also known as UEFA Under-19 Euro 2024) was the 21st edition of the UEFA European Under-19 Championship (71st edition if the Under-18 and Junior eras are included), the annual international youth football championship organised by UEFA for the men's under-19 national teams of Europe. Northern Ireland hosted the tournament from 15 to 28 July 2024.\", \"score\": 0.7783298, \"raw_content\": null}], \"response_time\": 1.67}\n", - "==================================\u001B[1m Ai Message \u001B[0m==================================\n", + "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", "The nation that hosted Euro 2024 was Germany. You can find more information on the [Wikipedia page for UEFA Euro 2024](https://en.wikipedia.org/wiki/UEFA_Euro_2024).\n" ] @@ -304,8 +309,14 @@ "source": [ "## API reference\n", "\n", - "For detailed documentation of all Tavily Search API features and configurations head to the API reference: https://docs.tavily.com/documentation/api-reference/endpoint/search" + "For detailed documentation of all Tavily Search API features and configurations head to the [API reference](https://docs.tavily.com/documentation/api-reference/endpoint/search)." ] + }, + { + "cell_type": "markdown", + "id": "589ff839", + "metadata": {}, + "source": [] } ], "metadata": { From 34800332bff459b730799e45f358d52b2817343b Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Thu, 14 Aug 2025 22:37:36 -0400 Subject: [PATCH 5/8] chore: update integrations table (#32556) Enhance the integrations table by adding the `js: '@langchain/community'` reference for several packages and updating the titles of specific integrations to avoid improper capitalization --- libs/packages.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libs/packages.yml b/libs/packages.yml index 49eff9d7b58..05119be628f 100644 --- a/libs/packages.yml +++ b/libs/packages.yml @@ -46,6 +46,7 @@ packages: - name: langchain-chroma path: libs/partners/chroma repo: langchain-ai/langchain + js: '@langchain/community' downloads: 892000 downloads_updated_at: '2025-08-10T21:38:36.795416+00:00' - name: langchain-exa @@ -58,6 +59,7 @@ packages: - name: langchain-fireworks path: libs/partners/fireworks repo: langchain-ai/langchain + js: '@langchain/community' downloads: 238000 downloads_updated_at: '2025-08-10T21:38:36.795416+00:00' - name: langchain-groq @@ -69,6 +71,7 @@ packages: - name: langchain-huggingface path: libs/partners/huggingface repo: langchain-ai/langchain + js: '@langchain/community' downloads: 793000 downloads_updated_at: '2025-08-10T21:38:36.795416+00:00' - name: langchain-ibm @@ -144,6 +147,7 @@ packages: - name: langchain-together path: libs/together repo: langchain-ai/langchain-together + js: '@langchain/community' downloads: 89000 downloads_updated_at: '2025-08-10T21:38:36.795416+00:00' - name: langchain-upstage @@ -167,6 +171,7 @@ packages: name_title: DataStax Astra DB path: libs/astradb repo: langchain-ai/langchain-datastax + js: '@langchain/community' downloads: 117000 downloads_updated_at: '2025-08-10T21:38:36.795416+00:00' - name: langchain-google-genai @@ -205,6 +210,7 @@ packages: - name: langchain-elasticsearch path: libs/elasticsearch repo: langchain-ai/langchain-elastic + js: '@langchain/community' downloads: 218000 downloads_updated_at: '2025-08-10T21:38:36.795416+00:00' - name: langchain-nvidia-ai-endpoints @@ -292,6 +298,7 @@ packages: - name: langchain-neo4j path: libs/neo4j repo: langchain-ai/langchain-neo4j + js: '@langchain/community' downloads: 100000 downloads_updated_at: '2025-08-10T21:38:36.795416+00:00' - name: langchain-linkup @@ -350,6 +357,7 @@ packages: downloads: 31000 downloads_updated_at: '2025-08-10T21:38:36.795416+00:00' - name: langchain-lindorm-integration + name_title: Lindorm path: . repo: AlwaysBluer/langchain-lindorm-integration provider_page: lindorm @@ -444,6 +452,7 @@ packages: downloads: 1000 downloads_updated_at: '2025-08-10T21:38:36.795416+00:00' - name: langchain-discord-shikenso + name_title: Discord (Shikenso) path: . repo: Shikenso-Analytics/langchain-discord downloads: 138 @@ -571,7 +580,7 @@ packages: downloads: 3000 downloads_updated_at: '2025-08-10T21:38:36.795416+00:00' - name: langchain-naver-community - name_title: Naver (community-maintained) + name_title: Naver path: . repo: e7217/langchain-naver-community provider_page: naver @@ -595,6 +604,7 @@ packages: - name: langchain-perplexity path: libs/partners/perplexity repo: langchain-ai/langchain + js: '@langchain/community' downloads: 348000 downloads_updated_at: '2025-08-10T21:38:36.795416+00:00' - name: langchain-runpod @@ -717,6 +727,7 @@ packages: path: . repo: anchorbrowser/langchain-anchorbrowser - name: toolbox-langchain + name_title: MCP Toolbox repo: googleapis/mcp-toolbox-sdk-python path: packages/toolbox-langchain - name: langchain-scrapeless From 4656f727da238c1fe24f95698842b94d579844c2 Mon Sep 17 00:00:00 2001 From: Christophe Bornet Date: Fri, 15 Aug 2025 15:45:20 +0200 Subject: [PATCH 6/8] chore(text-splitters): add mypy `warn_unreachable` (#32558) --- .../langchain_text_splitters/html.py | 3 -- .../langchain_text_splitters/json.py | 2 +- libs/text-splitters/pyproject.toml | 7 +-- libs/text-splitters/uv.lock | 45 ++++++++++--------- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/libs/text-splitters/langchain_text_splitters/html.py b/libs/text-splitters/langchain_text_splitters/html.py index e96f142e0db..55090cdd234 100644 --- a/libs/text-splitters/langchain_text_splitters/html.py +++ b/libs/text-splitters/langchain_text_splitters/html.py @@ -444,9 +444,6 @@ class HTMLSectionSplitter: Returns: str: The transformed HTML content as a string. """ - if self.xslt_path is None: - return html_content - try: from lxml import etree except ImportError as e: diff --git a/libs/text-splitters/langchain_text_splitters/json.py b/libs/text-splitters/langchain_text_splitters/json.py index f8d3fdabc50..1dfb663f4d9 100644 --- a/libs/text-splitters/langchain_text_splitters/json.py +++ b/libs/text-splitters/langchain_text_splitters/json.py @@ -75,7 +75,7 @@ class RecursiveJsonSplitter: def _json_split( self, - data: dict[str, Any], + data: Any, current_path: Optional[list[str]] = None, chunks: Optional[list[dict[str, Any]]] = None, ) -> list[dict[str, Any]]: diff --git a/libs/text-splitters/pyproject.toml b/libs/text-splitters/pyproject.toml index 597c73ecf62..dbff758dde6 100644 --- a/libs/text-splitters/pyproject.toml +++ b/libs/text-splitters/pyproject.toml @@ -52,13 +52,14 @@ test_integration = [ langchain-core = { path = "../core", editable = true } [tool.mypy] -strict = "True" -strict_bytes = "True" +strict = true +strict_bytes = true enable_error_code = "deprecated" +warn_unreachable = true [[tool.mypy.overrides]] module = ["konlpy", "nltk",] -ignore_missing_imports = "True" +ignore_missing_imports = true [tool.ruff] target-version = "py39" diff --git a/libs/text-splitters/uv.lock b/libs/text-splitters/uv.lock index 1586b7781c1..08be9a2dcd4 100644 --- a/libs/text-splitters/uv.lock +++ b/libs/text-splitters/uv.lock @@ -1141,7 +1141,7 @@ test = [ test-integration = [] typing = [ { name = "langchain-text-splitters", directory = "." }, - { name = "mypy", specifier = ">=1.15,<1.16" }, + { name = "mypy", specifier = ">=1.17.1,<1.18" }, { name = "types-pyyaml", specifier = ">=6.0.12.2,<7.0.0.0" }, { name = "types-requests", specifier = ">=2.28.11.5,<3.0.0.0" }, ] @@ -2159,9 +2159,9 @@ wheels = [ name = "pip" version = "25.2" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/20/16/650289cd3f43d5a2fadfd98c68bd1e1e7f2550a1a5326768cddfbcedb2c5/pip-25.2.tar.gz", hash = "sha256:578283f006390f85bb6282dffb876454593d637f5d1be494b5202ce4877e71f2", size = 1840021, upload-time = "2025-07-30T21:50:15.401Z" } +sdist = { url = "https://files.pythonhosted.org/packages/20/16/650289cd3f43d5a2fadfd98c68bd1e1e7f2550a1a5326768cddfbcedb2c5/pip-25.2.tar.gz", hash = "sha256:578283f006390f85bb6282dffb876454593d637f5d1be494b5202ce4877e71f2", size = 1840021 } wheels = [ - { url = "https://files.pythonhosted.org/packages/b7/3f/945ef7ab14dc4f9d7f40288d2df998d1837ee0888ec3659c813487572faa/pip-25.2-py3-none-any.whl", hash = "sha256:6d67a2b4e7f14d8b31b8b52648866fa717f45a1eb70e83002f4331d07e953717", size = 1752557, upload-time = "2025-07-30T21:50:13.323Z" }, + { url = "https://files.pythonhosted.org/packages/b7/3f/945ef7ab14dc4f9d7f40288d2df998d1837ee0888ec3659c813487572faa/pip-25.2-py3-none-any.whl", hash = "sha256:6d67a2b4e7f14d8b31b8b52648866fa717f45a1eb70e83002f4331d07e953717", size = 1752557 }, ] [[package]] @@ -2950,27 +2950,28 @@ wheels = [ [[package]] name = "ruff" -version = "0.12.2" +version = "0.12.9" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/6c/3d/d9a195676f25d00dbfcf3cf95fdd4c685c497fcfa7e862a44ac5e4e96480/ruff-0.12.2.tar.gz", hash = "sha256:d7b4f55cd6f325cb7621244f19c873c565a08aff5a4ba9c69aa7355f3f7afd3e", size = 4432239 } +sdist = { url = "https://files.pythonhosted.org/packages/4a/45/2e403fa7007816b5fbb324cb4f8ed3c7402a927a0a0cb2b6279879a8bfdc/ruff-0.12.9.tar.gz", hash = "sha256:fbd94b2e3c623f659962934e52c2bea6fc6da11f667a427a368adaf3af2c866a", size = 5254702 } wheels = [ - { url = "https://files.pythonhosted.org/packages/74/b6/2098d0126d2d3318fd5bec3ad40d06c25d377d95749f7a0c5af17129b3b1/ruff-0.12.2-py3-none-linux_armv6l.whl", hash = "sha256:093ea2b221df1d2b8e7ad92fc6ffdca40a2cb10d8564477a987b44fd4008a7be", size = 10369761 }, - { url = "https://files.pythonhosted.org/packages/b1/4b/5da0142033dbe155dc598cfb99262d8ee2449d76920ea92c4eeb9547c208/ruff-0.12.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:09e4cf27cc10f96b1708100fa851e0daf21767e9709e1649175355280e0d950e", size = 11155659 }, - { url = "https://files.pythonhosted.org/packages/3e/21/967b82550a503d7c5c5c127d11c935344b35e8c521f52915fc858fb3e473/ruff-0.12.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:8ae64755b22f4ff85e9c52d1f82644abd0b6b6b6deedceb74bd71f35c24044cc", size = 10537769 }, - { url = "https://files.pythonhosted.org/packages/33/91/00cff7102e2ec71a4890fb7ba1803f2cdb122d82787c7d7cf8041fe8cbc1/ruff-0.12.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3eb3a6b2db4d6e2c77e682f0b988d4d61aff06860158fdb413118ca133d57922", size = 10717602 }, - { url = "https://files.pythonhosted.org/packages/9b/eb/928814daec4e1ba9115858adcda44a637fb9010618721937491e4e2283b8/ruff-0.12.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:73448de992d05517170fc37169cbca857dfeaeaa8c2b9be494d7bcb0d36c8f4b", size = 10198772 }, - { url = "https://files.pythonhosted.org/packages/50/fa/f15089bc20c40f4f72334f9145dde55ab2b680e51afb3b55422effbf2fb6/ruff-0.12.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3b8b94317cbc2ae4a2771af641739f933934b03555e51515e6e021c64441532d", size = 11845173 }, - { url = "https://files.pythonhosted.org/packages/43/9f/1f6f98f39f2b9302acc161a4a2187b1e3a97634fe918a8e731e591841cf4/ruff-0.12.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:45fc42c3bf1d30d2008023a0a9a0cfb06bf9835b147f11fe0679f21ae86d34b1", size = 12553002 }, - { url = "https://files.pythonhosted.org/packages/d8/70/08991ac46e38ddd231c8f4fd05ef189b1b94be8883e8c0c146a025c20a19/ruff-0.12.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ce48f675c394c37e958bf229fb5c1e843e20945a6d962cf3ea20b7a107dcd9f4", size = 12171330 }, - { url = "https://files.pythonhosted.org/packages/88/a9/5a55266fec474acfd0a1c73285f19dd22461d95a538f29bba02edd07a5d9/ruff-0.12.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:793d8859445ea47591272021a81391350205a4af65a9392401f418a95dfb75c9", size = 11774717 }, - { url = "https://files.pythonhosted.org/packages/87/e5/0c270e458fc73c46c0d0f7cf970bb14786e5fdb88c87b5e423a4bd65232b/ruff-0.12.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6932323db80484dda89153da3d8e58164d01d6da86857c79f1961934354992da", size = 11646659 }, - { url = "https://files.pythonhosted.org/packages/b7/b6/45ab96070c9752af37f0be364d849ed70e9ccede07675b0ec4e3ef76b63b/ruff-0.12.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:6aa7e623a3a11538108f61e859ebf016c4f14a7e6e4eba1980190cacb57714ce", size = 10604012 }, - { url = "https://files.pythonhosted.org/packages/86/91/26a6e6a424eb147cc7627eebae095cfa0b4b337a7c1c413c447c9ebb72fd/ruff-0.12.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:2a4a20aeed74671b2def096bdf2eac610c7d8ffcbf4fb0e627c06947a1d7078d", size = 10176799 }, - { url = "https://files.pythonhosted.org/packages/f5/0c/9f344583465a61c8918a7cda604226e77b2c548daf8ef7c2bfccf2b37200/ruff-0.12.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:71a4c550195612f486c9d1f2b045a600aeba851b298c667807ae933478fcef04", size = 11241507 }, - { url = "https://files.pythonhosted.org/packages/1c/b7/99c34ded8fb5f86c0280278fa89a0066c3760edc326e935ce0b1550d315d/ruff-0.12.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:4987b8f4ceadf597c927beee65a5eaf994c6e2b631df963f86d8ad1bdea99342", size = 11717609 }, - { url = "https://files.pythonhosted.org/packages/51/de/8589fa724590faa057e5a6d171e7f2f6cffe3287406ef40e49c682c07d89/ruff-0.12.2-py3-none-win32.whl", hash = "sha256:369ffb69b70cd55b6c3fc453b9492d98aed98062db9fec828cdfd069555f5f1a", size = 10523823 }, - { url = "https://files.pythonhosted.org/packages/94/47/8abf129102ae4c90cba0c2199a1a9b0fa896f6f806238d6f8c14448cc748/ruff-0.12.2-py3-none-win_amd64.whl", hash = "sha256:dca8a3b6d6dc9810ed8f328d406516bf4d660c00caeaef36eb831cf4871b0639", size = 11629831 }, - { url = "https://files.pythonhosted.org/packages/e2/1f/72d2946e3cc7456bb837e88000eb3437e55f80db339c840c04015a11115d/ruff-0.12.2-py3-none-win_arm64.whl", hash = "sha256:48d6c6bfb4761df68bc05ae630e24f506755e702d4fb08f08460be778c7ccb12", size = 10735334 }, + { url = "https://files.pythonhosted.org/packages/ad/20/53bf098537adb7b6a97d98fcdebf6e916fcd11b2e21d15f8c171507909cc/ruff-0.12.9-py3-none-linux_armv6l.whl", hash = "sha256:fcebc6c79fcae3f220d05585229463621f5dbf24d79fdc4936d9302e177cfa3e", size = 11759705 }, + { url = "https://files.pythonhosted.org/packages/20/4d/c764ee423002aac1ec66b9d541285dd29d2c0640a8086c87de59ebbe80d5/ruff-0.12.9-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:aed9d15f8c5755c0e74467731a007fcad41f19bcce41cd75f768bbd687f8535f", size = 12527042 }, + { url = "https://files.pythonhosted.org/packages/8b/45/cfcdf6d3eb5fc78a5b419e7e616d6ccba0013dc5b180522920af2897e1be/ruff-0.12.9-py3-none-macosx_11_0_arm64.whl", hash = "sha256:5b15ea354c6ff0d7423814ba6d44be2807644d0c05e9ed60caca87e963e93f70", size = 11724457 }, + { url = "https://files.pythonhosted.org/packages/72/e6/44615c754b55662200c48bebb02196dbb14111b6e266ab071b7e7297b4ec/ruff-0.12.9-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d596c2d0393c2502eaabfef723bd74ca35348a8dac4267d18a94910087807c53", size = 11949446 }, + { url = "https://files.pythonhosted.org/packages/fd/d1/9b7d46625d617c7df520d40d5ac6cdcdf20cbccb88fad4b5ecd476a6bb8d/ruff-0.12.9-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:1b15599931a1a7a03c388b9c5df1bfa62be7ede6eb7ef753b272381f39c3d0ff", size = 11566350 }, + { url = "https://files.pythonhosted.org/packages/59/20/b73132f66f2856bc29d2d263c6ca457f8476b0bbbe064dac3ac3337a270f/ruff-0.12.9-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3d02faa2977fb6f3f32ddb7828e212b7dd499c59eb896ae6c03ea5c303575756", size = 13270430 }, + { url = "https://files.pythonhosted.org/packages/a2/21/eaf3806f0a3d4c6be0a69d435646fba775b65f3f2097d54898b0fd4bb12e/ruff-0.12.9-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:17d5b6b0b3a25259b69ebcba87908496e6830e03acfb929ef9fd4c58675fa2ea", size = 14264717 }, + { url = "https://files.pythonhosted.org/packages/d2/82/1d0c53bd37dcb582b2c521d352fbf4876b1e28bc0d8894344198f6c9950d/ruff-0.12.9-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:72db7521860e246adbb43f6ef464dd2a532ef2ef1f5dd0d470455b8d9f1773e0", size = 13684331 }, + { url = "https://files.pythonhosted.org/packages/3b/2f/1c5cf6d8f656306d42a686f1e207f71d7cebdcbe7b2aa18e4e8a0cb74da3/ruff-0.12.9-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a03242c1522b4e0885af63320ad754d53983c9599157ee33e77d748363c561ce", size = 12739151 }, + { url = "https://files.pythonhosted.org/packages/47/09/25033198bff89b24d734e6479e39b1968e4c992e82262d61cdccaf11afb9/ruff-0.12.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9fc83e4e9751e6c13b5046d7162f205d0a7bac5840183c5beebf824b08a27340", size = 12954992 }, + { url = "https://files.pythonhosted.org/packages/52/8e/d0dbf2f9dca66c2d7131feefc386523404014968cd6d22f057763935ab32/ruff-0.12.9-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:881465ed56ba4dd26a691954650de6ad389a2d1fdb130fe51ff18a25639fe4bb", size = 12899569 }, + { url = "https://files.pythonhosted.org/packages/a0/bd/b614d7c08515b1428ed4d3f1d4e3d687deffb2479703b90237682586fa66/ruff-0.12.9-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:43f07a3ccfc62cdb4d3a3348bf0588358a66da756aa113e071b8ca8c3b9826af", size = 11751983 }, + { url = "https://files.pythonhosted.org/packages/58/d6/383e9f818a2441b1a0ed898d7875f11273f10882f997388b2b51cb2ae8b5/ruff-0.12.9-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:07adb221c54b6bba24387911e5734357f042e5669fa5718920ee728aba3cbadc", size = 11538635 }, + { url = "https://files.pythonhosted.org/packages/20/9c/56f869d314edaa9fc1f491706d1d8a47747b9d714130368fbd69ce9024e9/ruff-0.12.9-py3-none-musllinux_1_2_i686.whl", hash = "sha256:f5cd34fabfdea3933ab85d72359f118035882a01bff15bd1d2b15261d85d5f66", size = 12534346 }, + { url = "https://files.pythonhosted.org/packages/bd/4b/d8b95c6795a6c93b439bc913ee7a94fda42bb30a79285d47b80074003ee7/ruff-0.12.9-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:f6be1d2ca0686c54564da8e7ee9e25f93bdd6868263805f8c0b8fc6a449db6d7", size = 13017021 }, + { url = "https://files.pythonhosted.org/packages/c7/c1/5f9a839a697ce1acd7af44836f7c2181cdae5accd17a5cb85fcbd694075e/ruff-0.12.9-py3-none-win32.whl", hash = "sha256:cc7a37bd2509974379d0115cc5608a1a4a6c4bff1b452ea69db83c8855d53f93", size = 11734785 }, + { url = "https://files.pythonhosted.org/packages/fa/66/cdddc2d1d9a9f677520b7cfc490d234336f523d4b429c1298de359a3be08/ruff-0.12.9-py3-none-win_amd64.whl", hash = "sha256:6fb15b1977309741d7d098c8a3cb7a30bc112760a00fb6efb7abc85f00ba5908", size = 12840654 }, + { url = "https://files.pythonhosted.org/packages/ac/fd/669816bc6b5b93b9586f3c1d87cd6bc05028470b3ecfebb5938252c47a35/ruff-0.12.9-py3-none-win_arm64.whl", hash = "sha256:63c8c819739d86b96d500cce885956a1a48ab056bbcbc61b747ad494b2485089", size = 11949623 }, ] [[package]] From b2b835cb36b37c4b5abf9ada6464c9693e0c7955 Mon Sep 17 00:00:00 2001 From: Rostyslav Borovyk Date: Fri, 15 Aug 2025 17:46:26 +0300 Subject: [PATCH 7/8] docs(docs): add Oxylabs document loader (#32429) Thank you for contributing to LangChain! Follow these steps to mark your pull request as ready for review. **If any of these steps are not completed, your PR will not be considered for review.** - [x] **PR title**: Follows the format: {TYPE}({SCOPE}): {DESCRIPTION} - Examples: - feat(core): add multi-tenant support - fix(cli): resolve flag parsing error - docs(openai): update API usage examples - Allowed `{TYPE}` values: - feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert, release - Allowed `{SCOPE}` values (optional): - core, cli, langchain, standard-tests, docs, anthropic, chroma, deepseek, exa, fireworks, groq, huggingface, mistralai, nomic, ollama, openai, perplexity, prompty, qdrant, xai - Note: the `{DESCRIPTION}` must not start with an uppercase letter. - Once you've written the title, please delete this checklist item; do not include it in the PR. - [x] **PR message**: ***Delete this entire checklist*** and replace with - **Description:** a description of the change. Include a [closing keyword](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) if applicable to a relevant issue. - **Issue:** the issue # it fixes, if applicable (e.g. Fixes #123) - **Dependencies:** any dependencies required for this change - **Twitter handle:** if your PR gets announced, and you'd like a mention, we'll gladly shout you out! - [x] **Add tests and docs**: If you're adding a new integration, you must include: 1. A test for the integration, preferably unit tests that do not rely on network access, 2. An example notebook showing its use. It lives in `docs/docs/integrations` directory. - [x] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. **We will not consider a PR unless these three are passing in CI.** See [contribution guidelines](https://python.langchain.com/docs/contributing/) for more. Additional guidelines: - Make sure optional dependencies are imported within a function. - Please do not add dependencies to `pyproject.toml` files (even optional ones) unless they are **required** for unit tests. - Most PRs should not touch more than one package. - Changes should be backwards compatible. --------- Co-authored-by: Mason Daugherty --- .../document_loaders/oxylabs.ipynb | 334 ++++++++++++++++++ docs/src/theme/FeatureTables.js | 7 + 2 files changed, 341 insertions(+) create mode 100644 docs/docs/integrations/document_loaders/oxylabs.ipynb diff --git a/docs/docs/integrations/document_loaders/oxylabs.ipynb b/docs/docs/integrations/document_loaders/oxylabs.ipynb new file mode 100644 index 00000000000..b23102dd43b --- /dev/null +++ b/docs/docs/integrations/document_loaders/oxylabs.ipynb @@ -0,0 +1,334 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Oxylabs" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[Oxylabs](https://oxylabs.io/) is a web intelligence collection platform that enables companies worldwide to unlock data-driven insights.\n", + "\n", + "## Overview\n", + "\n", + "Oxylabs document loader allows to load data from search engines, e-commerce sites, travel platforms, and any other website. It supports geolocation, browser rendering, data parsing, multiple user agents and many more parameters. Check out [Oxylabs documentation](https://developers.oxylabs.io/scraping-solutions/web-scraper-api) for more information.\n", + "\n", + "\n", + "### Integration details\n", + "\n", + "| Class | Package | Local | Serializable | Pricing |\n", + "|:--------------|:------------------------------------------------------------------|:-----:|:------------:|:-----------------------------:|\n", + "| OxylabsLoader | [langchain-oxylabs](https://github.com/oxylabs/langchain-oxylabs) | ✅ | ❌ | Free 5,000 results for 1 week |\n", + "\n", + "### Loader features\n", + "| Document Lazy Loading |\n", + "|:---------------------:|\n", + "| ✅ |\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Setup" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Install the required dependencies.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%pip install -U langchain-oxylabs" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Credentials\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Set up the proper API keys and environment variables.\n", + "Create your API user credentials: Sign up for a free trial or purchase the product\n", + "in the [Oxylabs dashboard](https://dashboard.oxylabs.io/en/registration)\n", + "to create your API user credentials (OXYLABS_USERNAME and OXYLABS_PASSWORD)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import getpass\n", + "import os\n", + "\n", + "os.environ[\"OXYLABS_USERNAME\"] = getpass.getpass(\"Enter your Oxylabs username: \")\n", + "os.environ[\"OXYLABS_PASSWORD\"] = getpass.getpass(\"Enter your Oxylabs password: \")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Initialization" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "ExecuteTime": { + "end_time": "2025-08-06T10:57:51.630011Z", + "start_time": "2025-08-06T10:57:51.623814Z" + } + }, + "outputs": [], + "source": [ + "from langchain_oxylabs import OxylabsLoader" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "ExecuteTime": { + "end_time": "2025-08-06T10:57:53.685413Z", + "start_time": "2025-08-06T10:57:53.628859Z" + } + }, + "outputs": [], + "source": [ + "loader = OxylabsLoader(\n", + " urls=[\n", + " \"https://sandbox.oxylabs.io/products/1\",\n", + " \"https://sandbox.oxylabs.io/products/2\",\n", + " ],\n", + " params={\"markdown\": True},\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "## Load" + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "ExecuteTime": { + "end_time": "2025-08-06T10:59:51.487327Z", + "start_time": "2025-08-06T10:59:48.592743Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2751\n", + "[![](data:image/svg+xml...)![logo](data:image/gif;base64...)![logo](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2FnavLogo.a8764883.png&w=750&q=75)](/)\n", + "\n", + "Game platforms:\n", + "\n", + "* **All**\n", + "\n", + "* [Nintendo platform](/products/category/nintendo)\n", + "\n", + "+ wii\n", + "+ wii-u\n", + "+ nintendo-64\n", + "+ switch\n", + "+ gamecube\n", + "+ game-boy-advance\n", + "+ 3ds\n", + "+ ds\n", + "\n", + "* [Xbox platform](/products/category/xbox-platform)\n", + "\n", + "* **Dreamcast**\n", + "\n", + "* [Playstation platform](/products/category/playstation-platform)\n", + "\n", + "* **Pc**\n", + "\n", + "* **Stadia**\n", + "\n", + "Go Back\n", + "\n", + "Note!This is a sandbox website used for web scraping. Information listed in this website does not have any real meaning and should not be associated with the actual products.\n", + "\n", + "![The Legend of Zelda: Ocarina of Time](data:image/gif;base64...)![The Legend of Zelda: Ocarina of Time](/assets/action-adventure.svg)\n", + "\n", + "## The Legend of Zelda: Ocarina of Time\n", + "\n", + "**Developer:** Nintendo**Platform:****Type:** singleplayer\n", + "\n", + "As a young boy, Link is tricked by Ganondorf, the King of the Gerudo Thieves. The evil human uses Link to g\n", + "5542\n", + "[![](data:image/svg+xml...)![logo](data:image/gif;base64...)![logo](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2FnavLogo.a8764883.png&w=750&q=75)](/)\n", + "\n", + "Game platforms:\n", + "\n", + "* **All**\n", + "\n", + "* [Nintendo platform](/products/category/nintendo)\n", + "\n", + "+ wii\n", + "+ wii-u\n", + "+ nintendo-64\n", + "+ switch\n", + "+ gamecube\n", + "+ game-boy-advance\n", + "+ 3ds\n", + "+ ds\n", + "\n", + "* [Xbox platform](/products/category/xbox-platform)\n", + "\n", + "* **Dreamcast**\n", + "\n", + "* [Playstation platform](/products/category/playstation-platform)\n", + "\n", + "* **Pc**\n", + "\n", + "* **Stadia**\n", + "\n", + "Go Back\n", + "\n", + "Note!This is a sandbox website used for web scraping. Information listed in this website does not have any real meaning and should not be associated with the actual products.\n", + "\n", + "![Super Mario Galaxy](data:image/gif;base64...)![Super Mario Galaxy](/assets/action.svg)\n", + "\n", + "## Super Mario Galaxy\n", + "\n", + "**Developer:** Nintendo**Platform:****Type:** singleplayer\n", + "\n", + "[Metacritic's 2007 Wii Game of the Year] The ultimate Nintendo hero is taking the ultimate step ... out into space. Join Mario as he ushers in a new era of video games, de\n" + ] + } + ], + "source": [ + "for document in loader.load():\n", + " print(document.page_content[:1000])" + ] + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": "## Lazy Load" + }, + { + "metadata": {}, + "cell_type": "code", + "outputs": [], + "execution_count": null, + "source": [ + "for document in loader.lazy_load():\n", + " print(document.page_content[:1000])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Advanced examples\n", + "\n", + "The following examples show the usage of `OxylabsLoader` with geolocation, currency, pagination and user agent parameters for Amazon Search and Google Search sources." + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "ExecuteTime": { + "end_time": "2025-08-06T11:04:19.901122Z", + "start_time": "2025-08-06T11:04:19.838933Z" + } + }, + "outputs": [], + "source": [ + "loader = OxylabsLoader(\n", + " queries=[\"gaming headset\", \"gaming chair\", \"computer mouse\"],\n", + " params={\n", + " \"source\": \"amazon_search\",\n", + " \"parse\": True,\n", + " \"geo_location\": \"DE\",\n", + " \"currency\": \"EUR\",\n", + " \"pages\": 3,\n", + " },\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "ExecuteTime": { + "end_time": "2025-08-06T11:07:17.648142Z", + "start_time": "2025-08-06T11:07:17.595629Z" + } + }, + "outputs": [], + "source": [ + "loader = OxylabsLoader(\n", + " queries=[\"europe gdp per capita\", \"us gdp per capita\"],\n", + " params={\n", + " \"source\": \"google_search\",\n", + " \"parse\": True,\n", + " \"geo_location\": \"Paris, France\",\n", + " \"user_agent_type\": \"mobile\",\n", + " },\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## API reference\n", + "\n", + "[More information about this package.](https://github.com/oxylabs/langchain-oxylabs)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/docs/src/theme/FeatureTables.js b/docs/src/theme/FeatureTables.js index a8e579f56d3..fd2ea36638a 100644 --- a/docs/src/theme/FeatureTables.js +++ b/docs/src/theme/FeatureTables.js @@ -856,6 +856,13 @@ const FEATURE_TABLES = { source: "Web interaction and structured data extraction from any web page using an AgentQL query or a Natural Language prompt", api: "API", apiLink: "https://python.langchain.com/docs/integrations/document_loaders/agentql/" + }, + { + name: "Oxylabs", + link: "oxylabs", + source: "Web intelligence platform enabling the access to various data sources.", + api: "API", + apiLink: "https://github.com/oxylabs/langchain-oxylabs" } ] }, From fe740a939725ed17d3d99b77fde96da312f06ef1 Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Fri, 15 Aug 2025 10:47:22 -0400 Subject: [PATCH 8/8] fix(docs): `chatbot.ipynb` trimming regression (#32561) Supersedes #32544 Changes to the `trimmer` behavior resulted in the call `"What math problem was asked?"` to no longer see the relevant query due to the number of the queries' tokens. Adjusted to not trigger trimming the relevant part of the message history. Also, add print to the trimmer to increase observability on what is leaving the context window. Add note to trimming tut & format links as inline --- docs/docs/how_to/trim_messages.ipynb | 8 +++--- docs/docs/tutorials/chatbot.ipynb | 42 +++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/docs/docs/how_to/trim_messages.ipynb b/docs/docs/how_to/trim_messages.ipynb index db510d099bc..caaec79feef 100644 --- a/docs/docs/how_to/trim_messages.ipynb +++ b/docs/docs/how_to/trim_messages.ipynb @@ -53,7 +53,7 @@ "\n", "To keep the most recent messages, we set `strategy=\"last\"`. We'll also set `include_system=True` to include the `SystemMessage`, and `start_on=\"human\"` to make sure the resulting chat history is valid. \n", "\n", - "This is a good default configuration when using `trim_messages` based on token count. Remember to adjust `token_counter` and `max_tokens` for your use case.\n", + "This is a good default configuration when using `trim_messages` based on token count. Remember to adjust `token_counter` and `max_tokens` for your use case. Keep in mind that new queries added to the chat history will be included in the token count unless you trim prior to adding the new query.\n", "\n", "Notice that for our `token_counter` we can pass in a function (more on that below) or a language model (since language models have a message token counting method). It makes sense to pass in a model when you're trimming your messages to fit into the context window of that specific model:" ] @@ -525,7 +525,7 @@ "id": "4d91d390-e7f7-467b-ad87-d100411d7a21", "metadata": {}, "source": [ - "Looking at the LangSmith trace we can see that before the messages are passed to the model they are first trimmed: https://smith.langchain.com/public/65af12c4-c24d-4824-90f0-6547566e59bb/r\n", + "Looking at [the LangSmith trace](https://smith.langchain.com/public/65af12c4-c24d-4824-90f0-6547566e59bb/r) we can see that before the messages are passed to the model they are first trimmed.\n", "\n", "Looking at just the trimmer, we can see that it's a Runnable object that can be invoked like all Runnables:" ] @@ -620,7 +620,7 @@ "id": "556b7b4c-43cb-41de-94fc-1a41f4ec4d2e", "metadata": {}, "source": [ - "Looking at the LangSmith trace we can see that we retrieve all of our messages but before the messages are passed to the model they are trimmed to be just the system message and last human message: https://smith.langchain.com/public/17dd700b-9994-44ca-930c-116e00997315/r" + "Looking at [the LangSmith trace](https://smith.langchain.com/public/17dd700b-9994-44ca-930c-116e00997315/r) we can see that we retrieve all of our messages but before the messages are passed to the model they are trimmed to be just the system message and last human message." ] }, { @@ -630,7 +630,7 @@ "source": [ "## API reference\n", "\n", - "For a complete description of all arguments head to the API reference: https://python.langchain.com/api_reference/core/messages/langchain_core.messages.utils.trim_messages.html" + "For a complete description of all arguments head to the [API reference](https://python.langchain.com/api_reference/core/messages/langchain_core.messages.utils.trim_messages.html)." ] } ], diff --git a/docs/docs/tutorials/chatbot.ipynb b/docs/docs/tutorials/chatbot.ipynb index 193322d979e..0c78612553d 100644 --- a/docs/docs/tutorials/chatbot.ipynb +++ b/docs/docs/tutorials/chatbot.ipynb @@ -720,7 +720,7 @@ " AIMessage(content='yes!', additional_kwargs={}, response_metadata={})]" ] }, - "execution_count": 23, + "execution_count": 109, "metadata": {}, "output_type": "execute_result" } @@ -771,8 +771,13 @@ "\n", "\n", "def call_model(state: State):\n", + " print(f\"Messages before trimming: {len(state['messages'])}\")\n", " # highlight-start\n", " trimmed_messages = trimmer.invoke(state[\"messages\"])\n", + " print(f\"Messages after trimming: {len(trimmed_messages)}\")\n", + " print(\"Remaining messages:\")\n", + " for msg in trimmed_messages:\n", + " print(f\" {type(msg).__name__}: {msg.content}\")\n", " prompt = prompt_template.invoke(\n", " {\"messages\": trimmed_messages, \"language\": state[\"language\"]}\n", " )\n", @@ -792,7 +797,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now if we try asking the model our name, it won't know it since we trimmed that part of the chat history:" + "Now if we try asking the model our name, it won't know it since we trimmed that part of the chat history. (By defining our trim stragegy as `'last'`, we are only keeping the most recent messages that fit within the `max_tokens`.)" ] }, { @@ -804,9 +809,20 @@ "name": "stdout", "output_type": "stream", "text": [ + "Messages before trimming: 12\n", + "Messages after trimming: 8\n", + "Remaining messages:\n", + " SystemMessage: you're a good assistant\n", + " HumanMessage: whats 2 + 2\n", + " AIMessage: 4\n", + " HumanMessage: thanks\n", + " AIMessage: no problem!\n", + " HumanMessage: having fun?\n", + " AIMessage: yes!\n", + " HumanMessage: What is my name?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "I don't know your name. You haven't told me yet!\n" + "I don't know your name. If you'd like to share it, feel free!\n" ] } ], @@ -840,15 +856,27 @@ "name": "stdout", "output_type": "stream", "text": [ + "Messages before trimming: 12\n", + "Messages after trimming: 8\n", + "Remaining messages:\n", + " SystemMessage: you're a good assistant\n", + " HumanMessage: whats 2 + 2\n", + " AIMessage: 4\n", + " HumanMessage: thanks\n", + " AIMessage: no problem!\n", + " HumanMessage: having fun?\n", + " AIMessage: yes!\n", + " HumanMessage: What math problem was asked?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "You asked what 2 + 2 equals.\n" + "The math problem that was asked was \"what's 2 + 2.\"\n" ] } ], "source": [ "config = {\"configurable\": {\"thread_id\": \"abc678\"}}\n", - "query = \"What math problem did I ask?\"\n", + "\n", + "query = \"What math problem was asked?\"\n", "language = \"English\"\n", "\n", "input_messages = messages + [HumanMessage(query)]\n", @@ -890,9 +918,9 @@ "text": [ "|Hi| Todd|!| Here|’s| a| joke| for| you|:\n", "\n", - "|Why| don|’t| skeleton|s| fight| each| other|?\n", + "|Why| don't| scientists| trust| atoms|?\n", "\n", - "|Because| they| don|’t| have| the| guts|!||" + "|Because| they| make| up| everything|!||" ] } ],