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

Make ahnlich-ai extensible (1): Decouple DB #174

Open
deven96 opened this issue Dec 16, 2024 · 1 comment
Open

Make ahnlich-ai extensible (1): Decouple DB #174

deven96 opened this issue Dec 16, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@deven96
Copy link
Owner

deven96 commented Dec 16, 2024

At the moment, the AI proxy is tightly coupled to ahnlich-db. For it to truly be extensible, it would have to be able to

  • Return embeddings for raw inputs without having to save within DB. For this, we would have to make an extra endpoint that simply does raw input to embedding conversions and hence doesn't need the binary started with a running DB. Currently we have
let db_client = Self::build_db_client(&config).await
...
AIProxyServer {
    db_client: Arc::new(db_client),
    ...
}
// .. where AIProxyServer struct is 

struct AIProxyServer {
  db_client: Arc<DbClient>,
}

If that is changed to

struct AIProxyServer {
  db_client: Option<Arc<DbClient>>,
 ...
}

and for all queries within the handler that absolutely need it like create_store, throw up an error if db_client is None. Then a new query we can call input_to_embeddings that could look something like

enum AIQuery {
 InputToEmbeddings {
  inputs: Vec<StoreInput>,
  preprocess_action: PreprocessAction,
  model: AIModel,
 },
 ...
}


enum AIServerResponse {
 // Vector of embeddings matching the length of Vec<StoreInput>
 Embeddings(Vec<Array1<f32>>),
 ...
}

A check to then ensure that all StoreInput's input type match the AIModel's input type is sufficient... and finally calling ModelManager::handle_request to return the StoreKey

@deven96 deven96 added enhancement New feature or request help wanted Extra attention is needed labels Dec 16, 2024
@deven96 deven96 changed the title Make ahnlich-ai extensible Make ahnlich-ai extensible (1): Decouple DB Jan 5, 2025
@opeolluwa
Copy link

@deven96 can you assign this to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants