### Setting Up and Running the Demo - Bash Source: https://github.com/kylecarbs/aisdk-go/blob/main/README.md This bash script shows the necessary steps to set up and run the demo application. It involves exporting API keys for different AI providers, navigating to the demo directory, installing dependencies using `bun`, and starting the development server. ```bash # any or all of these can be set export OPENAI_API_KEY= export ANTHROPIC_API_KEY= export GOOGLE_API_KEY= cd demo bun i bun dev ``` -------------------------------- ### Handling Chat Request and Streaming Response - Go Source: https://github.com/kylecarbs/aisdk-go/blob/main/README.md This Go backend snippet illustrates processing an incoming chat request, converting messages for an OpenAI API call, creating an AI SDK Data Stream from the HTTP response writer, and piping the streaming response from the OpenAI client to the data stream. ```go // backend.go // Accept the POST request... var req *aisdk.Chat messages, err := aisdk.MessagesToOpenAI(req.Messages) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } // Convert the http.ResponseWriter to a Data Stream. dataStream := aisdk.NewDataStream(w) stream := openaiClient.Chat.Completions.NewStreaming(...) aisdk.PipeOpenAIToDataStream(stream, dataStream) ``` -------------------------------- ### Connecting Frontend useChat to Go Backend - TypeScript Source: https://github.com/kylecarbs/aisdk-go/blob/main/README.md This snippet demonstrates how a frontend application using the Vercel AI SDK's `useChat` hook configures its API endpoint to point to a Go backend server, enabling communication for chat interactions. ```typescript const { messages } = useChat({ // Points to our Go backend! api: "/api/chat", }) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.