Install
Prerequisites
Section titled “Prerequisites”Before using this integration, you’ll need:
- Upstash Account: Sign up at upstash.com and create a Search Database
- OpenAI API Key: Get your API key from platform.openai.com
Required Environment Variables
Section titled “Required Environment Variables”Create a .env file in your project root:
UPSTASH_SEARCH_REST_URL=your_upstash_rest_urlUPSTASH_SEARCH_REST_TOKEN=your_upstash_rest_tokenOPENAI_API_KEY=your_openai_api_keyInstallation
Section titled “Installation”Install the integration automatically using the Astro CLI:
pnpm astro add astro-chatty-gptnpx astro add astro-chatty-gptyarn astro add astro-chatty-gptOr install it manually:
- Install the required dependencies
pnpm add astro-chatty-gptnpm install astro-chatty-gptyarn add astro-chatty-gpt- Add the integration to your astro config
import AstroChattyGpt from "astro-chatty-gpt";import { loadEnv } from "vite";const env = loadEnv("", process.cwd(), "");
export default defineConfig({ integrations: [ AstroChattyGpt({ upstashUrl: env.UPSTASH_SEARCH_REST_URL!, upstashToken: env.UPSTASH_SEARCH_REST_TOKEN!, openAiKey: env.OPENAI_API_KEY!, maxOutputTokens: 500, excludeRoutes: ['admin/', 'private/'], maxContextDocs: 10, maxContentLength: 2000, contentTag: 'main', searchLimit: 10, excludeTags: ['.sidebar', '.ads', '.navigation'], botName: 'AstroChattyGpt', systemPrompt: 'You are a helpful assistant for my website.', }), ],});