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

feat: add tidb vector store #656

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Mini256
Copy link

@Mini256 Mini256 commented Mar 19, 2024

No description provided.

Copy link

changeset-bot bot commented Mar 19, 2024

⚠️ No Changeset found

Latest commit: bdc2629

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Mar 19, 2024

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

Name Status Preview Comments Updated (UTC)
llama-index-ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 17, 2024 10:07am

Copy link
Collaborator

@marcusschiesser marcusschiesser left a comment

Choose a reason for hiding this comment

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

@Mini256 looking great! Thanks for your contribution. Please have a look at my comments and if you have time it would be great if you could add an example to the /examples folder

packages/core/src/storage/vectorStore/TiDBVectorStore.ts Outdated Show resolved Hide resolved
Comment on lines +52 to +55
this.tableName = config?.tableName ?? TIDB_VECTOR_TABLE;
this.namespace = config?.namespace ?? "";
this.dimensions = config?.dimensions ?? 1536;
this.poolOptions = config?.poolOptions ?? {};
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can use Object.assign to copy the config to this (then you don't need to duplicate your default values)

? [refDocId, this.namespace]
: [refDocId];
await db.query(sql, params);
return Promise.resolve();
Copy link
Collaborator

Choose a reason for hiding this comment

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

no-op

/**
* Provides support for writing and querying vector data in TiDB.
*/
export class TiDBVectorStore implements VectorStore {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Author

@Mini256 Mini256 Apr 17, 2024

Choose a reason for hiding this comment

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

OK, I will make some adjustments to be consistent with the Python version.

* @param options Required by VectorStore interface. Currently ignored.
* @returns Zero or more Document instances with data from the vector store.
*/
async query(
Copy link
Collaborator

Choose a reason for hiding this comment

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

We're using metadataDictToNode and nodeToMetadata from "./utils.js" to de/serialize the node in the metadata. You can reference the other vector store implementations to have a look into this.

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.

None yet

2 participants