Commit Graph

136 Commits (17a06cb7a6126e88f9b7fcf7336a8ff473d94d25)

Author SHA1 Message Date
Bagatur 7d1694040d
core[patch]: Release 0.2.26 (#24898) 2 months ago
Bagatur 8461934c2b
core[patch], integrations[patch]: convert TypedDict to tool schema support (#24641)
supports following UX

```python
    class SubTool(TypedDict):
        """Subtool docstring"""

        args: Annotated[Dict[str, Any], {}, "this does bar"]

    class Tool(TypedDict):
        """Docstring
        Args:
            arg1: foo
        """

        arg1: str
        arg2: Union[int, str]
        arg3: Optional[List[SubTool]]
        arg4: Annotated[Literal["bar", "baz"], ..., "this does foo"]
        arg5: Annotated[Optional[float], None]
```

- can parse google style docstring
- can use Annotated to specify default value (second arg)
- can use Annotated to specify arg description (third arg)
- can have nested complex types
2 months ago
Erick Friis 88418af3f5
core: release 0.2.25 (#24833) 2 months ago
Bagatur 8964f8a710
core: use mypy<1.11 (#24749)
Bug in mypy 1.11.0 blocking CI, see example:
https://github.com/langchain-ai/langchain/actions/runs/10127096903/job/28004492692?pr=24641
2 months ago
Bagatur 315223ce26
core[patch]: Release 0.2.24 (#24722) 2 months ago
Bagatur 918e1c8a93
core[patch]: Release 0.2.23 (#24557) 2 months ago
Erick Friis 3dce2e1d35
all: add release notes to pypi (#24519) 2 months ago
Erick Friis ef049769f0
core[patch]: Release 0.2.22 (#24423)
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2 months ago
Bagatur a4c101ae97
core[patch]: Release 0.2.21 (#24372) 2 months ago
Bagatur 80e7cd6cff
core[patch]: Release 0.2.20 (#24322) 2 months ago
Bagatur 620b118c70
core[patch]: Release 0.2.19 (#24272) 2 months ago
Bagatur 5c3e2612da
core[patch]: Release 0.2.18 (#24230) 2 months ago
Bagatur 0a1e475a30
core[patch]: Release 0.2.17 (#24189) 2 months ago
Erick Friis 1132fb801b
core: release 0.2.16 (#24159) 2 months ago
Bagatur eeb996034b
core[patch]: Release 0.2.15 (#24149) 2 months ago
Erick Friis c4417ea93c
core: release 0.2.14, remove poetry 1.7 incompatible flag from root (#24137) 2 months ago
Erick Friis 6ea6f9f7bc
core: release 0.2.13 (#24096) 2 months ago
Bagatur 6928f4c438
core[minor]: Add ToolMessage.raw_output (#23994)
Decisions to discuss:
1.  is a new attr needed or could additional_kwargs be used for this
2. is raw_output a good name for this attr
3. should raw_output default to {} or None
4. should raw_output be included in serialization
5. do we need to update repr/str to  exclude raw_output
2 months ago
Erick Friis bedd893cd1
core: release 0.2.12 (#23991) 2 months ago
Eugene Yurtsev f765e8fa9d
core[minor],community[patch],standard-tests[patch]: Move InMemoryImplementation to langchain-core (#23986)
This PR moves the in memory implementation to langchain-core.

* The implementation remains importable from langchain-community.
* Supporting utilities are marked as private for now.
2 months ago
Bagatur a0c2281540
infra: update mypy 1.10, ruff 0.5 (#23721)
```python
"""python scripts/update_mypy_ruff.py"""
import glob
import tomllib
from pathlib import Path

import toml
import subprocess
import re

ROOT_DIR = Path(__file__).parents[1]


def main():
    for path in glob.glob(str(ROOT_DIR / "libs/**/pyproject.toml"), recursive=True):
        print(path)
        with open(path, "rb") as f:
            pyproject = tomllib.load(f)
        try:
            pyproject["tool"]["poetry"]["group"]["typing"]["dependencies"]["mypy"] = (
                "^1.10"
            )
            pyproject["tool"]["poetry"]["group"]["lint"]["dependencies"]["ruff"] = (
                "^0.5"
            )
        except KeyError:
            continue
        with open(path, "w") as f:
            toml.dump(pyproject, f)
        cwd = "/".join(path.split("/")[:-1])
        completed = subprocess.run(
            "poetry lock --no-update; poetry install --with typing; poetry run mypy . --no-color",
            cwd=cwd,
            shell=True,
            capture_output=True,
            text=True,
        )
        logs = completed.stdout.split("\n")

        to_ignore = {}
        for l in logs:
            if re.match("^(.*)\:(\d+)\: error:.*\[(.*)\]", l):
                path, line_no, error_type = re.match(
                    "^(.*)\:(\d+)\: error:.*\[(.*)\]", l
                ).groups()
                if (path, line_no) in to_ignore:
                    to_ignore[(path, line_no)].append(error_type)
                else:
                    to_ignore[(path, line_no)] = [error_type]
        print(len(to_ignore))
        for (error_path, line_no), error_types in to_ignore.items():
            all_errors = ", ".join(error_types)
            full_path = f"{cwd}/{error_path}"
            try:
                with open(full_path, "r") as f:
                    file_lines = f.readlines()
            except FileNotFoundError:
                continue
            file_lines[int(line_no) - 1] = (
                file_lines[int(line_no) - 1][:-1] + f"  # type: ignore[{all_errors}]\n"
            )
            with open(full_path, "w") as f:
                f.write("".join(file_lines))

        subprocess.run(
            "poetry run ruff format .; poetry run ruff --select I --fix .",
            cwd=cwd,
            shell=True,
            capture_output=True,
            text=True,
        )


if __name__ == "__main__":
    main()

```
3 months ago
Bagatur 7a3d8e5a99
core[patch]: Release 0.2.11 (#23780) 3 months ago
ccurme 86ca44d451
core: release 0.2.10 (#23420) 3 months ago
Bagatur 093ae04d58
core[patch]: Pin pydantic in py3.12.4 (#23130) 3 months ago
Bagatur 01783d67fc
core[patch]: Release 0.2.9 (#23091) 3 months ago
Takuya Igei 9f791b6ad5
core[patch],community[patch],langchain[patch]: `tenacity` dependency to version `>=8.1.0,<8.4.0` (#22973)
Fix https://github.com/langchain-ai/langchain/issues/22972.

- [x] **PR title**: "package: description"
- Where "package" is whichever of langchain, community, core,
experimental, etc. is being modified. Use "docs: ..." for purely docs
changes, "templates: ..." for template changes, "infra: ..." for CI
changes.
  - Example: "community: add foobar LLM"


- [x] **PR message**: ***Delete this entire checklist*** and replace
with
    - **Description:** a description of the change
    - **Issue:** the issue # it fixes, if applicable
    - **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, please
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. See contribution
guidelines for more: https://python.langchain.com/docs/contributing/

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.
- If you are adding something to community, do not re-import it in
langchain.

If no one reviews your PR within a few days, please @-mention one of
baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17.
3 months ago
Bagatur 8235bae48e
core[patch]: Release 0.2.8 (#23012) 3 months ago
Erick Friis 9ef15691d6
core: release 0.2.7 (#22917) 3 months ago
Erick Friis 7234fd0f51
core: release 0.2.6 (#22868) 3 months ago
James Braza 45b394268c
core[patch]: allowing latest `packaging` versions (#22792)
Allowing version 24 of https://github.com/pypa/packaging

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
3 months ago
Christophe Bornet d04e899b56
ci: add testing with Python 3.12 (#22813)
We need to use a different version of numpy for py3.8 and py3.12 in
pyproject.
And so do projects that use that Python version range and import
langchain.

    - **Twitter handle:** _cbornet
3 months ago
William FH be79ce9336
[Core] Unified Enable/Disable Tracing (#22576) 4 months ago
Erick Friis a24a9c6427
multiple: get rid of pyproject extras (#22581)
They cause `poetry lock` to take a ton of time, and `uv pip install` can
resolve the constraints from these toml files in trivial time
(addressing problem with #19153)

This allows us to properly upgrade lockfile dependencies moving forward,
which revealed some issues that were either fixed or type-ignored (see
file comments)
4 months ago
Bagatur 4367e89c9a
core[patch]: Release 0.2.5 (#22642) 4 months ago
Bagatur 161b02a8be
core[patch]: Release 0.2.4 (#22489) 4 months ago
ccurme 6db25b4e31
core[patch]: bump langsmith (#22476)
Noticing errors logged in some situations when tracing with Langsmith:
```python
from langchain_core.pydantic_v1 import BaseModel
from langchain_anthropic import ChatAnthropic


class AnswerWithJustification(BaseModel):
    """An answer to the user question along with justification for the answer."""
    answer: str
    justification: str


llm = ChatAnthropic(model="claude-3-haiku-20240307")
structured_llm = llm.with_structured_output(AnswerWithJustification)

list(structured_llm.stream("What weighs more a pound of bricks or a pound of feathers"))
```
```
Error in LangChainTracer.on_chain_end callback: AttributeError("'NoneType' object has no attribute 'append'")
[AnswerWithJustification(answer='A pound of bricks and a pound of feathers weigh the same amount.', justification='This is because a pound is a unit of mass, not volume. By definition, a pound of any material, whether bricks or feathers, will weigh the same - one pound. The physical size or volume of the materials does not matter when measuring by mass. So a pound of bricks and a pound of feathers both weigh exactly one pound.')]
```
4 months ago
Bagatur 2b9f1469d8
core[patch]: Release 0.2.3 (#22329) 4 months ago
William FH dcec133b85
[Core] Update Tracing Interops (#22318)
LangSmith and LangChain context var handling evolved in parallel since
originally we didn't expect people to want to interweave the decorator
and langchain code.

Once we get a new langsmith release, this PR will let you seemlessly
hand off between @traceable context and runnable config context so you
can arbitrarily nest code.

It's expected that this fails right now until we get another release of
the SDK
4 months ago
ccurme e71b0b5827
core[patch]: Release 0.2.2 (#22289) 4 months ago
ccurme cd07521170
core: bump to 0.2.1rc (#22080) 4 months ago
Bagatur 3b0437c05b
core[patch]: Release 0.2.1 (#22003) 4 months ago
Erick Friis 23310626b3
core: release 0.2.0 (#21829) 4 months ago
Eugene Yurtsev e69a9bedf8
core[patch]: Update mypy config (#21684)
Update mypy config to ignore checking deps from numpy and pytest (which are optional in langsmith sdk)
4 months ago
Erick Friis c77d2f2b06
multiple: core 0.2 nonbreaking dep, check_diff community->langchain dep (#21646)
0.2 is not a breaking release for core (but it is for langchain and
community)

To keep the core+langchain+community packages in sync at 0.2, we will
relax deps throughout the ecosystem to tolerate `langchain-core` 0.2
4 months ago
Erick Friis 0fb93cd740
core: release 0.1.52 (#21350) 5 months ago
Erick Friis 811e9cee8b
core: release 0.1.51 (#21328) 5 months ago
Erick Friis c1eb95b967
core: release 0.1.50 (#21230) 5 months ago
Bagatur d297d90ad9
core[patch]: Release 0.1.49 (#21211) 5 months ago
Erick Friis 2407c353be
core: release 0.1.48 (#21113) 5 months ago
Erick Friis 748f2ba9ea
core: release 0.1.47 (#21094) 5 months ago