Skip to content

Feature (change?) request: Allow searching with embedding #60

Description

@joan-teriihoania

Hello @techiejd,

Note

First time here. Looking for ways to contribute. Also, I'm not that familiar with embeddings. I know the basics, but do let me know if what I'm saying isn't feasible. Or just plain doesn't work.

At the moment, vectorSearch only takes a query string which is itself converted into an embedding. Would it make sense to allow embedding search instead of only string, at least for internal uses (I can see why passing a vector in a REST call may not be the best). So maybe a query type like this:

type Query = string | ReturnType<EmbedQueryFn>

And instead of:

const queryEmbedding = await (async () => {
  const qE = await poolConfig.embeddingConfig.queryFn(query)
  return Array.isArray(qE) ? qE : Array.from(qE)
})()

We have:

const queryEmbedding = Array.isArray(query)
  ? await query
  : await (async () => {
      const qE = await poolConfig.embeddingConfig.queryFn(query)
      return Array.isArray(qE) ? qE : Array.from(qE)
    })()

We could even allow passing an embedding ID altogether since knowledge pools are collections themselves, so retrieving a document within the vector search would fall under their scope. Although, we would need to expose a getEmbedding function to make the process easier.

Let me know your thoughts!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions