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

Weaviate vector store #708

Merged
merged 9 commits into from
Apr 14, 2023
Merged

Conversation

JHeidinga
Copy link
Contributor

Basic implementation of the Weaviate vector store

@vercel
Copy link

vercel bot commented Apr 10, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview Apr 14, 2023 4:30pm

@@ -0,0 +1,146 @@
import { IWeaviateClient } from "weaviate-ts-client";
Copy link

Choose a reason for hiding this comment

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

In the latest version of the ts-client this was changed to WeaviateClient. I suggested a change which wouldn't require an update in the rest of the code, but ideally, everything should be renamed to WeaviateClient

Suggested change
import { IWeaviateClient } from "weaviate-ts-client";
import { type WeaviateClient as IWeaviateClient } from "weaviate-ts-client";

Copy link
Contributor Author

@JHeidinga JHeidinga left a comment

Choose a reason for hiding this comment

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

Thanx for your feedback and review! Looks good to me...

@nfcampos nfcampos self-assigned this Apr 14, 2023
@nfcampos
Copy link
Collaborator

Thanks!

@nfcampos
Copy link
Collaborator

nfcampos commented Apr 14, 2023

To do

  • An integration test
  • An example
  • Docs page

@heresandyboy
Copy link

Very interested in this, I could really do with switching from Pinecone to Weaviate as Pinecone indexes are currently taking hours to init, on my free account!

@heresandyboy
Copy link

heresandyboy commented Apr 14, 2023

EDIT: Ah nevermind, just as I was typing this I see you have added fromExistingIndex great stuff

Original Question

Quick question, I am working though implementing your weaviate vectorstore directly in my code from your weaviate.ts to get a bit of a head start on migrating away from Pinecone.

It would be easier for me and others to switch to weaviate, if you could closely match the Pinecone implementation: langchain/vectorstores/pinecone, to make the migration easier.
Where possible of course.

For example, how can I re-use a weaviate class/index to make a chain similar to how I was with pinecone?

    const vectorStore = await PineconeStore.fromExistingIndex(
      new OpenAIEmbeddings({}),
      {
        pineconeIndex: index,
        textKey: 'text',
        namespace: PINECONE_NAME_SPACE,
      },
    );

    //create chain
    const chain = makeChain(vectorStore);
    //Ask a question using chat history
    const response = await chain.call({
      question: sanitizedQuestion,
      chat_history: history || [],
    });

I see you are still adding features, I'll likely take each commit for a spin, happy to provide feedback once I'm at a point where I can run my code again.

@nfcampos
Copy link
Collaborator

@heresandyboy like this, any questions let me know https://github.com/hwchase17/langchainjs/pull/708/files#diff-7864057947ac7ae65f05b0d922c5c915bab5c41fe4f82b351b05dfeeb512e2d0

@heresandyboy
Copy link

heresandyboy commented Apr 14, 2023

@heresandyboy like this, any questions let me know https://github.com/hwchase17/langchainjs/pull/708/files#diff-7864057947ac7ae65f05b0d922c5c915bab5c41fe4f82b351b05dfeeb512e2d0

Yep, thanks! I just spotted your check-in and found that after I'd posted, I was a bit quick to try and get this implemented. You've really come to the rescue with this PR! My demo may yet be saved!

Edit:
Just asRetriever(k?: number): BaseRetriever; implementation from VectorStore left and I should be up and running hopefully!

@nfcampos nfcampos merged commit a0f9b5c into langchain-ai:main Apr 14, 2023
RohitMidha23 pushed a commit to RohitMidha23/langchainjs that referenced this pull request Apr 18, 2023
* Implemented review comments

* Update dep range

* Implement missing methods, add filtering

* Add entrypoint

* Add docs, add examples, improve the types

* Disable the test

* Add fromExistingIndex

* Update example

---------

Co-authored-by: Jasper Heidinga <jasper@Jaspers-MBP-2.localdomain>
Co-authored-by: Nuno Campos <nuno@boringbits.io>
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.

4 participants