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()
```
2024-07-03 10:33:27 -07:00
Michael Schock
63a07f52df
experimental[patch]: remove \n from AutoGPT feedback_tool exit check ( #20132 )
2024-04-25 20:10:33 +00:00
ccurme
c010ec8b71
patch: deprecate (a)get_relevant_documents ( #20477 )
...
- `.get_relevant_documents(query)` -> `.invoke(query)`
- `.get_relevant_documents(query=query)` -> `.invoke(query)`
- `.get_relevant_documents(query, callbacks=callbacks)` ->
`.invoke(query, config={"callbacks": callbacks})`
- `.get_relevant_documents(query, **kwargs)` -> `.invoke(query,
**kwargs)`
---------
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-22 11:14:53 -04:00
Leonid Ganeline
95dc90609e
experimental[patch]: prompts
import fix ( #20534 )
...
Replaced `from langchain.prompts` with `from langchain_core.prompts`
where it is appropriate.
Most of the changes go to `langchain_experimental`
Similar to #20348
2024-04-18 16:09:11 -04:00
Leonid Ganeline
3f6bf852ea
experimental: docstrings update ( #18048 )
...
Added missed docstrings. Formatted docsctrings to the consistent format.
2024-02-23 21:24:16 -05:00
Erick Friis
ed789be8f4
docs, templates: update schema imports to core ( #17885 )
...
- chat models, messages
- documents
- agentaction/finish
- baseretriever,document
- stroutputparser
- more messages
- basemessage
- format_document
- baseoutputparser
---------
Co-authored-by: Bagatur <baskaryan@gmail.com>
2024-02-22 15:58:44 -08:00
Erick Friis
3a2eb6e12b
infra: add print rule to ruff ( #16221 )
...
Added noqa for existing prints. Can slowly remove / will prevent more
being intro'd
2024-02-09 16:13:30 -08:00
Leonid Ganeline
563f325034
experimental[patch]: fixed import in experimental
( #17078 )
2024-02-05 17:47:13 -08:00
Bagatur
bccb07f93e
core[patch]: simple prompt pretty printing ( #15968 )
2024-01-12 21:08:51 -05:00
Bagatur
1678d6ca17
langchain[patch], experimental[patch], docs: update tools imports ( #15433 )
2024-01-02 18:23:34 -05:00
Bagatur
480626dc99
docs, community[patch], experimental[patch], langchain[patch], cli[pa… ( #15412 )
...
…tch]: import models from community
ran
```bash
git grep -l 'from langchain\.chat_models' | xargs -L 1 sed -i '' "s/from\ langchain\.chat_models/from\ langchain_community.chat_models/g"
git grep -l 'from langchain\.llms' | xargs -L 1 sed -i '' "s/from\ langchain\.llms/from\ langchain_community.llms/g"
git grep -l 'from langchain\.embeddings' | xargs -L 1 sed -i '' "s/from\ langchain\.embeddings/from\ langchain_community.embeddings/g"
git checkout master libs/langchain/tests/unit_tests/llms
git checkout master libs/langchain/tests/unit_tests/chat_models
git checkout master libs/langchain/tests/unit_tests/embeddings/test_imports.py
make format
cd libs/langchain; make format
cd ../experimental; make format
cd ../core; make format
```
2024-01-02 15:32:16 -05:00
Bagatur
8e0d5813c2
langchain[patch], experimental[patch]: replace langchain.schema imports ( #15410 )
...
Import from core instead.
Ran:
```bash
git grep -l 'from langchain.schema\.output_parser' | xargs -L 1 sed -i '' "s/from\ langchain\.schema\.output_parser/from\ langchain_core.output_parsers/g"
git grep -l 'from langchain.schema\.messages' | xargs -L 1 sed -i '' "s/from\ langchain\.schema\.messages/from\ langchain_core.messages/g"
git grep -l 'from langchain.schema\.document' | xargs -L 1 sed -i '' "s/from\ langchain\.schema\.document/from\ langchain_core.documents/g"
git grep -l 'from langchain.schema\.runnable' | xargs -L 1 sed -i '' "s/from\ langchain\.schema\.runnable/from\ langchain_core.runnables/g"
git grep -l 'from langchain.schema\.vectorstore' | xargs -L 1 sed -i '' "s/from\ langchain\.schema\.vectorstore/from\ langchain_core.vectorstores/g"
git grep -l 'from langchain.schema\.language_model' | xargs -L 1 sed -i '' "s/from\ langchain\.schema\.language_model/from\ langchain_core.language_models/g"
git grep -l 'from langchain.schema\.embeddings' | xargs -L 1 sed -i '' "s/from\ langchain\.schema\.embeddings/from\ langchain_core.embeddings/g"
git grep -l 'from langchain.schema\.storage' | xargs -L 1 sed -i '' "s/from\ langchain\.schema\.storage/from\ langchain_core.stores/g"
git checkout master libs/langchain/tests/unit_tests/schema/
make format
cd libs/experimental
make format
cd ../langchain
make format
```
2024-01-02 15:09:45 -05:00
James Braza
24385a00de
core[minor], langchain[patch], experimental[patch]: Added missing py.typed
to langchain_core
( #14143 )
...
See PR title.
From what I can see, `poetry` will auto-include this. Please let me know
if I am missing something here.
---------
Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-12-01 19:15:23 -08:00
Predrag Gruevski
7c0f1bf23f
Upgrade experimental package dependencies and use Poetry 1.6.1. ( #11339 )
...
Part of upgrading our CI to use Poetry 1.6.1.
2023-10-16 21:13:31 -04:00
Harrison Chase
5f13668fa0
Harrison/move vectorstore base ( #11030 )
2023-09-25 12:44:23 -07:00
Nuno Campos
c0d67420e5
Use a submodule for pydantic v1 compat ( #9371 )
...
<!-- Thank you for contributing to LangChain!
Replace this entire comment with:
- Description: a description of the change,
- Issue: the issue # it fixes (if applicable),
- Dependencies: any dependencies required for this change,
- Tag maintainer: for a quicker response, tag the relevant maintainer
(see below),
- Twitter handle: we announce bigger features on Twitter. If your PR
gets announced and you'd like a mention, we'll gladly shout you out!
Please make sure your PR is passing linting and testing before
submitting. Run `make format`, `make lint` and `make test` to check this
locally.
See contribution guidelines for more information on how to write/run
tests, lint, etc:
https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
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. These live is docs/extras
directory.
If no one reviews your PR within a few days, please @-mention one of
@baskaryan, @eyurtsev, @hwchase17, @rlancemartin.
-->
2023-08-17 16:35:49 +01:00
Eugene Yurtsev
2673b3a314
Create pydantic v1 namespace in langchain ( #9254 )
...
Create pydantic v1 namespace in langchain experimental
2023-08-16 21:19:31 -07:00
Harrison Chase
3a78450883
update experimental ( #8402 )
...
some changes were made to experimental, porting them over
2023-07-28 13:01:36 -07:00
Leonid Ganeline
ee6ff96e28
docstrings cleanup ( #8311 )
...
- added missed docstrings
- changed docstrings into consistent format
@baskaryan
2023-07-26 14:13:10 -07:00
Leonid Ganeline
c580c81cca
docstrings experimental
( #7969 )
...
- added/changed docstring for `experimental`
- added/changed docstrings for different artifacts
-
@baskaryan
2023-07-24 14:21:48 -07:00
Harrison Chase
aa0e69bc98
Harrison/official pre release ( #8106 )
2023-07-21 18:44:32 -07:00
Harrison Chase
d353d668e4
remove CVEs ( #8092 )
...
This PR aims to move all code with CVEs into `langchain.experimental`.
Note that we are NOT yet removing from the core `langchain` package - we
will give people a week to migrate here.
See MIGRATE.md for how to migrate
Zero changes to functionality
Vulnerabilities this addresses:
PALChain:
- https://security.snyk.io/vuln/SNYK-PYTHON-LANGCHAIN-5752409
- https://security.snyk.io/vuln/SNYK-PYTHON-LANGCHAIN-5759265
SQLDatabaseChain
- https://security.snyk.io/vuln/SNYK-PYTHON-LANGCHAIN-5759268
`load_prompt` (Python files only)
- https://security.snyk.io/vuln/SNYK-PYTHON-LANGCHAIN-5725807
2023-07-21 13:32:39 -07:00
Harrison Chase
da04760de1
Harrison/move experimental ( #8084 )
2023-07-21 10:36:28 -07:00