Commit Graph

8769 Commits

Author SHA1 Message Date
Shuqian
ad9750403b
community[minor]: add bedrock anthropic callback for token usage counting (#19864)
**Description:** add bedrock anthropic callback for token usage
counting, consulted openai callback.

---------

Co-authored-by: Massimiliano Pronesti <massimiliano.pronesti@gmail.com>
2024-04-09 09:18:48 -05:00
Prince Canuma
1f9f4d8742
community[minor]: Add support for MLX models (chat & llm) (#18152)
**Description:** This PR adds support for MLX models both chat (i.e.,
instruct) and llm (i.e., pretrained) types/
**Dependencies:** mlx, mlx_lm, transformers
**Twitter handle:** @Prince_Canuma

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2024-04-09 14:17:07 +00:00
aditya thomas
6baeaf4802
docs: TogetherAI as a drop-in replacement for OpenAI (#19900)
**Description:** TogetherAI as a drop-in replacement for OpenAI
**Issue:** None
**Dependencies:** None

@baskaryan apropos #20032
2024-04-09 09:12:52 -05:00
Leonid Ganeline
2f8dd1a161
community[patch]: cross_encoders flatten namespaces (#20183)
Issue `langchain_community.cross_encoders` didn't have flattening
namespace code in the __init__.py file.
Changes:
- added code to flattening namespaces (used #20050 as a template)
- added ut for a change
- added missed `test_imports` for `chat_loaders` and
`chat_message_histories` modules
2024-04-08 20:50:23 -04:00
Bagatur
1af7133828
docs: add vertexai to structured output (#20171) 2024-04-08 16:09:49 -05:00
kaijietti
a812839f0c
community: add request_timeout and max_retries to ChatAnthropic (#19402)
This PR make `request_timeout` and `max_retries` configurable for
ChatAnthropic.

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-08 21:04:17 +00:00
Richmond Alake
c769421aa4
cookbook: MongoDB Cookbook for Chat history and semantic cache (#19998)
Thank you for contributing to LangChain!

- [ ] **PR title**: "community: Add semantic caching and memory using
MongoDB"


- [ ] **PR message**: 
- **Description:** This PR introduces functionality for adding semantic
caching and chat message history using MongoDB in RAG applications. By
leveraging the MongoDBCache and MongoDBChatMessageHistory classes,
developers can now enhance their retrieval-augmented generation
applications with efficient semantic caching mechanisms and persistent
conversation histories, improving response times and consistency across
chat sessions.
    - **Issue:** N/A
- **Dependencies:** Requires `datasets`, `langchain`,
`langchain-mongodb`, `langchain-openai`, `pymongo`, and `pandas` for
implementation. MongoDB Atlas is used for database services, and the
OpenAI API for model access.
    - **Twitter handle:** @richmondalake

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-08 20:21:24 +00:00
Erick Friis
391e8f2050
pinecone[patch]: fix core min version (#20177) 2024-04-08 20:06:59 +00:00
Harry Jiang
1ee208541c
langchain: fix pinecone upsert when async_req is set to False (#19793)
Issue: 
When async_req is the default value True, pinecone client return the
multiprocessing AsyncResult object.
When async_req is set to False, pinecone client return the result
directly. `[{'upserted_count': 1}]` . Calling get() method will throw an
error in this case.
2024-04-08 12:55:59 -07:00
Alex Sherstinsky
5f563e040a
community: extend Predibase integration to support fine-tuned LLM adapters (#19979)
- [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:** Langchain-Predibase integration was failing, because
it was not current with the Predibase SDK; in addition, Predibase
integration tests were instantiating the Langchain Community `Predibase`
class with one required argument (`model`) missing. This change updates
the Predibase SDK usage and fixes the integration tests.
    - **Twitter handle:** `@alexsherstinsky`


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

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-08 18:54:29 +00:00
Bagatur
a27d88f12a
anthropic[patch]: standardize init args (#20161)
Related to #20085
2024-04-08 12:09:06 -05:00
Bagatur
3490d70238
mistralai[patch]: standardize model params (#20163)
Related to #20085
2024-04-08 11:48:38 -05:00
Bagatur
17182406f3
docs: standardize fireworks params (#20162)
Related to #20085
2024-04-08 10:57:56 -05:00
Bagatur
5ae0e687b3
docs: use standard openai params (#20160)
Part of #20085
2024-04-08 10:56:53 -05:00
david02871
e1a24d09c5
community: Add PHP language parser to document_loaders (#19850)
**Description:**
Added a PHP language parser to document_loaders
**Issue:** N/A
**Dependencies:** N/A
**Twitter handle:** N/A

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-04-08 11:30:28 -04:00
Marlene
2f03bc397e
Community: Updating Azure Retriever and Docs to be Azure AI Search instead of Azure Cognitive Search (#19925)
Last year Microsoft [changed the
name](https://learn.microsoft.com/en-us/azure/search/search-what-is-azure-search)
of Azure Cognitive Search to Azure AI Search. This PR updates the
Langchain Azure Retriever API and it's associated docs to reflect this
change. It may be confusing for users to see the name Cognitive here and
AI in the Microsoft documentation which is why this is needed. I've also
added a more detailed example to the Azure retriever doc page.

There are more places that need a similar update but I'm breaking it up
so the PRs are not too big 😄 Fixing my errors from the previous PR.

Twitter: @marlene_zw

Two new tests added to test backward compatibility in
`libs/community/tests/integration_tests/retrievers/test_azure_cognitive_search.py`

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-04-08 11:12:41 -04:00
Rahul Triptahi
820b713086
community[minor]: Add support for Pebblo cloud_api_key in PebbloSafeLoader (#19855)
**Description**:
_PebbloSafeLoader_: Add support for pebblo's cloud api-key in
PebbloSafeLoader

- This Pull request enables PebbloSafeLoader to accept pebblo's cloud
api-key and send the semantic classification data to pebblo cloud.

**Documentation**: Updated 
**Unit test**: Added
**Issue**: NA
**Dependencies**: - None
**Twitter handle**: @rahul_tripathi2

Signed-off-by: Rahul Tripathi <rauhl.psit.ec@gmail.com>
Co-authored-by: Rahul Tripathi <rauhl.psit.ec@gmail.com>
2024-04-08 11:10:04 -04:00
Eugene Yurtsev
34a24d4df6
postgres[minor]: Add pgvector community as is (#20096)
This moves langchain pgvector community as is

The only modification is support for psycopg3 rather than psycopg2!
2024-04-08 09:34:10 -04:00
Eugene Yurtsev
ba9e0d76c1
postgres[minor]: add postgres checkpoint implementation (#20025)
Adds checkpoint implementation using psycopg
2024-04-08 09:27:15 -04:00
William FH
039b7a472d
[core] fix: manually specifying run_id for chat models.invoke() and .ainvoke() (#20082) 2024-04-06 16:57:32 -07:00
Chris Germann
ba602dc562
Documentation: Fixed the typo of Discord -> Telegram (#20008)
Description: Just fixed one string
Issues: None
Dependencies: None
Twitter handle: @epu9byj

Co-authored-by: gere <gere@kapo.zh.ch>
2024-04-06 20:00:03 +00:00
Erick Friis
96dc0ea49d
pinecone[patch]: release 0.1.0 (#20109) 2024-04-06 18:41:28 +00:00
donbr
de496062b3
templates: migrate to langchain_anthropic package to support Claude 3 models (#19393)
- **Description:** update langchain anthropic templates to support
Claude 3 (iterative search, chain of note, summarization, and XML
response)
- **Issue:** issue # N/A. Stability issues and errors encountered when
trying to use older langchain and anthropic libraries.
- **Dependencies:**
  - langchain_anthropic version 0.1.4\
- anthropic package version in the range ">=0.17.0,<1" to support
langchain_anthropic.
- **Twitter handle:** @d_w_b7


- [ x]**Add tests and docs**: If you're adding a new integration, please
include
  1. used instructions in the README for testing

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

---------

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-06 00:33:59 +00:00
Maxime Perrin
5ac0d1f67b
partners[anthropic]: fix anthropic chat model message type lookup keys (#19034)
- **Description:** Fixing message formatting issue in ChatAnthropic
model by adding dictionary keys for `AIMessageChunk `and
`HumanMessageChunk`
  - **Issue:** #19025 
  - **Twitter handle:** @maximeperrin_

Co-authored-by: Maxime Perrin <mperrin@doing.fr>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-06 00:22:14 +00:00
Krista Pratico
d64bd32b20
templates: add rag azure search template (#18143)
- **Description:** Adds a template for performing RAG with the
AzureSearch vectorstore.
- **Issue:** N/A
- **Dependencies:** N/A
- **Twitter handle:** N/A

---------

Co-authored-by: Erick Friis <erickfriis@gmail.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-06 00:20:40 +00:00
Bagatur
46f580d42d
docs: anthropic tool docstring (#20091) 2024-04-05 21:50:40 +00:00
Erick Friis
28dfde2cb2
cohere: move package to external repo (#20081) 2024-04-05 14:29:15 -07:00
Jacob Lee
58a2123ca0
docs[patch]: Add missing redirects (#20076) 2024-04-05 12:54:00 -07:00
Eugene Yurtsev
520ff50adc
community[patch]: Improve import callbacks to make it IDE friendly (#20050)
* declares __all__ as a list of strings (instead of dynamically
computing it)
* import type definitions when TYPE_CHECKING is true
2024-04-05 15:17:51 -04:00
Guangdong Liu
5a76087965
langchain-core[minor]: Allow passing local cache to language models (#19331)
After this PR it will be possible to pass a cache instance directly to a
language model. This is useful to allow different language models to use
different caches if needed.

- **Issue:** close #19276

---------

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
2024-04-05 11:19:54 -04:00
Eugene Yurtsev
e4fc0e7502
core[patch]: Document BaseCache abstraction in code (#20046)
Document the base cache abstraction in the cache.
2024-04-05 10:56:57 -04:00
Christophe Bornet
4d8a6a27a3
core[minor]: Implement aformat_prompt and ainvoke in BasePromptTemplate (#20035) 2024-04-05 10:36:43 -04:00
Christophe Bornet
7e5c1905b1
core[minor]: Add async aformat_document method (#20037) 2024-04-05 10:29:53 -04:00
Christophe Bornet
927793d088
Merge pull request #20038
* Implement aformat_messages for ChatMessagePromptTemplate
2024-04-05 10:25:27 -04:00
Erick Friis
ebd24bb5d6
docs: fix title cap (#20048) 2024-04-05 02:36:33 +00:00
Eugene Yurtsev
1ee8cf7b20
Docs: Update custom chat model (#19967)
* Clean up in the existing tutorial
* Add model_name to identifying params
* Add table to summarize messages
2024-04-04 22:36:03 -04:00
Erick Friis
5fc7bb01e9
docs: weaviate docs (#20042) 2024-04-04 19:01:02 -07:00
Bagatur
38fb1429fe
docs: fix together model tab (#20032) 2024-04-04 15:33:43 -07:00
Jacob Lee
b69af26717
docs[patch]: Fix Model I/O quickstart (#20031)
@baskaryan
2024-04-04 15:28:58 -07:00
Usama Ahmed
94ac42c573
docs: fixing typo in argument name (#20028)
it's "mode" instead of "model", I fixed it
2024-04-04 22:28:28 +00:00
Bagatur
07eeeb84f3
docs: hide experimental anthropic (#20030) 2024-04-04 15:27:52 -07:00
Lance Martin
e76b9210dd
Update example cookbook for Anthropic tool use (#20029) 2024-04-04 14:53:18 -07:00
Leonid Ganeline
3856dedff4
docs: integrations/providers update 9 (#19941)
- Added missed providers
- Added links, descriptions in related examples
- Formatted in a consistent format

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-04 21:37:48 +00:00
Bagatur
644ff46100
docs: mark anthropic tools wrapper as deprecated (#20024) 2024-04-04 21:33:55 +00:00
Leonid Ganeline
69bf6262aa
docs: integrations/providers/unstructured update (#19892)
Updated a page with existing document loaders with links to examples.
Fixed formatting of one example.

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-04 21:31:27 +00:00
Bagatur
1b7ed6071a
anthropic[patch]: Release 0.1.6 (#20026) 2024-04-04 14:29:50 -07:00
Bagatur
6860450e48
anthropic[patch]: use anthropic 0.23 (#20022) 2024-04-04 14:23:53 -07:00
Leonid Ganeline
4c969286fe
docs integrations/providers update 10 (#19970)
Fixed broken links. Formatted to get consistent forms. Added missed
imports in the example code
2024-04-04 14:22:45 -07:00
Leonid Ganeline
82f0198be2
docs: graphs update (#19675)
Issue: The `graph` code was moved into the `community` package a long
ago. But the related documentation is still in the
[use_cases](https://python.langchain.com/docs/use_cases/graph/integrations/diffbot_graphtransformer)
section and not in the `integrations`.
Changes:
- moved the `use_cases/graph/integrations` notebooks into the
`integrations/graphs`
- renamed files and changed titles to follow the consistent format
- redirected old page URLs to new URLs in `vercel.json` and in several
other pages
- added descriptions and links when necessary
- formatted into the consistent format
2024-04-04 14:13:22 -07:00
Bagatur
be3dd62de4
anthropic[patch]: fix experimental tests (#20021) 2024-04-04 13:37:43 -07:00