Embeddings

An embedding is a vector representation of a text, image, audio, etc.

Parameters

Hugging Face API (Inference API)

Example: Text Generation

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);