Commit Graph

5462 Commits

Author SHA1 Message Date
Cillian Berragan
754f3c41f9
community: add score to PineconeHybridSearchRetriever (#25781)
**Description:**

Adds the 'score' returned by Pinecone to the
`PineconeHybridSearchRetriever` list of returned Documents.

There is currently no way to return the score when using Pinecone hybrid
search, so in this PR I include it by default.

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-08-28 13:11:06 +00:00
ZhangShenao
3f1d652f15
Improvement[Community] Improve api doc for PineconeHybridSearchRetriever (#25803)
- Complete missing args in api doc
2024-08-28 08:38:56 -04:00
Moritz Schlager
555f97becb
community[patch]: fix model initialization bug for deepinfra (#25727)
### Description
adds an init method to ChatDeepInfra to set the model_name attribute
accordings to the argument
### Issue
currently, the model_name specified by the user during initialization of
the ChatDeepInfra class is never set. Therefore, it always chooses the
default model (meta-llama/Llama-2-70b-chat-hf, however probably since
this is deprecated it always uses meta-llama/Llama-3-70b-Instruct). We
stumbled across this issue and fixed it as proposed in this pull
request. Feel free to change the fix according to your coding guidelines
and style, this is just a proposal and we want to draw attention to this
problem.
### Dependencies
no additional dependencies required

Feel free to contact me or @timo282 and @finitearth if you have any
questions.

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2024-08-28 02:02:35 -07:00
Bagatur
a052173b55
together[patch]: Release 0.1.6 (#25805) 2024-08-28 02:01:49 -07:00
Bagatur
b0ac6fe8d3
community[patch]: Release 0.2.13 (#25806) 2024-08-28 08:57:49 +00:00
Bagatur
85aef7641c
openai[patch]: Release 0.1.23 (#25804) 2024-08-28 08:52:08 +00:00
Bagatur
0d3fd0aeb9
langchain[patch]: Release 0.2.15 (#25802) 2024-08-28 08:35:00 +00:00
zysoong
25a6790e1a
community[patch]: Minor Improvement of extract hyperlinks tool output (#25728)
**Description:** Make the hyperlink only appear once in the
extract_hyperlinks tool output. (for some websites output contains
meaningless '#' hyperlinks multiple times which will extend the tokens
of context window without any advantage)
**Issue:** None
**Dependencies:** None
2024-08-28 08:02:40 +00:00
Christophe Bornet
ff0df5ea15
core[patch]: Add B(bugbear) ruff rules (#25520)
Co-authored-by: Bagatur <baskaryan@gmail.com>
2024-08-28 07:09:29 +00:00
Isaac Francisco
d5ddaac1fc
docs minor fix (#25794) 2024-08-28 04:14:36 +00:00
ccurme
3c784e10a8
docs: improve docs for InMemoryVectorStore (#25786)
Closes https://github.com/langchain-ai/langchain/issues/25775
2024-08-27 21:12:32 -07:00
Erick Friis
1023fbc98a
databricks: mv to partner repo (#25788) 2024-08-27 18:51:17 -07:00
ccurme
2e5c379632
openai[patch]: fix get_num_tokens for function calls (#25785)
Closes https://github.com/langchain-ai/langchain/issues/25784

See additional discussion
[here](0a4ee864e9 (r145147380)).
2024-08-27 20:18:19 +00:00
venkatram-dev
48b579f6b5
date_time_parser (#25763)
Thank you for contributing to LangChain!

- [x] **PR title**: "langchain: Chains: query_constructor: add date time
parser"

- [x] **PR message**: 
- **Description:** add date time parser to langchain Chains
query_constructor
    - **Issue: https://github.com/langchain-ai/langchain/issues/25526


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


- [ ] **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.
2024-08-27 13:18:52 -04:00
Tomaz Bratanic
f359e6b0a5
Add mmr to neo4j vector (#25765) 2024-08-27 08:55:19 -04:00
pazshalev
995305fdd5
test: fix tool calling integration tests for AI21 Jamba models (#25771)
Ignore specific integration tests that handles specific tool calling
cases that will soon be fixed.
2024-08-27 08:54:51 -04:00
Luis Valencia
99f9a664a5
community: Azure Search Vector Store is missing Access Token Authentication (#24330)
Added Azure Search Access Token Authentication instead of API KEY auth.
Fixes Issue: https://github.com/langchain-ai/langchain/issues/24263
Dependencies: None
Twitter: @levalencia

@baskaryan

Could you please review? First time creating a PR that fixes some code.

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-08-26 15:41:50 -07:00
ZhangShenao
44e3e2391c
Improvement[Community] Improve methods in IMessageChatLoader (#25746)
- Add @staticmethod to static methods in `IMessageChatLoader`.
- Format args name.
2024-08-26 14:20:22 -04:00
Erick Friis
815f59dba5
partners/ai21: release 0.1.8 (#25759) 2024-08-26 18:02:43 +00:00
amirai21
17dffd9741
AI21: tools calling support in Langchain (#25635)
This pull request introduces support for the AI21 tools calling feature,
available by the Jamba-1.5 models. When Jamba-1.5 detects the necessity
to invoke a provided tool, as indicated by the 'tools' parameter passed
to the model:

```
class ToolDefinition(TypedDict, total=False):
    type: Required[Literal["function"]]
    function: Required[FunctionToolDefinition]

class FunctionToolDefinition(TypedDict, total=False):
    name: Required[str]
    description: str
    parameters: ToolParameters

class ToolParameters(TypedDict, total=False):
    type: Literal["object"]
    properties: Required[Dict[str, Any]]
    required: List[str]
```

It will respond with a list of tool calls structured as follows:

```
class ToolCall(AI21BaseModel):
    id: str
    function: ToolFunction
    type: Literal["function"] = "function"

class ToolFunction(AI21BaseModel):
    name: str
    arguments: str
```

This pull request incorporates the necessary modifications to integrate
this functionality into the ai21-langchain library.

---------

Co-authored-by: asafg <asafg@ai21.com>
Co-authored-by: pazshalev <111360591+pazshalev@users.noreply.github.com>
Co-authored-by: Paz Shalev <pazs@ai21.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-08-26 10:50:30 -07:00
maang-h
a566a15930
Fix MoonshotChat instantiate with alias (#25755)
- **Description:**
   -  Fix `MoonshotChat` instantiate with alias
   - Add `MoonshotChat` to `__init__.py`

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-08-26 17:33:22 +00:00
venkatram-dev
ec99f0d193
milvus: add_db_milvus_connection (#25627)
Thank you for contributing to LangChain!

- [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"
  - "libs: langchain_milvus: add db name to milvus connection check"


- [x] **PR message**: ***Delete this entire checklist*** and replace
with
    - **Description:**  add db name to milvus connection check
    - **Issue:** https://github.com/langchain-ai/langchain/issues/25277



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

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-08-26 17:29:12 +00:00
Ashvin
af3b3a4474
Update endpoint for AzureMLEndpointApiType class. (#25725)
This addresses the issue mentioned in #25702

I have updated the endpoint used in validating the endpoint API type in
the AzureMLBaseEndpoint class from `/v1/completions` to `/completions`
and `/v1/chat/completions` to `/chat/completions`.

Co-authored-by: = <=>
2024-08-26 08:50:02 -04:00
Mohammad Mohtashim
dcf2278a05
[Community]: Added Template Format Parameter in create_chat_prompt for Langchain Prompty (#25739)
- **Description:** Added a `template_format` parameter to
`create_chat_prompt` to allow `.prompty` files to handle variables in
different template formats.
- **Issue:** #25703

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-08-26 12:48:21 +00:00
Dristy Srivastava
7205057c3e
[Community][minor]: Added langchain_version while calling discover API (#24428)
- **Description:** Added langchain version while calling discover API
during both ingestion and retrieval
- **Issue:** NA
- **Dependencies:** NA
- **Tests:** NA
- **Docs** NA

---------

Co-authored-by: dristy.cd <dristy@clouddefense.io>
2024-08-26 08:47:48 -04:00
Dristy Srivastava
fbb4761199
[Community][minor]: Updating source path, and file path for SharePoint loader in PebbloSafeLoader (#25592)
- **Description:** Updating source path and file path in Pebblo safe
loader for SharePoint apps during loading
- **Issue:** NA
- **Dependencies:** NA
- **Tests:** NA
- **Docs** NA

---------

Co-authored-by: dristy.cd <dristy@clouddefense.io>
2024-08-26 08:38:40 -04:00
Rajendra Kadam
745d1c2b8d
community[minor]: [Pebblo] Fix URL construction in newer Python versions (#25747)
- **PR message**: **Fix URL construction in newer Python versions**
- **Description:** 
- Update the URL construction logic to use the .value attribute for
Routes enum members.
- This adjustment resolves an issue where the code worked correctly in
Python 3.9 but failed in Python 3.11.
  - Clean up unused routes.
- **Issue:** NA
- **Dependencies:** NA
2024-08-26 07:27:30 -04:00
Rajendra Kadam
58a98c7d8a
community: [PebbloRetrievalQA] Implemented Async support for prompt APIs (#25748)
- **Description:** PebbloRetrievalQA: Implemented Async support for
prompt APIs (classification and governance)
- **Issue:** NA
- **Dependencies:** NA
2024-08-26 07:27:05 -04:00
Tomaz Bratanic
6703d795c5
Handle Ollama tool raw schema in llmgraphtransformer (#25752) 2024-08-26 07:26:26 -04:00
Bagatur
30f1bf24ac
core[patch]: Release 0.2.35 (#25729) 2024-08-25 16:49:27 -07:00
Christophe Bornet
038c287b3a
all: Improve make lint command (#25344)
* Removed `ruff check --select I` as `I` is already selected and checked
in the main `ruff check` command
* Added checks for non-empty `PYTHON_FILES`
* Run `ruff check` only on `PYTHON_FILES`

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-08-23 18:23:52 -07:00
Mohammad Mohtashim
9a29398fe6
huggingface: fix model param population (#24743)
- **Description:** Fix the validation error for `endpoint_url` for
HuggingFaceEndpoint. I have given a descriptive detail of the isse in
the issue that I have created.
- **Issue:** #24742

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-08-24 00:45:28 +00:00
Yuki Watanabe
c7a8af2e75
databricks: add vector search and embeddings (#25648)
### Summary

Add `DatabricksVectorSearch` and `DatabricksEmbeddings` classes to the
`langchain-databricks` partner packages. Core functionality is
unchanged, but the vector search class is largely refactored for
readability and maintainability.

This PR does not add integration tests yet. This will be added once the
Databricks test workspace is ready.

Tagging @efriis as POC


### Tracker
[] Create a package and imgrate ChatDatabricks
[✍️] Migrate DatabricksVectorSearch, DatabricksEmbeddings, and their
docs
~[ ] Migrate UCFunctionToolkit and its doc~
[ ] Add provider document and update README.md
[ ] Add integration tests and set up secrets (after moved to an external
package)
[ ] Add deprecation note to the community implementations.

---------

Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-08-24 00:40:21 +00:00
Hyman
58e72febeb
openai:compatible with other llm usage meta data (#24500)
- [ ] **PR message**:
- **Description:** Compatible with other llm (eg: deepseek-chat, glm-4)
usage meta data
    - **Issue:** N/A
    - **Dependencies:** no new dependencies added


- [ ] **Add tests and docs**: 
libs/partners/openai/tests/unit_tests/chat_models/test_base.py
```shell
cd libs/partners/openai
poetry run pytest tests/unit_tests/chat_models/test_base.py::test_openai_astream
poetry run pytest tests/unit_tests/chat_models/test_base.py::test_openai_stream
poetry run pytest tests/unit_tests/chat_models/test_base.py::test_deepseek_astream
poetry run pytest tests/unit_tests/chat_models/test_base.py::test_deepseek_stream
poetry run pytest tests/unit_tests/chat_models/test_base.py::test_glm4_astream
poetry run pytest tests/unit_tests/chat_models/test_base.py::test_glm4_stream
```

---------

Co-authored-by: hyman <hyman@xiaozancloud.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2024-08-23 16:59:14 -07:00
Erick Friis
3dc7d447aa
infra: reenable min version testing 2, ci ignore ai21 (#25709) 2024-08-23 23:28:42 +00:00
Erick Friis
f6491ceb7d
community: remove integration test deps (#24460)
they arent used
2024-08-23 23:25:17 +00:00
Sharmistha S. Gupta
90439b12f6
Added support for Nebula Chat model (#21925)
Description: Added support for Nebula Chat model in addition to Nebula
Instruct
Dependencies: N/A
Twitter handle: @Symbldotai

---------

Co-authored-by: Eugene Yurtsev <eugene@langchain.dev>
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-08-23 22:34:32 +00:00
James Espichan Vilca
080741d336
core[patch]: Fix type for inner input in base prompts (#25713)
Thank you for contributing to LangChain!

- [ ] **PR title**: "langchain-core: Fix type"
- The file to modify is located in
/libs/core/langchain_core/prompts/base.py


- [ ] **PR message**: 
- **Description:** The change is a type for the inner input variable,
the type go from dict to Any. This change is required since the method
_validate input expects a type that is not only a dictionary.
    - **Dependencies:** There are no dependencies for this change


- [ ] **Add tests and docs**: 
1. A test is not needed. This error occurs because I overrode a portion
of the _validate_input method, which is causing a 'beartype' to raise an
error.
2024-08-23 14:06:39 -07:00
John
5ce9a716a7
docs, langchain-unstructured: update langchain-unstructured docs and update ustructured-client dependency (#25451)
Be more explicit in the docs about creating an instance of the
UnstructuredClient if you want to customize it versus using sdk
parameters with the UnstructuredLoader.

Bump the unstructured-client dependency as discussed
[here](https://github.com/langchain-ai/langchain/discussions/25328#discussioncomment-10350949)

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-08-23 20:36:41 +00:00
Scott Hurrey
92abf62292
box[patch]: fix bugs in docs (#25699) 2024-08-23 19:36:23 +00:00
Ian
64ace25eb8
<Community>: tidb vector support vector index (#19984)
This PR introduces adjustments to ensure compatibility with the recently
released preview version of [TiDB Serverless Vector
Search](https://tidb.cloud/ai), aiming to prevent user confusion.

- TiDB Vector now supports vector indexing with cosine and l2 distance
strategies, although inner_product remains unsupported.
- Changing the distance strategy is currently not supported, so the test
cased should be adjusted.
2024-08-23 13:59:23 -04:00
Austin Burdette
f355a98bb6
community:yuan2[patch]: standardize init args (#21462)
updated stop and request_timeout so they aliased to stop_sequences, and
timeout respectively. Added test that both continue to set the same
underlying attributes.

Related to
[20085](https://github.com/langchain-ai/langchain/issues/20085)

Co-authored-by: ccurme <chester.curme@gmail.com>
2024-08-23 17:56:19 +00:00
ccurme
bc557a5663
text-splitters[patch]: fix typing for keep_separator (#25706) 2024-08-23 17:22:02 +00:00
Erick Friis
b365ee996b
community: remove unused verify_ssl kwarg from aiohttp request (#25707)
it's not a valid kwarg in aiohttp request
2024-08-23 17:14:04 +00:00
Erick Friis
580fbd9ada
docs: api ref to new site somewheres (#25679)
```
https://api\.python\.langchain\.com/en/latest/([^/]*)/langchain_([^.]*)\.(.*)\.html([^"]*)
https://python.langchain.com/v0.2/api_reference/$2/$1/langchain_$2.$3.html$4
```

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
2024-08-23 10:01:16 -07:00
Ashvin
2cd77a53a3
docs: Add docstrings for CassandraChatMessageHistory class and package namespace function. (#24222)
- Modified docstring for CassandraChatMessageHistory in
libs/community/langchain_community/chat_message_history/cassandra.py.

- Added docstring for _package_namespace function in
docs/api_reference/create_api_rst.py

---------

Co-authored-by: ashvin <ashvin.anilkumar@qburst.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
Co-authored-by: ccurme <chester.curme@gmail.com>
2024-08-23 15:49:41 +00:00
Leonid Ganeline
8788a34bfa
community: NeptuneGraph fix (#23281)
Issue: the `service` optional parameter was mentioned but not used.
Fix: added this parameter.

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2024-08-23 15:34:26 +00:00
Djordje
22f9ae489f
community: Opensearch - added score function for similarity_score_threshold (#23928)
This PR resolves the NotImplemented error for the
similarity_score_threshold search type for OpenSearch.
2024-08-23 11:30:04 -04:00
ZhangShenao
b38c83ff93
patch[Community] Optimize methods in several ChatLoaders (#24806)
There are some static methods in ChatLoaders, try to add @staticmethod
decorator for them.
2024-08-23 11:00:41 -04:00
James Espichan Vilca
644e0d3463
Use extend method for embeddings concatenation in mlflow_gateway (#14358)
## Description
There is a bug in the concatenation of embeddings obtained from MLflow
that does not conform to the type hint requested by the function.
``` python  
def _query(self, texts: List[str]) -> List[List[float]]:
```
It is logical to expect a **List[List[float]]** for a **List[str]**.
However, the append method encapsulates the response in a global List.
To avoid this, the extend method should be used, which will add the
embeddings of all strings at the same list level.

## Testing
I have tried using OpenAI-ADA to obtain the embeddings, and the result
of executing this snippet is as follows:

``` python  
embeds = await MlflowAIGatewayEmbeddings().aembed_documents(texts=["hi", "how are you?"])
print(embeds)
```  

``` python  
[[[-0.03512698, -0.020624293, -0.015343423, ...], [-0.021260535, -0.011461929, -0.00033121882, ...]]]
```
When in reality, the expected result should be:

``` python  
[[-0.03512698, -0.020624293, -0.015343423, ...], [-0.021260535, -0.011461929, -0.00033121882, ...]]
```
The above result complies with the expected type hint:
**List[List[float]]** . As I mentioned, we can achieve that by using the
extend method instead of the append method.

---------

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
Co-authored-by: ccurme <chester.curme@gmail.com>
2024-08-23 14:43:43 +00:00