Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DON'T MERGE] Langchain Integration #1312

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

yuce
Copy link
Contributor

@yuce yuce commented Oct 2, 2024

Adds LangChaing integration for Python docs.

I've added a top-level LangChain navigation item under "Integrate", but I will also add a LangChain tutorial later and we may have more LangChain integrations.
Can the page introduced in this PR serve as the parent page for those?

Copy link

netlify bot commented Oct 2, 2024

Deploy Preview for hardcore-allen-f5257d ready!

Name Link
🔨 Latest commit 422ee17
🔍 Latest deploy log https://app.netlify.com/sites/hardcore-allen-f5257d/deploys/670fcaea5c51d80008764717
😎 Deploy Preview https://deploy-preview-1312--hardcore-allen-f5257d.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@amandalindsay amandalindsay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor copy edit, looks good.

== Updating the Vector Store

Once the vector store is created, you can start adding LangChain documents or string data into it.
While adding the data, you have the option to associate identifiers and metadata with them.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
While adding the data, you have the option to associate identifiers and metadata with them.
While adding the data, you have the option to associate identifiers and metadata with it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data plural isn't wrong, just think this is more elegant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Amanda,
Updated at: cfce797

----

`Hazelcast.add_texts` method returns the IDs of the added texts.
If the IDs were not provided to the `add_texts` method, then they are automatically genereated, like in the example above.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If the IDs were not provided to the `add_texts` method, then they are automatically genereated, like in the example above.
If the IDs were not provided to the `add_texts` method, then they are automatically generated, like in the example above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated at: cfce797

If the IDs were not provided to the `add_texts` method, then they are automatically genereated, like in the example above.

You can provide the IDs manually by passing them in the `ids` parameter.
That may be useful in case you would like to update data instead of extending the vector store.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
That may be useful in case you would like to update data instead of extending the vector store.
This is useful when you want to update data instead of extending the vector store.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated at: cfce797

)
----

In case you have `langchain_core.documents.Document` objects, you can use the `add_documents` methods to add them to the vector store:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In case you have `langchain_core.documents.Document` objects, you can use the `add_documents` methods to add them to the vector store:
If you have `langchain_core.documents.Document` objects, you can use the `add_documents` methods to add them to the vector store:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated at: cfce797

----

`Hazelcast` vector store has two class methods that combine creating the vector store and adding texts or documents to it.
Those are `Hazelcast.from_texts` and `Hazelcast.from_documents` methods respectively.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Those are `Hazelcast.from_texts` and `Hazelcast.from_documents` methods respectively.
These are the `Hazelcast.from_texts` and `Hazelcast.from_documents` methods, respectively.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated at: cfce797


`Hazelcast` vector store has two class methods that combine creating the vector store and adding texts or documents to it.
Those are `Hazelcast.from_texts` and `Hazelcast.from_documents` methods respectively.
Calling these methods return the `Hazelcast` vector store instance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Calling these methods return the `Hazelcast` vector store instance.
Calling these methods returns the `Hazelcast` vector store instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated at: cfce797

----

To delete some or all Documents, you can use the `delete` method.
It deletes the Documents with the given IDs if one or more IDs provided, or deletes all Documents if no IDs are provided.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It deletes the Documents with the given IDs if one or more IDs provided, or deletes all Documents if no IDs are provided.
It deletes the Documents with the given IDs if one or more IDs are provided, or deletes all Documents if no IDs are provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated at: cfce797

@yuce yuce changed the title Langchain Integration [DON'T MERGE] Langchain Integration Oct 16, 2024
@yuce
Copy link
Contributor Author

yuce commented Oct 16, 2024

@amandalindsay Thanks for the review.
Just a note: we will hold merging this PR until our Python package for LangChain is published.


`langchain-hazelcast` package provides the Hazelcast `VectorStore` implementation for LangChain.

== Installing LangChain/Hazelcast Vector Store
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes Vector Store uses initial caps, sometimes it's all lower case. Is it a proper name (in which case it should be 'Vector Store')?


You can retrieve Documents in the vector store using the `get_by_ids` method.
This method takes a sequence of IDs and returns the corresponding Documents if they exist.
Note that, the order of the IDs and the returned Documents may not be the same:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Note that, the order of the IDs and the returned Documents may not be the same:
Note that the order of the IDs and the returned Documents may not be the same:

Copy link
Contributor

@amandalindsay amandalindsay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple of minor suggestions, the main one being that we need to be consistent with the capitalization of vector store throughout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants