Commit Graph

2148 Commits

Author SHA1 Message Date
William FH
4855964332
Fix OAI Tool Message (#14746)
See format here:
https://platform.openai.com/docs/guides/function-calling/parallel-function-calling


It expects a "name" argument, which we aren't providing by default.


![image](https://github.com/langchain-ai/langchain/assets/13333726/7cd82978-337c-40a1-b099-3bb25cd57eb4)


Alternative is to add the 'name' field directly to the message if people
prefer.
2023-12-15 06:45:09 -08:00
William FH
e3132a7efc
[Evals] End project (#14324)
Also does some cleanup.

Now that we support updating/ending projects, do this automatically.
Then you can edit the name of the project in the app.
2023-12-15 00:05:34 -08:00
William FH
93c7eb4e6b
[Tracing] String Stacktrace (#14131)
Add full stacktrace
2023-12-14 22:15:07 -08:00
Leonid Kuligin
7f42811e14
google-genai[patch], community[patch]: Added support for new Google GenerativeAI models (#14530)
Replace this entire comment with:
  - **Description:** added support for new Google GenerativeAI models
  - **Twitter handle:** lkuligin

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2023-12-14 20:56:46 -08:00
Bagatur
b802dd96f2
core[patch]: Release 0.1.1 (#14738) 2023-12-14 16:02:19 -08:00
William FH
9d4100f915
Revert "[Hub|tracing] Tag hub prompts" (#14735)
Reverts langchain-ai/langchain#14720
2023-12-14 14:39:58 -08:00
Erick Friis
9fb26a2a71
community[patch]: fix pgvector sqlalchemy (#14726)
Fixes #14699
2023-12-14 13:27:30 -08:00
Bagatur
1cec0afc62
google-genai[patch]: add google-genai integration deps and extras (#14731) 2023-12-14 13:20:10 -08:00
William FH
852b9ca494
[Hub|tracing] Tag hub prompts (#14720)
If you're using the hub, you'll likely be interested in tracking the
commit/object when tracing. This PR adds it to the config
2023-12-14 10:04:18 -08:00
William FH
451c5d1d8c
[Integration] NVIDIA AI Playground (#14648)
Description: Added NVIDIA AI Playground Initial support for a selection of models (Llama models, Mistral, etc.)

Dependencies: These models do depend on the AI Playground services in NVIDIA NGC. API keys with a significant amount of trial compute are available (10K queries as of the time of writing).

H/t to @VKudlay
2023-12-13 19:46:37 -08:00
William FH
1e21a3f7ed
[Partner] Gemini Embeddings (#14690)
Add support for Gemini embeddings in the langchain-google-genai package
2023-12-13 17:05:31 -08:00
Funkeke
ea99612caa
community[patch]: fix dashvector endpoint params error (#14484)
<!-- 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/langchain-ai/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. It lives in `docs/extras`
directory.

If no one reviews your PR within a few days, please @-mention one of
@baskaryan, @eyurtsev, @hwchase17.
 -->

Co-authored-by: fangkeke <3339698829@qq.com>
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2023-12-13 14:38:27 -08:00
Bob Lin
dce3c74905
community[patch]: Correct type annotation for azure_ad_token_provider Closed: #14402 (#14432)
Description
Fix https://github.com/langchain-ai/langchain/issues/14402, Similar
changes: https://github.com/langchain-ai/langchain/pull/14166

Twitter handle
[lin_bob57617](https://twitter.com/lin_bob57617)
2023-12-13 14:37:39 -08:00
Fran Cirka
8a4162d15e
community[patch]: Fixed issue with importing Row from sqlalchemy (#14488)
- **Description:** Fixed import of Row in cache.py, 
- **Issue:** the issue # #13464
https://creditone.us.to/langchain-ai/langchain/issues/13464,
  - **Dependencies:** None,
  - **Twitter handle:** @frankybridman

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2023-12-13 14:36:08 -08:00
Bagatur
47451951a1
core[patch]: Fix runnable with message history (#14629)
Fix bug shown in #14458. Namely, that saving inputs to history fails
when the input to base runnable is a list of messages
2023-12-13 14:25:35 -08:00
Bagatur
73382a579f
google-genai[patch]: Release 0.0.2 (#14677) 2023-12-13 12:59:19 -08:00
Nuno Campos
a16f4a318f
\Fix tool_calls message merge (#14613)
<!-- 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/langchain-ai/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. It lives in `docs/extras`
directory.

If no one reviews your PR within a few days, please @-mention one of
@baskaryan, @eyurtsev, @hwchase17.
 -->
2023-12-13 12:37:40 -08:00
William FH
405d111da6
[Partner] Add langchain-google-genai package (gemini) (#14621)
Add a new ChatGoogleGenerativeAI class in a `langchain-google-genai`
package.
Still todo: add a deprecation warning in PALM

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
Co-authored-by: Leonid Kuligin <lkuligin@yandex.ru>
Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-12-13 11:57:59 -08:00
Bagatur
4574749147
communty[patch]: Release 0.0.3 (#14673) 2023-12-13 11:21:00 -08:00
Erick Friis
c5250f12c2
cli[patch]: unicode issue (#14672)
Some operating systems compile template, resulting in unicode decode
errors
2023-12-13 11:14:51 -08:00
William FH
75b8891399
Update Vertex AI to include Gemini (#14670)
h/t to @lkuligin 
-  **Description:** added new models on VertexAI
  - **Twitter handle:** @lkuligin

---------

Co-authored-by: Leonid Kuligin <lkuligin@yandex.ru>
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2023-12-13 10:45:02 -08:00
Erick Friis
858f4cbce4
cli[patch]: rc (#14667) 2023-12-13 10:00:04 -08:00
Tomaz Bratanic
ea2616ae23
Fix RRF and lucene escape characters for neo4j vector store (#14646)
* Remove Lucene special characters (fixes
https://github.com/langchain-ai/langchain/issues/14232)
* Fixes RRF normalization for hybrid search
2023-12-13 09:09:50 -08:00
Erick Friis
7e6ca3c2b9
cli[patch]: integration template (#14571) 2023-12-13 08:55:30 -08:00
James Braza
b9ef92f2f4
Fixed DeprecationWarning for PromptTemplate.from_file module-level calls (#14468)
Resolves https://github.com/langchain-ai/langchain/issues/14467
2023-12-12 17:43:27 -08:00
Chengzu Ou
df95abb7e7
docs: Add Databricks Vector Search example notebook (#14158)
This PR adds an example notebook for the Databricks Vector Search vector
store. It also adds an introduction to the Databricks Vector Search
product on the Databricks's provider page.

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-12-12 17:40:29 -08:00
葛尧
e780433f6b
Fix token_usage None issue in ChatOpenAI with local Chatglm2-6B (#14493)
When using local Chatglm2-6B by changing OPENAI_BASE_URL to localhost,
the token_usage in ChatOpenAI becomes None. This leads to an
AttributeError when trying to access token_usage.items().

This commit adds a check to ensure token_usage is not None before
accessing its items. This change prevents the AttributeError and allows
ChatOpenAI to work seamlessly with a local Chatglm2-6B model, aligning
with the way it operates with the OpenAI API.

<!-- 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/langchain-ai/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. It lives in `docs/extras`
directory.

If no one reviews your PR within a few days, please @-mention one of
@baskaryan, @eyurtsev, @hwchase17.
 -->

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2023-12-12 17:30:37 -08:00
Massimiliano Pronesti
6080c98108
fix(embeddings): huggingface hub embeddings and TEI (#14489)
**Description:** This PR fixes `HuggingFaceHubEmbeddings` by making the
API token optional (as in the client beneath). Most models don't require
one. I also updated the notebook for TEI (text-embeddings-inference)
accordingly as requested here #14288. In addition, I fixed a mistake in
the POST call parameters.

**Tag maintainers:** @baskaryan
2023-12-12 17:21:52 -08:00
Thomas B
b4e3e47c92
feat: Yaml output parser (#14496)
## Description
New YAML output parser as a drop-in replacement for the Pydantic output
parser. Yaml is a much more token-efficient format than JSON, proving to
be **~35% faster and using the same percentage fewer completion
tokens**.

☑️ Formatted
☑️ Linted
☑️ Tested (analogous to the existing`test_pydantic_parser.py`)

The YAML parser excels in situations where a list of objects is
required, where the root object needs no key:
```python
class Products(BaseModel):
   __root__: list[Product]
```

I ran the prompt `Generate 10 healthy, organic products` 10 times on one
chain using the `PydanticOutputParser`, the other one using
the`YamlOutputParser` with `Products` (see below) being the targeted
model to be created.

LLMs used were Fireworks' `lama-v2-34b-code-instruct` and OpenAI
`gpt-3.5-turbo`. All runs succeeded without validation errors.

```python
class Nutrition(BaseModel):
    sugar: int = Field(description="Sugar in grams")
    fat: float = Field(description="% of daily fat intake")

class Product(BaseModel):
    name: str = Field(description="Product name")
    stats: Nutrition

class Products(BaseModel):
    """A list of products"""

    products: list[Product] # Used `__root__` for the yaml chain
```
Stats after 10 runs reach were as follows:
### JSON
ø time: 7.75s
ø tokens: 380.8

### YAML
ø time: 5.12s
ø tokens: 242.2


Looking forward to feedback, tips and contributions!
2023-12-12 17:04:31 -08:00
Bob Lin
a019183a01
create mypy cache dir if it doesn't exist (#14579)
### Description

When running `make lint` multiple times, i can see the error `mkdir:
.mypy_cache: File exists`. Use `mkdir -p` to solve this problem.
<img width="1512" alt="Screenshot 2023-12-12 at 11 22 01 AM"
src="https://github.com/langchain-ai/langchain/assets/10000925/1429383d-3283-4e22-8882-5693bc50b502">
2023-12-12 15:34:50 -08:00
dandanwei
e5bd88383f
fix a bug in RedisNum filter againt value 0 (#14587)
- **Description:** There is a bug in RedisNum filter that filter towards
value 0 will be parsed as "*". This is a fix to it.
  - **Issue:** NA
  - **Dependencies:** NA
  - **Tag maintainer:** NA
  - **Twitter handle:** NA
2023-12-12 15:34:45 -08:00
Lance Martin
282362382c
Minor update to ensemble retriever to handle a mix of Documents or str (#14552) 2023-12-12 15:16:49 -08:00
Bagatur
ca7da8f7ef
docs: fix links in readme (#14624) 2023-12-12 12:59:09 -08:00
Bagatur
2a10cabf66
docs: core and community readme (#14623) 2023-12-12 12:52:32 -08:00
Bagatur
b72b19b593
experimental[patch]: Release 0.0.47 (#14617) 2023-12-12 11:09:39 -08:00
Bagatur
57337b4862
langchain[patch]: Release 0.0.350 (#14612) 2023-12-12 10:10:34 -08:00
Bagatur
d388863a3b
community[patch]: Release 0.0.2 (#14610) 2023-12-12 09:58:04 -08:00
Bagatur
5d1deddbfb
core[minor]: Release 0.1.0 (#14607) 2023-12-12 09:33:11 -08:00
Harrison Chase
ad8d8f71aa
allow other namespaces (#14606) 2023-12-12 09:09:59 -08:00
Eugene Yurtsev
76905aa043
Update RunnableWithMessageHistory (#14351)
This PR updates RunnableWithMessage history to support user specific
configuration for the factory.

It extends support to passing multiple named arguments into the factory
if the factory takes more than a single argument.
2023-12-11 21:34:49 -05:00
Erick Friis
0a9d933bb2
infra: import checking bugfix (#14569) 2023-12-11 15:53:51 -08:00
Bagatur
8bdaf55e92
experimental[patch]: Release 0.0.46 (#14572) 2023-12-11 15:46:14 -08:00
Bagatur
14bfc5f9f4
langchain[patch]: Release 0.0.349 (#14570) 2023-12-11 15:30:14 -08:00
Erick Friis
482e2b94fa
infra: import CI speed (#14566)
Was taking 10 mins. Now a few seconds.
2023-12-11 15:19:21 -08:00
Bagatur
6a828e60ee
community[patch]: Release 0.0.1 (#14565) 2023-12-11 15:18:55 -08:00
Erick Friis
5418d8bfd6
infra: import CI fix (#14562)
TIL `**` globstar doesn't work in make

Makefile changes fix that.

`__getattr__` changes allow import of all files, but raise error when
accessing anything from the module.

file deletions were corresponding libs change from #14559
2023-12-11 14:59:10 -08:00
Bagatur
9cb128e6e2
core[patch]: Release 0.0.13 (#14558) 2023-12-11 14:36:28 -08:00
Bagatur
a844b495c4
community[patch]: Fix agenttoolkits imports (#14559) 2023-12-11 14:19:25 -08:00
Nuno Campos
3b5b0f16c6
Move runnable context to beta (#14507)
<!-- 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/langchain-ai/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. It lives in `docs/extras`
directory.

If no one reviews your PR within a few days, please @-mention one of
@baskaryan, @eyurtsev, @hwchase17.
 -->
2023-12-11 13:58:30 -08:00
Bagatur
ed58eeb9c5
community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463)
Moved the following modules to new package langchain-community in a backwards compatible fashion:

```
mv langchain/langchain/adapters community/langchain_community
mv langchain/langchain/callbacks community/langchain_community/callbacks
mv langchain/langchain/chat_loaders community/langchain_community
mv langchain/langchain/chat_models community/langchain_community
mv langchain/langchain/document_loaders community/langchain_community
mv langchain/langchain/docstore community/langchain_community
mv langchain/langchain/document_transformers community/langchain_community
mv langchain/langchain/embeddings community/langchain_community
mv langchain/langchain/graphs community/langchain_community
mv langchain/langchain/llms community/langchain_community
mv langchain/langchain/memory/chat_message_histories community/langchain_community
mv langchain/langchain/retrievers community/langchain_community
mv langchain/langchain/storage community/langchain_community
mv langchain/langchain/tools community/langchain_community
mv langchain/langchain/utilities community/langchain_community
mv langchain/langchain/vectorstores community/langchain_community
mv langchain/langchain/agents/agent_toolkits community/langchain_community
mv langchain/langchain/cache.py community/langchain_community
mv langchain/langchain/adapters community/langchain_community
mv langchain/langchain/callbacks community/langchain_community/callbacks
mv langchain/langchain/chat_loaders community/langchain_community
mv langchain/langchain/chat_models community/langchain_community
mv langchain/langchain/document_loaders community/langchain_community
mv langchain/langchain/docstore community/langchain_community
mv langchain/langchain/document_transformers community/langchain_community
mv langchain/langchain/embeddings community/langchain_community
mv langchain/langchain/graphs community/langchain_community
mv langchain/langchain/llms community/langchain_community
mv langchain/langchain/memory/chat_message_histories community/langchain_community
mv langchain/langchain/retrievers community/langchain_community
mv langchain/langchain/storage community/langchain_community
mv langchain/langchain/tools community/langchain_community
mv langchain/langchain/utilities community/langchain_community
mv langchain/langchain/vectorstores community/langchain_community
mv langchain/langchain/agents/agent_toolkits community/langchain_community
mv langchain/langchain/cache.py community/langchain_community
```

Moved the following to core
```
mv langchain/langchain/utils/json_schema.py core/langchain_core/utils
mv langchain/langchain/utils/html.py core/langchain_core/utils
mv langchain/langchain/utils/strings.py core/langchain_core/utils
cat langchain/langchain/utils/env.py >> core/langchain_core/utils/env.py
rm langchain/langchain/utils/env.py
```

See .scripts/community_split/script_integrations.sh for all changes
2023-12-11 13:53:30 -08:00