🌐
GitHub
github.com › anthropics › anthropic-sdk-go
GitHub - anthropics/anthropic-sdk-go: Access to Anthropic's safety-first language model APIs via Go
p := anthropic.ExampleParams{ ID: "id_xxx", // required property Name: anthropic.String("..."), // optional property Point: anthropic.Point{ X: 0, // required field will serialize as 0 Y: anthropic.Int(1), // optional field will serialize as 1 // ...
Starred by 650 users
Forked by 81 users
Languages   Go
🌐
Go Packages
pkg.go.dev › github.com › adamchol › go-anthropic-sdk
anthropic package - github.com/adamchol/go-anthropic-sdk - Go Packages
package main import ( "context" "encoding/base64" "fmt" "log" "os" "github.com/adamchol/go-anthropic-sdk" ) func main() { client := anthropic.NewClient("your-token") imageBytes, err := os.ReadFile("ant.jpg") if err != nil { log.Fatalf("Failed to read image file: %v", err) } imgData := base64.StdEncoding.EncodeToString(imageBytes) // Encoding the image into base64 resp, err := client.CreateMessage(context.Background(), anthropic.MessageRequest{ Model: anthropic.Claude35SonnetModel, Messages: []anthropic.InputMessage{ { Role: "user", ContentBlocks: []anthropic.ContentBlock{ // Using ContentBlock
🌐
GitHub
github.com › liushuangls › go-anthropic
GitHub - liushuangls/go-anthropic: Anthropic Claude API wrapper for Go
package main import ( "errors" "fmt" "github.com/liushuangls/go-anthropic/v2" ) func main() { client := anthropic.NewClient("your anthropic api key") resp, err := client.CreateMessages(context.Background(), anthropic.MessagesRequest{ Model: anthropic.ModelClaude3Haiku20240307, Messages: []anthropic.Message{ anthropic.NewUserTextMessage("What is your name?"), }, MaxTokens: 1000, }) if err != nil { var e *anthropic.APIError if errors.As(err, &e) { fmt.Printf("Messages error, type: %s, message: %s", e.Type, e.Message) } else { fmt.Printf("Messages error: %v\n", err) } return } fmt.Println(resp.Content[0].GetText()) }
Starred by 161 users
Forked by 24 users
Languages   Go
🌐
Go Packages
pkg.go.dev › github.com › staropshq › go-anthropic
go-anthropic module - github.com/staropshq/go-anthropic - Go Packages
completion, err := anthropic.Answer("Why is the sky blue?", 255) if err != nil { panic(err) } fmt.Println(*completion)
🌐
Go Packages
pkg.go.dev › github.com › fabiustech › anthropic
anthropic package - github.com/fabiustech/anthropic - Go Packages
Model Model `json:"model,omitempty"` // MaxTokensToSample is the maximum number of tokens to generate before stopping. Required. MaxTokensToSample int `json:"max_tokens_to_sample"` // StopSequences specifies a list of sequences to stop sampling at. Anthropic's models stop on "\n\nHuman:", and // may include additional built-in stop sequences in the future.
🌐
Go Packages
pkg.go.dev › github.com › liushuangls › go-anthropic
anthropic package - github.com/liushuangls/go-anthropic - Go Packages
package main import ( "errors" "fmt" "github.com/liushuangls/go-anthropic" ) func main() { client := anthropic.NewClient("your anthropic apikey") resp, err := client.CreateMessages(context.Background(), anthropic.MessagesRequest{ Model: anthropic.ModelClaudeInstant1Dot2, Messages: []anthropic.Message{ anthropic.NewUserTextMessage("What is your name?"), }, MaxTokens: 1000, }) if err != nil { var e *anthropic.APIError if errors.As(err, &e) { fmt.Printf("Messages error, type: %s, message: %s", e.Type, e.Message) } else { fmt.Printf("Messages error: %v\n", err) } return } fmt.Println(resp.Content[0].Text) }
🌐
Go Packages
pkg.go.dev › github.com › 3JoB › anthropic-sdk-go
anthropic package - github.com/3JoB/anthropic-sdk-go - Go Packages
package main import ( "fmt" "github.com/3JoB/anthropic-sdk-go" "github.com/3JoB/anthropic-sdk-go/data" ) func main() { c, err := anthropic.New("api keys","modules") if err != nil { panic(err) } d, err := c.Send(&anthropic.Opts{ Message: data.MessageModule{ Human: "Do you know Golang, please answer me in the shortest possible way.", }, Sender: anthropic.Sender{MaxToken: 1200}, }) if err != nil { panic(err) } fmt.Println(d.Response.String()) }
🌐
GitHub
github.com › 3JoB › anthropic-sdk-go
GitHub - 3JoB/anthropic-sdk-go: (Need to be maintained) Golang SDK for AnthRopic Claude AI. Provide complete encapsulated interfaces that are easy to quickly get started with.
package main import ( "fmt" "github.com/3JoB/anthropic-sdk-go/v2" "github.com/3JoB/anthropic-sdk-go/v2/data" "github.com/3JoB/anthropic-sdk-go/v2/resp" ) func main() { c, err := anthropic.New(&anthropic.Config{Key: "your keys", DefaultModel: data.ModelFullInstant}) if err != nil { panic(err) } d, err := c.Send(&anthropic.Sender{ Message: data.MessageModule{ Human: "Do you know Golang, please answer me in the shortest possible way.", }, Sender: &resp.Sender{MaxToken: 1200}, }) if err != nil { panic(err) } fmt.Println(d.Response.String()) }
Starred by 38 users
Forked by 6 users
Languages   Go
🌐
Go Packages
pkg.go.dev › github.com › anthropics › anthropic-sdk-go
anthropic package - github.com/anthropics/anthropic-sdk-go - Go Packages
p := anthropic.ExampleParams{ ID: "id_xxx", // required property Name: anthropic.String("..."), // optional property Point: anthropic.Point{ X: 0, // required field will serialize as 0 Y: anthropic.Int(1), // optional field will serialize as 1 // ...
Find elsewhere
🌐
Restack
restack.io › p › anthropic-knowledge-answer-golang-sdk-cat-ai
Anthropic SDK Golang Overview | Restackio
In this example, replace YOUR_API_KEY with your actual API key. The request sends a message to the API and prints the response. This setup allows you to authenticate and interact with the Anthropic API using Go. Make sure to handle errors appropriately and secure your API key to prevent ...
🌐
Go Packages
pkg.go.dev › github.com › modeledge › anthropic-sdk-go › v2
anthropic package - github.com/modeledge/anthropic-sdk-go/v2 - Go Packages
Context Example: package main import ( "fmt" "github.com/modeledge/anthropic-sdk-go/v2" "github.com/modeledge/anthropic-sdk-go/v2/resp" "github.com/modeledge/anthropic-sdk-go/v2/data" ) func main() { c, err := anthropic.New(&anthropic.Config{Key: "your keys", DefaultModel: data.ModelFullInstant}) if err != nil { panic(err) } d, err := c.Send(&anthropic.Sender{ Message: data.MessageModule{ Human: "Do you know Golang, please answer me in the shortest possible way.", }, Sender: &resp.Sender{MaxToken: 1200}, }) if err != nil { panic(err) } fmt.Println(d.Response.String()) ds, err := c.Send(&anthropic.Sender{ Message: data.MessageModule{ Human: "What is its current version number?", }, SessionID: d.ID, Sender: &resp.Sender{MaxToken: 1200}, }) if err != nil { panic(err) } fmt.Println(ds.Response.String()) } Return: {"detail":null,"completion":"Hello world!
🌐
GitHub
github.com › unfunco › anthropic-sdk-go
GitHub - unfunco/anthropic-sdk-go: Go client library for interacting with the Anthropic safety-first language model REST APIs.
Go client library for interacting with the Anthropic safety-first language model REST APIs. - unfunco/anthropic-sdk-go
Author   unfunco
🌐
DZone
dzone.com › data engineering › ai/ml › use anthropic claude 3 models to build generative ai applications with go
Use Anthropic Claude 3 Models With Go
May 14, 2024 - msg := "Hello, what's your name?" payload := Claude3Request{ AnthropicVersion: "bedrock-2023-05-31", MaxTokens: 1024, Messages: []Message{ { Role: "user", Content: []Content{ { Type: "text", Text: msg, }, }, }, }, } payloadBytes, err := json.Marshal(payload)
🌐
Go Packages
pkg.go.dev › github.com › NikitosnikN › go-anthropic-api
go_anthropic_api package - github.com/NikitosnikN/go-anthropic-api - Go Packages
package main import ( "context" "fmt" claude "github.com/NikitosnikN/go-anthropic-api" "io" ) func main() { // Create a new Claude client client := claude.NewClient("your-api-key") // Create a message request instance message := claude.MessagesRequest{ Model: "claude-3-haiku-20240307", MaxTokens: 1024, } message.AddTextMessage("user", "hello world") // Send request stream, err := client.CreateMessageRequestStream(context.Background(), message) if err != nil { panic(err) } // Read response for { part, err := stream.ReadMessage(true) if err == io.EOF { break } if err != nil { panic(err) } fmt.Println(part) // Hello // Hello!
🌐
Codingmall
codingmall.com › knowledge-base › 25-global › 1558-anthropic-package-for-go
Anthropic Package for Go: Integration with Claude API
At CodingMall.com we provide Joomla extensions, components, WordPress Plugins, SEO and customized web development solutions.
🌐
Go Packages
pkg.go.dev › github.com › 3dsinteractive › langchaingo › examples › anthropic-tool-call-example
anthropic-tool-call-example command - github.com/3dsinteractive/langchaingo/examples/anthropic-tool-call-example - Go Packages
Welcome to the Anthropic Tool Call Example! This fun little Go program demonstrates how to use the Anthropic API to create an AI assistant that can answer questions about the weather using function calling.
🌐
Claude Docs
platform.claude.com › docs › en › api › client-sdks
Client SDKs - Claude Docs
Every SDK has a beta namespace that is available for accessing new features that Anthropic releases in beta versions. Use this in conjunction with beta headers to access these features. Refer to each SDK's GitHub repository for specific usage examples.
🌐
Pcarion
pcarion.com › blog › go_model_context_protocol
Go SDK for Anthropic Model Context Protocol | pcarion.com
Note: you can find the caude for this example in github at: https://github.com/llmcontext/mcpnotion