Commit Graph

903 Commits

Author SHA1 Message Date
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>
2023-09-19 08:06:12 -07:00
William FH
c8f386db97
Merge metadata + tags in config (#10762)
Think these should be a merge/update rather than overwrite
2023-09-19 08:00:30 -07:00
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.
2023-09-18 22:04:13 -07:00
Harrison Chase
8b68d1a03b
keep reference to old embeddings base (#10759) 2023-09-18 20:09:44 -07:00
Jacob Lee
babf46692d
Allow extra variables when invoking prompt templates (#10765)
Makes chaining easier as many maps have extra properties.

@baskaryan @hwchase17
2023-09-18 20:08:54 -07:00
Bagatur
8515e27d82
bump 294 (#10751) 2023-09-18 16:04:02 -07:00
Jacob Lee
579d14fbc1
Allow 3.5-turbo instruct models in the OpenAI LLM class (#10750)
@baskaryan @hwchase17
2023-09-18 15:55:13 -07:00
Harrison Chase
e404fd39dd
add anthropic page (#10666) 2023-09-18 11:10:44 -07:00
Bagatur
5072138893
bump 293 (#10740) 2023-09-18 08:41:38 -07:00
Harrison Chase
12ff780089
move embeddings to schema (#10696) 2023-09-18 08:37:14 -07:00
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.
2023-09-18 11:36:29 -04:00
Eugene Yurtsev
1eefb9052b
RunnableBranch (#10594)
Runnable Branch implementation, no optimization for streaming logic yet
2023-09-18 11:31:07 -04:00
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
2023-09-18 08:19:35 -07:00
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.
2023-09-18 08:17:10 -07:00
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.
 -->
2023-09-18 15:36:57 +01:00
William FH
6e48092746
Update LangSmith Version (#10722)
And assign dataset ID upon project creation
2023-09-18 07:12:48 -07:00
William FH
a3e5507faa
Make eval output parsers more robust (#10658)
Ran through a few hundred generations with some models to fix up the
parsers
2023-09-17 19:24:20 -07:00
William FH
c5078fb13c
Add support for showing IO to chain group (#10510)
As well as error propagation
2023-09-17 00:47:51 -07:00
Harrison Chase
2c957de2fc
add checks on basic base modules (#10693) 2023-09-16 22:08:11 -07:00
Harrison Chase
5442d2b1fa
Harrison/stop importing from init (#10690) 2023-09-16 17:22:48 -07:00
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.
2023-09-16 14:26:58 -07:00
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
2023-09-16 14:24:50 -07:00
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.
 -->
2023-09-16 21:19:36 +01:00
Bagatur
6831a25675
bump 292 (#10649) 2023-09-15 09:52:08 -07:00
Nuno Campos
029b2f6aac
Allow calls to batch() with 0 length arrays (#10627)
This can happen if eg the input to batch is a list generated dynamically, where a 0-length list might be a valid use case
2023-09-15 12:37:27 -04:00
Jacob Lee
a50e62e44b
Adds transform and atransform support to runnable sequences (#9583)
Allow runnable sequences to support transform if each individual
runnable inside supports transform/atransform.

@nfcampos
2023-09-15 08:58:24 -07:00
Aashish Saini
f9f1340208
Fixed some grammatical and spelling errors (#10595)
Fixed some grammatical and spelling errors
2023-09-14 17:43:36 -07:00
Ackermann Yuriy
5e50b89164
Added embeddings support for ollama (#10124)
- Description: Added support for Ollama embeddings
  - Issue: the issue # it fixes (if applicable),
  - Dependencies: N/A
- Tag maintainer: for a quicker response, tag the relevant maintainer
(see below),
  - Twitter handle: @herrjemand

cc  https://github.com/jmorganca/ollama/issues/436
2023-09-14 17:42:39 -07:00
Bagatur
bc6b9331a9
bump 291 (#10604) 2023-09-14 15:06:53 -07:00
Bagatur
ecbb1ed8cb
Replicate params fix (#10603) 2023-09-14 15:04:42 -07:00
Bagatur
50bb704da5
bump 290 (#10602) 2023-09-14 14:43:55 -07:00
Bagatur
e195b78e1d
Fix replicate model kwargs (#10599) 2023-09-14 14:43:42 -07:00
Bagatur
77a165e0d9
fix replicate output type (#10598) 2023-09-14 14:02:01 -07:00
Bagatur
0786395b56
bump 289 (#10586)
<!-- 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.
 -->
2023-09-14 08:53:50 -07:00
Bagatur
9dd4cacae2
add replicate stream (#10518)
support direct replicate streaming. cc @cbh123 @tjaffri
2023-09-14 08:44:06 -07:00
Bagatur
7f3f6097e7
Add mmr support to redis retriever (#10556) 2023-09-14 08:43:50 -07:00
Bagatur
ccf71e23e8
cache replicate version (#10517)
In subsequent pr will update _call to use replicate.run directly when
not streaming, so version object isn't needed at all

cc @cbh123 @tjaffri
2023-09-14 08:34:04 -07:00
Stefano Lottini
49b65a1b57
CassandraCache and CassandraSemanticCache can handle any "Generation" (#10563)
Hello,
this PR improves coverage for caching by the two Cassandra-related
caches (i.e. exact-match and semantic alike) by switching to the more
general `dumps`/`loads` serdes utilities.

This enables cache usage within e.g. `ChatOpenAI` contexts (which need
to store lists of `ChatGeneration` instead of `Generation`s), which was
not possible as long as the cache classes were relying on the legacy
`_dump_generations_to_json` and `_load_generations_from_json`).

Additionally, a slightly different init signature is introduced for the
cache objects:
- named parameters required for init, to pave the way for easier changes
in the future connect-to-db flow (and tests adjusted accordingly)
- added a `skip_provisioning` optional passthrough parameter for use
cases where the user knows the underlying DB table, etc already exist.

Thank you for a review!
2023-09-14 08:33:06 -07:00
Tomaz Bratanic
e1e01d6586
Add Neo4j vector index hybrid search (#10442)
Adding support for Neo4j vector index hybrid search option. In Neo4j,
you can achieve hybrid search by using a combination of vector and
fulltext indexes.

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-09-14 08:29:16 -07:00
William FH
596f294b01
Update LangSmith Walkthrough (#10564) 2023-09-13 17:13:18 -07:00
stonekim
adabdfdfc7
Add Baidu Qianfan endpoint for LLM (#10496)
- Description:
* Baidu AI Cloud's [Qianfan
Platform](https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html) is an
all-in-one platform for large model development and service deployment,
catering to enterprise developers in China. Qianfan Platform offers a
wide range of resources, including the Wenxin Yiyan model (ERNIE-Bot)
and various third-party open-source models.
- Issue: none
- Dependencies: 
    * qianfan
- Tag maintainer: @baskaryan
- Twitter handle:

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-09-13 16:23:49 -07:00
Sergey Kozlov
0a0276bcdb
Fix OpenAIFunctionsAgent function call message content retrieving (#10488)
`langchain.agents.openai_functions[_multi]_agent._parse_ai_message()`
incorrectly extracts AI message content, thus LLM response ("thoughts")
is lost and can't be logged or processed by callbacks.

This PR fixes function call message content retrieving.
2023-09-13 16:19:25 -07:00
Michael Kim
2dc3c64386
Adding headers for accessing pdf file url (#10370)
- Description: Set up 'file_headers' params for accessing pdf file url
  - Tag maintainer: @hwchase17 

 make format, make lint, make test

---------

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-09-13 16:09:38 -07:00
Renze Yu
a34510536d
Improve code example indent (#10490) 2023-09-13 14:59:10 -07:00
Ali Soliman
bcf130c07c
Fix Import BedrockChat (#10485)
- Description: Couldn't import BedrockChat from the chat_models
  - Issue: the issue # it fixes (if applicable),
  - Dependencies: N/A
  - Issues: #10468

---------

Co-authored-by: Ali Soliman <alisaws@amazon.nl>
Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-09-13 14:58:47 -07:00
Stefano Lottini
415d38ae62
Cassandra Vector Store, add metadata filtering + improvements (#9280)
This PR addresses a few minor issues with the Cassandra vector store
implementation and extends the store to support Metadata search.

Thanks to the latest cassIO library (>=0.1.0), metadata filtering is
available in the store.

Further,
- the "relevance" score is prevented from being flipped in the [0,1]
interval, thus ensuring that 1 corresponds to the closest vector (this
is related to how the underlying cassIO class returns the cosine
difference);
- bumped the cassIO package version both in the notebooks and the
pyproject.toml;
- adjusted the textfile location for the vector-store example after the
reshuffling of the Langchain repo dir structure;
- added demonstration of metadata filtering in the Cassandra vector
store notebook;
- better docstring for the Cassandra vector store class;
- fixed test flakiness and removed offending out-of-place escape chars
from a test module docstring;

To my knowledge all relevant tests pass and mypy+black+ruff don't
complain. (mypy gives unrelated errors in other modules, which clearly
don't depend on the content of this PR).

Thank you!
Stefano

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-09-13 14:18:39 -07:00
Bagatur
49694f6a3f
explicitly check openllm return type (#10560)
cc @aarnphm
2023-09-13 14:13:15 -07:00
Joshua Sundance Bailey
85e05fa5d6
ArcGISLoader: add keyword arguments, error handling, and better tests (#10558)
* More clarity around how geometry is handled. Not returned by default;
when returned, stored in metadata. This is because it's usually a waste
of tokens, but it should be accessible if needed.
* User can supply layer description to avoid errors when layer
properties are inaccessible due to passthrough access.
* Enhanced testing
* Updated notebook

---------

Co-authored-by: Connor Sutton <connor.sutton@swca.com>
Co-authored-by: connorsutton <135151649+connorsutton@users.noreply.github.com>
2023-09-13 14:12:42 -07:00
Aaron Pham
ac9609f58f
fix: unify generation outputs on newer openllm release (#10523)
update newer generation format from OpenLLm where it returns a
dictionary for one shot generation

cc @baskaryan 

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>

---------

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
2023-09-13 13:49:16 -07:00
Aashish Saini
201b61d5b3
Fixed Import Error type in base.py (#10209)
I have revamped the code to ensure uniform error handling for
ImportError. Instead of the previous reliance on ValueError, I have
adopted the conventional practice of raising ImportError and providing
informative error messages. This change enhances code clarity and
clearly signifies that any problems are associated with module imports.
2023-09-13 12:12:58 -07:00