Initialize LLM providers
mainLLM Scraper uses the Vercel AI SDK. You must install the specific provider package for the model you intend to use and initialize the LLM instance.
OpenAI
Install: npm i @ai-sdk/openai
import { openai } from '@ai-sdk/openai'
const llm = openai('gpt-4o')Anthropic
Install: npm i @ai-sdk/anthropic
import { anthropic } from '@ai-sdk/anthropic'
const llm = anthropic('claude-3-5-sonnet-20240620')Install: npm i @ai-sdk/google
import { google } from '@ai-sdk/google'
const llm = google('gemini-1.5-flash')Groq
Install: npm i @ai-sdk/openai
import { createOpenAI } from '@ai-sdk/openai'
const groq = createOpenAI({
baseURL: 'https://api.groq.com/openai/v1',
apiKey: process.env.GROQ_API_KEY,
})
const llm = groq('llama3-8b-8192')Ollama
Install: npm i ollama-ai-provider-v2
import { ollama } from 'ollama-ai-provider-v2'
const llm = ollama('llama3')