- Notifications
You must be signed in to change notification settings - Fork8
A Go implementation of Vercel's AI SDK Data Stream Protocol.
License
NotificationsYou must be signed in to change notification settings
coder/aisdk-go
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Warning
This library is super new and may change a lot.
A Go implementation of Vercel's AI SDKData Stream Protocol.
- Supports OpenAI, Google, and Anthropic (with Bedrock support)
- Examples for integrating
useChat - Chain tool usage in Go, just like
maxSteps
// frontend.tsxconst{ messages}=useChat({// Points to our Go backend!api:"/api/chat",})
// backend.go// Accept the POST request...varreq*aisdk.Chatmessages,err:=aisdk.MessagesToOpenAI(req.Messages)iferr!=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)
Run tests withgo test. Start theuseChat demo with:
# any or all of these can be setexport OPENAI_API_KEY=<api-key>export ANTHROPIC_API_KEY=<api-key>export GOOGLE_API_KEY=<api-key>cd demobun ibun dev
About
A Go implementation of Vercel's AI SDK Data Stream Protocol.
Topics
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.