Skip to content

Instantly share code, notes, and snippets.

@ianmacartney
ianmacartney / llm.ts
Last active December 5, 2024 16:30
Implementation of chat completions and embeddings for any OpenAI-compliant services, using browser fetch and no imports/dependencies
export const CONFIG = {
// Together AI:
url: "https://api.together.xyz",
chatModel: "meta-llama/Llama-3-8b-chat-hf",
embeddingModel: "togethercomputer/m2-bert-80M-8k-retrieval", // dim 768
// OpenAI:
// url: "https://api.openai.com",
// chatModel: "gpt-4o",
// embeddingModel: "text-embedding-ada-002", // dim 1536
};