Embeddings
An embedding is a vector representation of a text, image, audio, etc.
Parameters
- sequence length: input size
- retreival: search performance metric
Hugging Face API (Inference API)
- using the Inference API
- Referecence timestamp 29:22
- Hugging Face JS docs
Example: Text Generation
npm i @huggingface/inference dotenv- pacakge.json: add
"type": "module",
import { HfInference } from "@huggingface/inference";
import * as dotenv from "dotenv";
dotenv.config();
const hf = new HfInference(process.env.HF_TOKEN);
const output = await hf.textGeneration({
model: "mistralai/Mistral-7B-Instruct-v0.3",
inputs: "What is 2+2?",
});
console.log(output);