Added semantic episode searching
This commit is contained in:
18
packages/orchestration-service/src/services/embedding.js
Normal file
18
packages/orchestration-service/src/services/embedding.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const {getEnv, SERVICES } = require('@nexusai/shared')
|
||||
|
||||
const BASE_URL = getEnv('EMBEDDING_SERVICE_URL', SERVICES.EMBEDDING_URL);
|
||||
|
||||
async function embed(text) {
|
||||
const res = await fetch(`${BASE_URL}/embed`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({text}),
|
||||
})
|
||||
|
||||
if (!res.ok) throw new Error(`Embedding service error: ${res.status}`);
|
||||
|
||||
const data = await res.json();
|
||||
return data.embedding;
|
||||
}
|
||||
|
||||
module.exports = { embed };
|
||||
Reference in New Issue
Block a user