# Install via npmnpm install @latitude-data/sdk# Or via yarnyarn add @latitude-data/sdk# Or via pnpmpnpm add @latitude-data/sdk
Initialize the SDK in your code:
Copy
Ask AI
import { Latitude } from '@latitude-data/sdk'const latitude = new Latitude('your_api_key')// For self-hosted instances, specify options:// const latitude = new Latitude('your_api_key', {// projectId: 123,// // Other options...// })
const prompt = await latitude.prompts.getOrCreate('/path/to/new/prompt', { prompt: { name: 'Customer Support Assistant', content: ` --- provider: Latitude model: gpt-4o --- You are a helpful customer support assistant for a software company. Customer query: {{query}} Product: {{product}} Provide a helpful, friendly response that addresses the customer's question. Include relevant product details when necessary.`, provider: 'openai', // Other prompt properties as needed },})