Commit Graph

4667 Commits

Author SHA1 Message Date
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
48a4efc51a
Bagatur/update replicate nb (#10605) 2023-09-14 15:21:42 -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
Aashish Saini
7608f85f13
Removed duplicate heading (#10570)
**I recently reviewed the content and identified that there heading
appeared twice on the docs.**
2023-09-14 12:35:37 -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
ItzPAX
cbb4860fcd
fix typo in aleph_alpha.ipynb (#10478)
fixes the aleph_alpha.ipynb typo from contnt to content
2023-09-13 17:09:11 -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
Leonid Ganeline
f4e6eac3b6
docs: self-query consistency (#10502)
The `self-que[ring`
navbar](https://python.langchain.com/docs/modules/data_connection/retrievers/self_query/)
has repeated `self-quering` repeated in each menu item. I've simplified
it to be more readable
- removed `self-quering` from a title of each page;
- added description to the vector stores
- added description and link to the Integration Card
(`integrations/providers`) of the vector stores when they are missed.
2023-09-13 14:43:04 -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
volodymyr-memsql
a43abf24e4
Fix SingleStoreDB (#10534)
After the refactoring #6570, the DistanceStrategy class was moved to
another module and this introduced a bug into the SingleStoreDB vector
store, as the `DistanceStrategy.EUCLEDIAN_DISTANCE` started to convert
into the 'DistanceStrategy.EUCLEDIAN_DISTANCE' string, instead of just
'EUCLEDIAN_DISTANCE' (same for 'DOT_PRODUCT').

In this change, I check the type of the parameter and use `.name`
attribute to get the correct object's name.

---------

Co-authored-by: Volodymyr Tkachuk <vtkachuk-ua@singlestore.com>
2023-09-13 12:09:46 -07:00
wxd
f9636b6cd2
add vearch repository link (#10491)
- Description: add vearch repository link
2023-09-13 12:06:47 -07:00
Tom Piaggio
d1f2075bde
Fix GoogleEnterpriseSearchRetriever (#10546)
Replace this entire comment with:
- Description: fixed Google Enterprise Search Retriever where it was
consistently returning empty results,
- Issue: related to [issue
8219](https://github.com/langchain-ai/langchain/issues/8219),
  - Dependencies: no dependencies,
  - Tag maintainer: @hwchase17 ,
  - Twitter handle: [Tomas Piaggio](https://twitter.com/TomasPiaggio)!
2023-09-13 11:45:07 -07:00
berkedilekoglu
73b9ca54cb
Using batches for update document with a new function in ChromaDB (#6561)
2a4b32dee2/langchain/vectorstores/chroma.py (L355-L375)

Currently, the defined update_document function only takes a single
document and its ID for updating. However, Chroma can update multiple
documents by taking a list of IDs and documents for batch updates. If we
update 'update_document' function both document_id and document can be
`Union[str, List[str]]` but we need to do type check. Because
embed_documents and update functions takes List for text and
document_ids variables. I believe that, writing a new function is the
best option.

I update the Chroma vectorstore with refreshed information from my
website every 20 minutes. Updating the update_document function to
perform simultaneous updates for each changed piece of information would
significantly reduce the update time in such use cases.

For my case I update a total of 8810 chunks. Updating these 8810
individual chunks using the current function takes a total of 8.5
minutes. However, if we process the inputs in batches and update them
collectively, all 8810 separate chunks can be updated in just 1 minute.
This significantly reduces the time it takes for users of actively used
chatbots to access up-to-date information.

I can add an integration test and an example for the documentation for
the new update_document_batch function.

@hwchase17 

[berkedilekoglu](https://twitter.com/berkedilekoglu)
2023-09-13 11:39:56 -07:00
Leonid Ganeline
db3369272a
fixed PR template (#10515)
@hwchase17
2023-09-13 09:35:48 -07:00
Bagatur
1835624bad
bump 288 (#10548) 2023-09-13 08:57:43 -07:00
Bagatur
303724980c
Add ElevenLabs text to speech tool (#10525) 2023-09-12 23:11:04 -07:00
Bagatur
79a567d885 Refactor elevenlabs tool 2023-09-12 23:01:00 -07:00
Bagatur
97122fb577
Integration with ElevenLabs text to speech (#10181)
- Description: adds integration with ElevenLabs text-to-speech
[component](https://github.com/elevenlabs/elevenlabs-python) in the
similar way it has been already done for [azure cognitive
services](https://github.com/langchain-ai/langchain/blob/master/libs/langchain/langchain/tools/azure_cognitive_services/text2speech.py)
  - Dependencies: elevenlabs
  - Twitter handle: @deepsense_ai, @matt_wosinski
- Future plans: refactor both implementations in order to avoid dumping
speech file, but rather to keep it in memory.
2023-09-12 22:56:53 -07:00
Bagatur
eaf916f999
Allow replicate prompt key to be manually specified (#10516)
Since inference logic doesn't work for all models

Co-authored-by: Taqi Jaffri <tjaffri@gmail.com>
Co-authored-by: Taqi Jaffri <tjaffri@docugami.com>
2023-09-12 15:52:13 -07:00
Bagatur
7ecee7821a Replicate fix linting 2023-09-12 15:46:36 -07:00
Taqi Jaffri
21fbbe83a7
Fix fine-tuned replicate models with faster cold boot (#10512)
With the latest support for faster cold boot in replicate
https://replicate.com/blog/fine-tune-cold-boots it looks like the
replicate LLM support in langchain is broken since some internal
replicate inputs are being returned.

Screenshot below illustrates the problem:

<img width="1917" alt="image"
src="https://github.com/langchain-ai/langchain/assets/749277/d28c27cc-40fb-4258-8710-844c00d3c2b0">

As you can see, the new replicate_weights param is being sent down with
x-order = 0 (which is causing langchain to use that param instead of
prompt which is x-order = 1)

FYI @baskaryan this requires a fix otherwise replicate is broken for
these models. I have pinged replicate whether they want to fix it on
their end by changing the x-order returned by them.

Update: per suggestion I updated the PR to just allow manually setting
the prompt_key which can be set to "prompt" in this case by callers... I
think this is going to be faster anyway than trying to dynamically query
the model every time if you know the prompt key for your model.

---------

Co-authored-by: Taqi Jaffri <tjaffri@docugami.com>
2023-09-12 15:40:55 -07:00
William FH
57e2de2077
add avg feedback (#10509)
in run_on_dataset agg feedback printout
2023-09-12 14:05:18 -07:00
Bagatur
f7f3c02585
bump 287 (#10498) 2023-09-12 08:06:47 -07:00
Bagatur
6598178343
Chat model stream readability nit (#10469) 2023-09-11 18:05:24 -07:00
Riyadh Rahman
d45b042d3e
Added gitlab toolkit and notebook (#10384)
### Description

Adds Gitlab toolkit functionality for agent

### Twitter handle

@_laplaceon

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-09-11 16:16:50 -07:00
Nante Nantero
41047fe4c3
fix(DynamoDBChatMessageHistory): correct delete_item method call (#10383)
**Description**: 
Fixed a bug introduced in version 0.0.281 in
`DynamoDBChatMessageHistory` where `self.table.delete_item(self.key)`
produced a TypeError: `TypeError: delete_item() only accepts keyword
arguments`. Updated the method call to
`self.table.delete_item(Key=self.key)` to resolve this issue.

Please see also [the official AWS
documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/delete_item.html#)
on this **delete_item** method - only `**kwargs` are accepted.

See also the PR, which introduced this bug:
https://github.com/langchain-ai/langchain/pull/9896#discussion_r1317899073

Please merge this, I rely on this delete dynamodb item functionality
(because of GDPR considerations).

**Dependencies**: 
None

**Tag maintainer**: 
@hwchase17 @joshualwhite 

**Twitter handle**: 
[@BenjaminLinnik](https://twitter.com/BenjaminLinnik)
Co-authored-by: Benjamin Linnik <Benjamin@Linnik-IT.de>
2023-09-11 16:16:20 -07:00
Pavel Filatov
30c9d97dda
Remove HuggingFaceDatasetLoader duplicate entry (#10394) 2023-09-11 15:58:24 -07:00
fyasla
55196742be
Fix of issue: (#10421)
DOC: Inversion of 'True' and 'False' in ConversationTokenBufferMemory
Property Comments #10420
2023-09-11 15:51:37 -07:00
John Mai
b50d724114
Supported custom ernie_api_base for Ernie (#10416)
Description: Supported custom ernie_api_base for Ernie
 - ernie_api_base:Support Ernie custom endpoints
 - Rectifying omitted code modifications. #10398

Issue: None
Dependencies: None
Tag maintainer: @baskaryan 
Twitter handle: @JohnMai95
2023-09-11 15:50:07 -07:00
Bagatur
70b6897dc1
Mv vearch provider doc (#10466) 2023-09-11 15:00:40 -07:00
James Barney
50128c8b39
Adding File-Like object support in CSV Agent Toolkit (#10409)
If loading a CSV from a direct or temporary source, loading the
file-like object (subclass of IOBase) directly allows the agent creation
process to succeed, instead of throwing a ValueError.

Added an additional elif and tweaked value error message.
Added test to validate this functionality.

Pandas from_csv supports this natively but this current implementation
only accepts strings or paths to files.
https://pandas.pydata.org/docs/user_guide/io.html#io-read-csv-table

---------

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-09-11 14:57:59 -07:00
Bagatur
999163fbd6
Add HF prompt injection detection (#10464) 2023-09-11 14:56:42 -07:00