-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from cpunion/gemini-sambanova-groq
feat: add new AI providers and update existing ones
- Loading branch information
Showing
13 changed files
with
178 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.env | ||
_* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package gemini | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/cpunion/go-aisuite" | ||
"github.com/cpunion/go-aisuite/providers" | ||
"github.com/cpunion/go-aisuite/providers/openai" | ||
) | ||
|
||
const Name = "gemini" | ||
const apiKeyEnvVar = "GEMINI_API_KEY" | ||
|
||
func init() { | ||
providers.RegisterProvider(Name, Provider{}) | ||
} | ||
|
||
type Provider struct { | ||
} | ||
|
||
func (p Provider) NewClient(opts providers.Options) aisuite.Client { | ||
if opts.Token == "" { | ||
opts.Token = os.Getenv(apiKeyEnvVar) | ||
if opts.Token == "" { | ||
panic(apiKeyEnvVar + " not found in environment variables") | ||
} | ||
} | ||
return openai.NewClient(opts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package groq | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/cpunion/go-aisuite" | ||
"github.com/cpunion/go-aisuite/providers" | ||
"github.com/cpunion/go-aisuite/providers/openai" | ||
) | ||
|
||
const Name = "groq" | ||
const apiKeyEnvVar = "GROQ_API_KEY" | ||
|
||
func init() { | ||
providers.RegisterProvider(Name, Provider{}) | ||
} | ||
|
||
type Provider struct { | ||
} | ||
|
||
func (p Provider) NewClient(opts providers.Options) aisuite.Client { | ||
if opts.Token == "" { | ||
opts.Token = os.Getenv(apiKeyEnvVar) | ||
if opts.Token == "" { | ||
panic(apiKeyEnvVar + " not found in environment variables") | ||
} | ||
} | ||
return openai.NewClient(opts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package sambanova | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/cpunion/go-aisuite" | ||
"github.com/cpunion/go-aisuite/providers" | ||
"github.com/cpunion/go-aisuite/providers/openai" | ||
) | ||
|
||
const Name = "sambanova" | ||
const apiKeyEnvVar = "SAMBANOVA_API_KEY" | ||
|
||
func init() { | ||
providers.RegisterProvider(Name, Provider{}) | ||
} | ||
|
||
type Provider struct { | ||
} | ||
|
||
func (p Provider) NewClient(opts providers.Options) aisuite.Client { | ||
if opts.Token == "" { | ||
opts.Token = os.Getenv(apiKeyEnvVar) | ||
if opts.Token == "" { | ||
panic(apiKeyEnvVar + " not found in environment variables") | ||
} | ||
} | ||
return openai.NewClient(opts) | ||
} |