mirror of
https://github.com/perstarkse/minne.git
synced 2026-04-01 07:03:10 +02:00
refactor: add openai client and improve reference handling
This commit is contained in:
@@ -12,7 +12,6 @@ use crate::{
|
||||
use futures::future::{try_join, try_join_all};
|
||||
use std::collections::HashMap;
|
||||
use surrealdb::{engine::remote::ws::Client, Surreal};
|
||||
use tracing::info;
|
||||
|
||||
/// Performs a comprehensive knowledge entity retrieval using multiple search strategies
|
||||
/// to find the most relevant entities for a given query.
|
||||
@@ -37,14 +36,14 @@ use tracing::info;
|
||||
pub async fn combined_knowledge_entity_retrieval(
|
||||
db_client: &Surreal<Client>,
|
||||
openai_client: &async_openai::Client<async_openai::config::OpenAIConfig>,
|
||||
query: String,
|
||||
query: &str,
|
||||
) -> Result<Vec<KnowledgeEntity>, ProcessingError> {
|
||||
info!("Received input: {:?}", query);
|
||||
// info!("Received input: {:?}", query);
|
||||
|
||||
let (items_from_knowledge_entity_similarity, closest_chunks) = try_join(
|
||||
find_items_by_vector_similarity(
|
||||
10,
|
||||
query.clone(),
|
||||
query,
|
||||
db_client,
|
||||
"knowledge_entity".to_string(),
|
||||
openai_client,
|
||||
|
||||
@@ -24,7 +24,7 @@ use crate::{error::ProcessingError, utils::embedding::generate_embedding};
|
||||
/// * `T`: The type to deserialize the query results into. Must implement `serde::Deserialize`.
|
||||
pub async fn find_items_by_vector_similarity<T>(
|
||||
take: u8,
|
||||
input_text: String,
|
||||
input_text: &str,
|
||||
db_client: &Surreal<Client>,
|
||||
table: String,
|
||||
openai_client: &async_openai::Client<async_openai::config::OpenAIConfig>,
|
||||
|
||||
Reference in New Issue
Block a user