Last active
August 19, 2024 17:07
-
-
Save ddanielsantos/e252670ab43db2757a484de75853f36e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function generate_embeddings(input) { | |
const response = await fetch('http://localhost:11434/api/embeddings', { | |
method: 'POST', | |
body: JSON.stringify({ model: 'nomic-embed-text', prompt: input }), | |
headers: { "Content-Type": "application/json" }, | |
}); | |
const response_json = await response.json(); | |
return response_json.embedding; | |
} | |
(async () => { | |
const embeddings = await generate_embeddings("my awesome string is made up of chars"); | |
console.log(embeddings) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment