Commit Graph

11418 Commits

Author SHA1 Message Date
Bagatur
d072d592a1 Update libs/partners/openai/langchain_openai/embeddings/azure.py 2024-09-03 23:35:35 -07:00
Bagatur
78c454c130 Update libs/partners/openai/langchain_openai/chat_models/base.py 2024-09-03 23:35:30 -07:00
Bagatur
5199555c0d Update libs/partners/openai/langchain_openai/chat_models/base.py 2024-09-03 23:35:26 -07:00
Bagatur
5e31cd91a7 Update libs/partners/openai/langchain_openai/chat_models/azure.py 2024-09-03 23:35:21 -07:00
Bagatur
49a1f5dd47 Update libs/partners/openai/langchain_openai/chat_models/azure.py 2024-09-03 23:35:15 -07:00
Bagatur
d0cc9b022a Update libs/partners/fireworks/langchain_fireworks/chat_models.py 2024-09-03 23:30:56 -07:00
Bagatur
a91bd2737a Update libs/partners/fireworks/langchain_fireworks/chat_models.py 2024-09-03 23:30:49 -07:00
Bagatur
5ad2b8ce80 Merge branch 'v0.3rc' into bagatur/fireworks_0.3 2024-09-03 23:29:07 -07:00
Bagatur
b78764599b Merge branch 'v0.3rc' into bagatur/openai_attempt_2 2024-09-03 23:28:50 -07:00
Bagatur
2888e34f53 infra: remove pydantic v1 tests (#26006) 2024-09-03 23:27:52 -07:00
Bagatur
dd4418a503 rm requires 2024-09-03 23:26:13 -07:00
Bagatur
a976f2071b Merge branch 'v0.3rc' into bagatur/rm_pydantic_v1_ci 2024-09-03 19:06:22 -07:00
Eugene Yurtsev
5f98975be0 core[patch]: Fix injected args in tool signature (#25991)
- Fix injected args in tool signature
- Fix another unit test that was using the wrong namespace import in
pydantic
2024-09-03 21:53:50 -04:00
Bagatur
0529c991ce rm 2024-09-03 18:02:12 -07:00
Bagatur
954abcce59 infra: remove pydantic v1 tests 2024-09-03 18:01:34 -07:00
Bagatur
6ad515d34e Merge branch 'v0.3rc' into bagatur/fireworks_0.3 2024-09-03 17:51:46 -07:00
Bagatur
99348e1614 Merge branch 'v0.3rc' into bagatur/openai_attempt_2 2024-09-03 17:51:27 -07:00
Bagatur
2c742cc20d standard-tests[major]: use pydantic v2 (#26005) 2024-09-03 17:50:45 -07:00
Bagatur
02f87203f7 standard-tests[major]: use pydantic v2 2024-09-03 17:48:20 -07:00
Bagatur
56163481dd fmt 2024-09-03 17:46:41 -07:00
Bagatur
6aac2eeab5 fmt 2024-09-03 17:42:22 -07:00
Bagatur
559d8a4d13 fireworks[major]: switch to pydantic v2 2024-09-03 17:41:28 -07:00
Bagatur
34fc00aff1 openai[patch]: add back azure embeddings api_version alias (#26003) 2024-09-03 17:27:10 -07:00
Bagatur
4b99426a4f openai[patch]: add back azure embeddings api_version alias 2024-09-03 17:25:03 -07:00
Bagatur
ec9e8eb71c fmt 2024-09-03 17:24:24 -07:00
Bagatur
9399df7777 fmt 2024-09-03 16:57:42 -07:00
Bagatur
5fc1104d00 fmt 2024-09-03 16:51:14 -07:00
Bagatur
6777106fbe fmt 2024-09-03 16:50:17 -07:00
Bagatur
5f5287c3b0 fmt 2024-09-03 16:48:53 -07:00
Bagatur
615f8b0d47 openai[major]: switch to pydantic v2 2024-09-03 16:33:35 -07:00
Bagatur
9a9ab65030 merge master correctly (#25999) 2024-09-03 14:57:29 -07:00
Bagatur
241b6d2355 Revert "merge master (#25997)" (#25998) 2024-09-03 14:55:28 -07:00
Bagatur
91e09ffee5 merge master (#25997)
Co-authored-by: Dan O'Donovan <dan.odonovan@gmail.com>
Co-authored-by: Tom Daniel Grande <tomdgrande@gmail.com>
Co-authored-by: Grande <Tom.Daniel.Grande@statsbygg.no>
Co-authored-by: Erick Friis <erick@langchain.dev>
Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
2024-09-03 14:51:26 -07:00
Eugene Yurtsev
8e4bae351e core[major]: Drop python 3.8 support (#25996)
Drop python 3.8 support as EOL is 2024 October
2024-09-03 14:47:27 -07:00
Eugene Yurtsev
bc3b851f08 openai[patch]: Upgrade @root_validators in preparation for pydantic 2 migration (#25491)
* Upgrade @root_validator in openai pkg
* Ran notebooks for all but AzureAI embeddings

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
2024-09-03 14:42:24 -07:00
Erick Friis
0da201c1d5 core: fix lint 0.3rc (#25993) 2024-09-03 17:13:52 -04:00
Erick Friis
29413a22e1 infra: also run lint/test on rc (#25992) 2024-09-03 14:02:49 -07:00
Eugene Yurtsev
ae5a574aa5 core[major]: Upgrade langchain-core to pydantic 2 (#25986)
This PR upgrades core to pydantic 2.

It involves a combination of manual changes together with automated code
mods using gritql.

Changes and known issues:

1. Current models override __repr__ to be consistent with pydantic 1
(this will be removed in a follow up PR)
Related:
https://github.com/langchain-ai/langchain/pull/25986/files#diff-e5bd296179b7a72fcd4ea5cfa28b145beaf787da057e6d122aa76ee0bb8132c9R74
2. Issue with decorator for BaseChatModel
(https://github.com/langchain-ai/langchain/pull/25986/files#diff-932bf3b314b268754ef640a5b8f52da96f9024fb81dd388dcd166b5713ecdf66R202)
-- cc @baskaryan
3. `name` attribute in Base Runnable does not have a default -- was
raising a pydantic warning due to override. We need to see if there's a
way to fix to avoid making a breaking change for folks with custom
runnables.
(https://github.com/langchain-ai/langchain/pull/25986/files#diff-836773d27f8565f4dd45e9d6cf828920f89991a880c098b7511e0d3bb78a8a0dR238)
4. Likely can remove hard-coded RunnableBranch name
(https://github.com/langchain-ai/langchain/pull/25986/files#diff-72894b94f70b1bfc908eb4d53f5ff90bb33bf8a4240a5e34cae48ddc62ac313aR147)
5. `model_*` namespace is reserved in pydantic. We'll need to specify
`protected_namespaces`
6. create_model does not have a cached path yet
7. get_input_schema() in many places has been updated to be explicit
about whether parameters are required or optional
8. injected tool args aren't picked up properly (losing type annotation)

For posterity the following gritql migrations were used:

```
engine marzano(0.1)
language python

or {
    `from $IMPORT import $...` where {
        $IMPORT <: contains `pydantic_v1`,
        $IMPORT => `pydantic`
    },
    `$X.update_forward_refs` => `$X.model_rebuild`,
  // This pattern still needs fixing as it fails (populate_by_name vs.
  // allow_populate_by_name)
  class_definition($name, $body) as $C where {
      $name <: `Config`,
      $body <: block($statements),
      $t = "",
      $statements <: some bubble($t) assignment(left=$x, right=$y) as $A where {    
        or {
            $x <: `allow_population_by_field_name` where {
                $t += `populate_by_name=$y,`
            },
            $t += `$x=$y,`
        }
      },
      $C => `model_config = ConfigDict($t)`,
      add_import(source="pydantic", name="ConfigDict")
  }
}

```



```
engine marzano(0.1)
language python

`@root_validator(pre=True)` as $decorator where {
    $decorator <: before function_definition($body, $return_type),
    $decorator => `@model_validator(mode="before")\n@classmethod`,
    add_import(source="pydantic", name="model_validator"),
    $return_type => `Any`
}
```

```
engine marzano(0.1)
language python

`@root_validator(pre=False, skip_on_failure=True)` as $decorator where {
    $decorator <: before function_definition($body, $parameters, $return_type) where {
        $body <: contains bubble or {
            `values["$Q"]` => `self.$Q`,
            `values.get("$Q")` => `(self.$Q or None)`,
            `values.get($Q, $...)` as $V where {
                $Q <: contains `"$QName"`,
                $V => `self.$QName`,
            },
            `return $Q` => `return self`
        }
    },
    $decorator => `@model_validator(mode="after")`,
    // Silly work around a bug in grit
    // Adding Self to pydantic and then will replace it with one from typing
    add_import(source="pydantic", name="model_validator"),
    $parameters => `self`,
    $return_type => `Self`
}

```

```
grit apply --language python '`Self` where { add_import(source="typing_extensions", name="Self")}'
```
2024-09-03 16:30:44 -04:00
Tom Daniel Grande
0207dc1431 community: delta in openai choice can be None, creates handler for that (#25954)
Thank you for contributing to LangChain!

- [X ] **PR title**

- [X ] **PR message**: 

     **Description:** adds a handler for when delta choice is None

     **Issue:** Fixes #25951
     **Dependencies:** Not applicable


- [ X] **Add tests and docs**: Not applicable

- [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.

Co-authored-by: Grande <Tom.Daniel.Grande@statsbygg.no>
Co-authored-by: Erick Friis <erick@langchain.dev>
langchain-experimental==0.0.65
2024-09-03 20:30:03 +00:00
Erick Friis
5a0e82c31c infra: fix 0.3rc ci check (#25988) 2024-09-03 12:20:08 -07:00
Bagatur
9eb9ff52c0 experimental[patch]: Release 0.0.65 (#25987) 2024-09-03 19:15:48 +00:00
Bagatur
bc3b02651c standard-tests[patch]: test init from env vars (#25983) 2024-09-03 19:05:39 +00:00
Bagatur
ac922105ad infra: rm ai21 from CI (#25984) 2024-09-03 11:47:27 -07:00
Bagatur
0af447c90b community[patch]: Release 0.2.16 (#25982) langchain-community==0.2.16 2024-09-03 18:34:18 +00:00
Dan O'Donovan
f49da71e87 community[patch]: change default Neo4j username/password (#25226)
**Description:**

Change the default Neo4j username/password (when not supplied as
environment variable or in code) from `None` to `""`.

Neo4j has an option to [disable
auth](https://neo4j.com/docs/operations-manual/current/configuration/configuration-settings/#config_dbms.security.auth_enabled)
which is helpful when developing. When auth is disabled, the username /
password through the `neo4j` module should be `""` (ie an empty string).

Empty strings get marked as false in
`langchain_core.utils.env.get_from_dict_or_env` -- changing this code /
behaviour would have a wide impact and is undesirable.

In order to both _allow_ access to Neo4j with auth disabled and _not_
impact `langchain_core` this patch is presented. The downside would be
that if a user forgets to set NEO4J_USERNAME or NEO4J_PASSWORD they
would see an invalid credentials error rather than missing credentials
error. This could be mitigated but would result in a less elegant patch!

**Issue:**
Fix issue where langchain cannot communicate with Neo4j if Neo4j auth is
disabled.
2024-09-03 11:24:18 -07:00
Bagatur
035d8cf51b milvus[patch]: Release 0.1.5 (#25981) 2024-09-03 18:19:51 +00:00
Bagatur
1dfc8c01af langchain[patch]: Release 0.2.16 (#25977) langchain-text-splitters==0.2.4 langchain==0.2.16 2024-09-03 18:10:21 +00:00
Bagatur
fb642e1e27 text-splitters[patch]: Release 0.2.4 (#25979) 2024-09-03 18:09:43 +00:00
Erick Friis
8590b421c4 infra: ignore core dependents for 0.3rc (#25980) 2024-09-03 11:06:45 -07:00
Bagatur
7457949619 mistralai[patch]: Release 0.1.13 (#25978) langchain-mistralai==0.1.13 2024-09-03 18:03:15 +00:00