Skip to content

Death-Raider/VectorEmbedding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prompt Embedding API for Semantic Search in Vector Databases

Hosts Hugging-Face sentence-transformers, which are specifically trained for embedding creation, on local host (127.0.0.1) at port 3000.

Install requirements

pip install -r requirements.txt

Run API

python3 API.py

Fetch Request

Destination: localhost:3000/vectorEmbeddings
Method: POST
Body: JSON object

fetch('http://localhost:3000/vectorEmbeddings', {
  method: 'POST',
  mode: 'no-cors',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    product_name: "Smartphone X",
    product_description: "A high-end smartphone with a powerful processor",
    product_category: "Electronics",
    product_cost: 799.99,
    product_id: "P1234"
  })
})
.then(response => {
  if (!response.ok) {
    throw new Error('Network response was not ok');
  }
  return response.json();
})
.then(data => { console.log(data) })
.catch(error => {  console.error('Error:', error) });

Return Data

Returns a JSON object with the same details as the POST body with two new keys:

  • vector: Embedding Vector
  • inferenceTime: Time taken for the model to generate the embedding vector

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages