Skip to content

Loag/ai-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ai-lib

a single interface lib for interacting with ai completion apis.

The purpose of this lib is to get up and running fast with ai completion apis for go
It only includes exactly what is necessary to get text responses.

Supported Providers

Usage

conf := client.AIConfig{
    ApiKey:       apiKey,
    Model:        "claude-3-5-sonnet-20240620",
    SystemPrompt: "You are a helpful assistant.",
    Temperature:  0.7,
    TopP:         1.0,
    MaxTokens:    2480,
}

ai, err := client.NewAI(conf)
if err != nil {
    log.Err(err).Msg("Error creating AI")
    return
}

res, err := ai.GetCompletion("Hello, how are you?")
if err != nil {
    log.Err(err).Msg("Error getting completion")
    return
}

fmt.Println(res)

About

go client for various ai completion apis

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages