Commit Graph

4583 Commits (33781ac4a251367947802e3fc59c3843296f384c)
 

Author SHA1 Message Date
Aashish Saini 33781ac4a2
Update sequential_chains.mdx (#64) (#10793)
Fixed some more grammatical issues
@baskaryan

Co-authored-by: ManpreetShorthillsAI <142380984+ManpreetShorthillsAI@users.noreply.github.com>
Co-authored-by: Aashish Saini <141953346+AashishSainiShorthillsAI@users.noreply.github.com>
Co-authored-by: AryamanJaiswalShorthillsAI <142397527+AryamanJaiswalShorthillsAI@users.noreply.github.com>
Co-authored-by: Adarsh Shrivastav <142413097+AdarshKumarShorthillsAI@users.noreply.github.com>
Co-authored-by: Vishal <141389263+VishalYadavShorthillsAI@users.noreply.github.com>
Co-authored-by: ChetnaGuptaShorthillsAI <142381084+ChetnaGuptaShorthillsAI@users.noreply.github.com>
Co-authored-by: PankajKumarShorthillsAI <142473460+PankajKumarShorthillsAI@users.noreply.github.com>
Co-authored-by: AbhishekYadavShorthillsAI <142393903+AbhishekYadavShorthillsAI@users.noreply.github.com>
Co-authored-by: AmitSinghShorthillsAI <142410046+AmitSinghShorthillsAI@users.noreply.github.com>
Co-authored-by: Md Nazish Arman <142379599+MdNazishArmanShorthillsAI@users.noreply.github.com>
Co-authored-by: KamalSharmaShorthillsAI <142474019+KamalSharmaShorthillsAI@users.noreply.github.com>
Co-authored-by: Lakshya <lakshyagupta87@yahoo.com>
Co-authored-by: Aayush <142384656+AayushShorthillsAI@users.noreply.github.com>
Co-authored-by: AnujMauryaShorthillsAI <142393269+AnujMauryaShorthillsAI@users.noreply.github.com>
Co-authored-by: Saransh Sharma <142397365+SaranshSharmaShorthillsAI@users.noreply.github.com>
Co-authored-by: GhayurHamzaShorthillsAI <136243850+GhayurHamzaShorthillsAI@users.noreply.github.com>
Co-authored-by: Puneet Dhiman <142409038+PuneetDhimanShorthillsAI@users.noreply.github.com>
Co-authored-by: Riya Rana <142411643+RiyaRanaShorthillsAI@users.noreply.github.com>
12 months ago
Douglas Monsky d5f1969d55
Introducing Enhanced Functionality to WeaviateHybridSearchRetriever: Accepting Additional Keyword Arguments (#10802)
**Description:** 
This commit enriches the `WeaviateHybridSearchRetriever` class by
introducing a new parameter, `hybrid_search_kwargs`, within the
`_get_relevant_documents` method. This parameter accommodates arbitrary
keyword arguments (`**kwargs`) which can be channeled to the inherited
public method, `get_relevant_documents`, originating from the
`BaseRetriever` class.

This modification facilitates more intricate querying capabilities,
allowing users to convey supplementary arguments to the `.with_hybrid()`
method. This expansion not only makes it possible to perform a more
nuanced search targeting specific properties but also grants the ability
to boost the weight of searched properties, to carry out a search with a
custom vector, and to apply the Fusion ranking method. The documentation
has been updated accordingly to delineate these new possibilities in
detail.

In light of the layered approach in which this search operates,
initiating with `query.get()` and then transitioning to
`.with_hybrid()`, several advantageous opportunities are unlocked for
the hybrid component that were previously unattainable.

Here’s a representative example showcasing a query structure that was
formerly unfeasible:

[Specific Properties
Only](https://weaviate.io/developers/weaviate/search/hybrid#selected-properties-only)
"The example below illustrates a BM25 search targeting the keyword
'food' exclusively within the 'question' property, integrated with
vector search results corresponding to 'food'."
```python
response = (
    client.query
    .get("JeopardyQuestion", ["question", "answer"])
    .with_hybrid(
        query="food",
        properties=["question"], # Will now be possible moving forward
        alpha=0.25
    )
    .with_limit(3)
    .do()
)
```
This functionality is now accessible through my alterations, by
conveying `hybrid_search_kwargs={"properties": ["question", "answer"]}`
as an argument to
`WeaviateHybridSearchRetriever.get_relevant_documents()`. For example:

```python
import os
from weaviate import Client
from langchain.retrievers import WeaviateHybridSearchRetriever

client = Client(
        url=os.getenv("WEAVIATE_CLIENT_URL"),
        additional_headers={
            "X-OpenAI-Api-Key": os.getenv("OPENAI_API_KEY"),
            "Authorization": f"Bearer {os.getenv('WEAVIATE_API_KEY')}",
        },
    )

index_name = "Document"
text_key = "content"
attributes = ["title", "summary", "header", "url"]

retriever = ExtendedWeaviateHybridSearchRetriever(
        client=client,
        index_name=index_name,
        text_key=text_key,
        attributes=attributes,
    )

# Warning: to utilize properties in this way, each use property must also be in the list `attributes + [text_key]`.
hybrid_search_kwargs = {"properties": ["summary^2", "content"]}
query_text = "Some Query Text"

relevant_docs = retriever.get_relevant_documents(
        query=query_text,
        hybrid_search_kwargs=hybrid_search_kwargs
    )
```
In my experience working with the `weaviate-client` library, I have
found that these supplementary options stand as vital tools for
refining/finetuning searches, notably within multifaceted datasets. As a
final note, this implementation supports both backwards and forward
(within reason) compatiblity. It accommodates any future additional
parameters Weaviate may add to `.with_hybrid()`, without necessitating
further alterations.

**Additional Documentation:**
For a more comprehensive understanding and to explore a myriad of useful
options that are now accessible, please refer to the Weaviate
documentation:
- [Fusion Ranking
Method](https://weaviate.io/developers/weaviate/search/hybrid#fusion-ranking-method)
- [Selected Properties
Only](https://weaviate.io/developers/weaviate/search/hybrid#selected-properties-only)
- [Weight Boost Searched
Properties](https://weaviate.io/developers/weaviate/search/hybrid#weight-boost-searched-properties)
- [With a Custom
Vector](https://weaviate.io/developers/weaviate/search/hybrid#with-a-custom-vector)

**Tag Maintainer:** 
@hwchase17 - I have tagged you based on your frequent contributions to
the pertinent file, `/retrievers/weaviate_hybrid_search.py`. My
apologies if this was not the appropriate choice.

Thank you for considering my contribution, I look forward to your
feedback, and to future collaboration.
12 months ago
Jacob Lee 61cecf8b1b
Fix for versioned OpenAI instruct models (#10788)
Versioned OpenAI instruct models may end with numbers, e.g.
`gpt-3.5-turbo-instruct-0914`.

Fixes https://github.com/langchain-ai/langchainjs/issues/2669 in Python
12 months ago
Bagatur 73afd72e1d
fix qa structured link (#10799)
redirect not working for some reason
12 months ago
Cory Zue 62603f2664
make auto-setting the encodings optional, alow explicitly setting it (#10774)
I was trying to use web loaders on some spanish documentation (e.g.
[this site](https://www.fromdoppler.com/es/mailing-tendencias/), but the
auto-encoding introduced in
https://github.com/langchain-ai/langchain/pull/3602 was detected as
"MacRoman" instead of the (correct) "UTF-8".

To address this, I've added the ability to disable the auto-encoding, as
well as the ability to explicitly tell the loader what encoding to use.

- **Description:** Makes auto-setting the encoding optional in
`WebBaseLoader`, and introduces an `encoding` option to explicitly set
it.
  - **Dependencies:** N/A
  - **Tag maintainer:** @hwchase17 
  - **Twitter handle:** @czue
12 months ago
Harrison Chase c68be4eb2b
tool rendering (#10786) 12 months ago
Aashish Saini 1b050b98f5
Corrected some spelling mistakes and grammatical errors (#10791)
Corrected some spelling mistakes and grammatical errors
CC: @baskaryan, @eyurtsev, @hwchase17.

---------

Co-authored-by: Ishita Chauhan <136303787+IshitaChauhanShortHillsAI@users.noreply.github.com>
Co-authored-by: Aashish Saini <141953346+AashishSainiShorthillsAI@users.noreply.github.com>
Co-authored-by: ManpreetShorthillsAI <142380984+ManpreetShorthillsAI@users.noreply.github.com>
Co-authored-by: AryamanJaiswalShorthillsAI <142397527+AryamanJaiswalShorthillsAI@users.noreply.github.com>
Co-authored-by: Adarsh Shrivastav <142413097+AdarshKumarShorthillsAI@users.noreply.github.com>
Co-authored-by: Vishal <141389263+VishalYadavShorthillsAI@users.noreply.github.com>
Co-authored-by: ChetnaGuptaShorthillsAI <142381084+ChetnaGuptaShorthillsAI@users.noreply.github.com>
Co-authored-by: PankajKumarShorthillsAI <142473460+PankajKumarShorthillsAI@users.noreply.github.com>
Co-authored-by: AbhishekYadavShorthillsAI <142393903+AbhishekYadavShorthillsAI@users.noreply.github.com>
Co-authored-by: AmitSinghShorthillsAI <142410046+AmitSinghShorthillsAI@users.noreply.github.com>
Co-authored-by: Md Nazish Arman <142379599+MdNazishArmanShorthillsAI@users.noreply.github.com>
Co-authored-by: KamalSharmaShorthillsAI <142474019+KamalSharmaShorthillsAI@users.noreply.github.com>
Co-authored-by: Lakshya <lakshyagupta87@yahoo.com>
Co-authored-by: Aayush <142384656+AayushShorthillsAI@users.noreply.github.com>
Co-authored-by: AnujMauryaShorthillsAI <142393269+AnujMauryaShorthillsAI@users.noreply.github.com>
Co-authored-by: ishita <chauhanishita5356@gmail.com>
12 months ago
Ahmad Bunni 5272e42b0d
Add namespace to pinecone hybrid search (#10677)
**Description:** 
  
Pinecone hybrid search is now limited to default namespace. There is no
option for the user to provide a namespace to partition an index, which
is one of the most important features of pinecone.
  
**Resource:** 
https://docs.pinecone.io/docs/namespaces

---------

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
1 year ago
Raunak Chowdhuri b338e492fc
Remembrall Integration (#10767)
- **Description:** Added integration instructions for Remembrall. 
  - **Tag maintainer:** @hwchase17 
  - **Twitter handle:** @raunakdoesdev

Fun fact, this project originated at the Modal Hackathon in NYC where it
won the Best LLM App prize sponsored by Langchain. Thanks for your
support 🦜
1 year ago
Bagatur 0d1550da91
Bagatur/bump 295 (#10785) 1 year ago
Aashish Saini 6a98974bd0
Update argilla.ipynb with spelling fix (#10611)
Fixed spelling of **responses** and removed extra "the"
1 year ago
Vikram Shitole a4e858b111
Sagemaker endpoint capability to inject boto3 client for cross account scenarios (#10728)
- **Description: Allow to inject boto3 client for Cross account access
type of scenarios in using Sagemaker Endpoint **
  - **Issue:#10634 #10184** 
  - **Dependencies: None** 
  - **Tag maintainer:** 
  - **Twitter handle:lethargicoder**

Co-authored-by: Vikram(VS) <vssht@amazon.com>
1 year ago
William FH c8f386db97
Merge metadata + tags in config (#10762)
Think these should be a merge/update rather than overwrite
1 year ago
Jacob Lee 71025013f8
Update routing cookbook to include a RunnableBranch example (#10754)
~~Because we can't pass extra parameters into a prompt, we have to
prepend a function before the runnable calls in the branch and it's a
bit less elegant than I'd like.~~

All good now that #10765 has landed!

@eyurtsev @hwchase17

---------

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
1 year ago
BarberAlec c898a4d7ba
Update ContextCallbackHandler Docstring & metadata key (#10732)
- **Description:** Updating URL in Context Callback Docstrings and
update metadata key Context CallbackHandler uses to send model names.
- **Issue:** The URL in ContextCallbackHandler is out of date. Model
data being sent to Context should be under the "model" key and not
"llm_model". This allows Context to do more sophisticated analysis.
  - **Dependencies:** None

Tagging @agamble.
1 year ago
Taqi Jaffri 54763a61f8
fix broken link in docugami loader docs (#10753)
Just fixing the link to the self query retriever in docugami loader docs

Co-authored-by: Taqi Jaffri <tjaffri@docugami.com>
1 year ago
Harrison Chase 8b68d1a03b
keep reference to old embeddings base (#10759) 1 year ago
Jacob Lee babf46692d
Allow extra variables when invoking prompt templates (#10765)
Makes chaining easier as many maps have extra properties.

@baskaryan @hwchase17
1 year ago
Bagatur 8515e27d82
bump 294 (#10751) 1 year ago
Jacob Lee 579d14fbc1
Allow 3.5-turbo instruct models in the OpenAI LLM class (#10750)
@baskaryan @hwchase17
1 year ago
Bagatur 4c80978ec6
mv data bricks sql page (#10748) 1 year ago
Harrison Chase e404fd39dd
add anthropic page (#10666) 1 year ago
Bagatur 5072138893
bump 293 (#10740) 1 year ago
Harrison Chase 12ff780089
move embeddings to schema (#10696) 1 year ago
Jiayi Ni ce61840e3b
ENH: Add `llm_kwargs` for Xinference LLMs (#10354)
- This pr adds `llm_kwargs` to the initialization of Xinference LLMs
(integrated in #8171 ).
- With this enhancement, users can not only provide `generate_configs`
when calling the llms for generation but also during the initialization
process. This allows users to include custom configurations when
utilizing LangChain features like LLMChain.
- It also fixes some format issues for the docstrings.
1 year ago
Eugene Yurtsev 1eefb9052b
RunnableBranch (#10594)
Runnable Branch implementation, no optimization for streaming logic yet
1 year ago
William FH 287c81db89
Catch Base Exception (#10607)
Currently the on_*_error isn't called for CancellationError's. This is
because in python 3.8, the inheritance changed from Exception to
BaseException


https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.CancelledError
1 year ago
Philippe PRADOS 39c1c94272
Fix typing in WebResearchRetriver (#10734)
Hello @hwchase17 

**Issue**:
The class WebResearchRetriever accept only
RecursiveCharacterTextSplitter, but never uses a specification of this
class. I propose to change the type to TextSplitter. Then, the lint can
accept all subtypes.
1 year ago
Nuno Campos 8201cae770
Bug fixes for runnables (#10738)
- tools invoked in async methods would not work due to missing await
- RunnableSequence.stream() was creating an extra root run by mistake,
and it can simplified due to existence of default implementation for
.transform()

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

If no one reviews your PR within a few days, please @-mention one of
@baskaryan, @eyurtsev, @hwchase17.
 -->
1 year ago
William FH 6e48092746
Update LangSmith Version (#10722)
And assign dataset ID upon project creation
1 year ago
Bagatur d21a494a27
mention how-to in LCEL index (#10727) 1 year ago
William FH a3e5507faa
Make eval output parsers more robust (#10658)
Ran through a few hundred generations with some models to fix up the
parsers
1 year ago
Bagatur 3992c1ae9b
runnable bind how to nit (#10718) 1 year ago
Bagatur c3e52ba8ab
Runnable fallbacks howto (#10717) 1 year ago
Bagatur 441a5c2b30
Runnable binding how to (#10716) 1 year ago
Bagatur 4a7da3ce3b
add runnable map how to (#10715) 1 year ago
Nino Risteski d0070040da
Update CONTRIBUTING.md (#10700)
fiixed few typos
1 year ago
Bagatur 8371a8a0c6
Mv LCEL routing doc (#10713)
Move to how-to
1 year ago
Bagatur 5fda838346
Docs intro nit (#10712) 1 year ago
Bagatur f9561fd7c5
docs intro nit (#10711) 1 year ago
William FH c5078fb13c
Add support for showing IO to chain group (#10510)
As well as error propagation
1 year ago
Harrison Chase 2c957de2fc
add checks on basic base modules (#10693) 1 year ago
Harrison Chase 5442d2b1fa
Harrison/stop importing from init (#10690) 1 year ago
Hedeer El Showk 9749f8ebae
database -> db in from_llm (#10667)
**Description:** Renamed argument `database` in
`SQLDatabaseSequentialChain.from_llm()` to `db`,

I realize it's tiny and a bit of a nitpick but for consistency with
SQLDatabaseChain (and all the others actually) I thought it should be
renamed. Also got me while working and using it today.

✔️ Please make sure your PR is passing linting and
testing before submitting. Run `make format`, `make lint` and `make
test` to check this locally.
1 year ago
Joshua Sundance Bailey c4e591a57d
OpenAI function calling docstring and notebook imports (#10663)
This PR is a documentation fix.

Description:
* fixes imports in the code samples in the docstrings of
`create_openai_fn_chain` and `create_structured_output_chain`
* fixes imports in
`docs/extras/modules/chains/how_to/openai_functions.ipynb`
* removes unused imports from the notebook

Issues:
* the docstrings use `from pydantic_v1 import BaseModel, Field` which
this PR changes to `from langchain.pydantic_v1 import BaseModel, Field`
* importing `pydantic` instead of `langchain.pydantic_v1` leads to
errors later in the notebook
1 year ago
xleven 6f36bc6d38
add WeChat chat loader notebook (#10672)
Like
[DiscordChatLoader](https://python.langchain.com/docs/integrations/chat_loaders/discord)
(as mentioned in #9708), this notebook is a demonstration of
WeChatChatLoader based on copy-pasting WeChat messages dump.
1 year ago
Nino Risteski 91f1af0a93
Update community.md (#10676)
fixed typos
1 year ago
Harrison Chase a5ca0ca6e7
update quickstart to use lcel (#10687) 1 year ago
Harrison Chase bdd9fe4066
docs refresh intro (#10683) 1 year ago
Nuno Campos 9cd131a178
Support kwargs in RunnableWithFallbacks (#10682)
<!-- 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. It lives in `docs/extras`
directory.

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