Detailed changes
@@ -16,11 +16,24 @@ const (
// Option configures the Cerebras provider via OpenAI-compatible options.
type Option = openaicompat.Option
+var (
+ // WithBaseURL is an alias for openaicompat.WithBaseURL.
+ WithBaseURL = openaicompat.WithBaseURL
+ // WithAPIKey is an alias for openaicompat.WithAPIKey.
+ WithAPIKey = openaicompat.WithAPIKey
+ // WithHeaders is an alias for openaicompat.WithHeaders.
+ WithHeaders = openaicompat.WithHeaders
+ // WithHTTPClient is an alias for openaicompat.WithHTTPClient.
+ WithHTTPClient = openaicompat.WithHTTPClient
+ // WithSDKOptions is an alias for openaicompat.WithSDKOptions.
+ WithSDKOptions = openaicompat.WithSDKOptions
+)
+
// New creates a new Cerebras provider using OpenAI-compatible transport/options.
func New(opts ...Option) (fantasy.Provider, error) {
options := []Option{
openaicompat.WithName(Name),
- openaicompat.WithBaseURL(BaseURL),
+ WithBaseURL(BaseURL),
}
options = append(options, opts...)
return openaicompat.New(options...)
@@ -16,11 +16,24 @@ const (
// Option configures the Groq provider via OpenAI-compatible options.
type Option = openaicompat.Option
+var (
+ // WithBaseURL is an alias for openaicompat.WithBaseURL.
+ WithBaseURL = openaicompat.WithBaseURL
+ // WithAPIKey is an alias for openaicompat.WithAPIKey.
+ WithAPIKey = openaicompat.WithAPIKey
+ // WithHeaders is an alias for openaicompat.WithHeaders.
+ WithHeaders = openaicompat.WithHeaders
+ // WithHTTPClient is an alias for openaicompat.WithHTTPClient.
+ WithHTTPClient = openaicompat.WithHTTPClient
+ // WithSDKOptions is an alias for openaicompat.WithSDKOptions.
+ WithSDKOptions = openaicompat.WithSDKOptions
+)
+
// New creates a new Groq provider using OpenAI-compatible transport/options.
func New(opts ...Option) (fantasy.Provider, error) {
options := []Option{
openaicompat.WithName(Name),
- openaicompat.WithBaseURL(BaseURL),
+ WithBaseURL(BaseURL),
}
options = append(options, opts...)
return openaicompat.New(options...)
@@ -16,11 +16,24 @@ const (
// Option configures the Hugging Face provider via OpenAI-compatible options.
type Option = openaicompat.Option
+var (
+ // WithBaseURL is an alias for openaicompat.WithBaseURL.
+ WithBaseURL = openaicompat.WithBaseURL
+ // WithAPIKey is an alias for openaicompat.WithAPIKey.
+ WithAPIKey = openaicompat.WithAPIKey
+ // WithHeaders is an alias for openaicompat.WithHeaders.
+ WithHeaders = openaicompat.WithHeaders
+ // WithHTTPClient is an alias for openaicompat.WithHTTPClient.
+ WithHTTPClient = openaicompat.WithHTTPClient
+ // WithSDKOptions is an alias for openaicompat.WithSDKOptions.
+ WithSDKOptions = openaicompat.WithSDKOptions
+)
+
// New creates a new Hugging Face provider using OpenAI-compatible transport/options.
func New(opts ...Option) (fantasy.Provider, error) {
options := []Option{
openaicompat.WithName(Name),
- openaicompat.WithBaseURL(BaseURL),
+ WithBaseURL(BaseURL),
}
options = append(options, opts...)
return openaicompat.New(options...)
@@ -16,11 +16,24 @@ const (
// Option configures the xAI provider via OpenAI-compatible options.
type Option = openaicompat.Option
+var (
+ // WithBaseURL is an alias for openaicompat.WithBaseURL.
+ WithBaseURL = openaicompat.WithBaseURL
+ // WithAPIKey is an alias for openaicompat.WithAPIKey.
+ WithAPIKey = openaicompat.WithAPIKey
+ // WithHeaders is an alias for openaicompat.WithHeaders.
+ WithHeaders = openaicompat.WithHeaders
+ // WithHTTPClient is an alias for openaicompat.WithHTTPClient.
+ WithHTTPClient = openaicompat.WithHTTPClient
+ // WithSDKOptions is an alias for openaicompat.WithSDKOptions.
+ WithSDKOptions = openaicompat.WithSDKOptions
+)
+
// New creates a new xAI provider using OpenAI-compatible transport/options.
func New(opts ...Option) (fantasy.Provider, error) {
options := []Option{
openaicompat.WithName(Name),
- openaicompat.WithBaseURL(BaseURL),
+ WithBaseURL(BaseURL),
}
options = append(options, opts...)
return openaicompat.New(options...)
@@ -16,11 +16,24 @@ const (
// Option configures the Z.ai provider via OpenAI-compatible options.
type Option = openaicompat.Option
+var (
+ // WithBaseURL is an alias for openaicompat.WithBaseURL.
+ WithBaseURL = openaicompat.WithBaseURL
+ // WithAPIKey is an alias for openaicompat.WithAPIKey.
+ WithAPIKey = openaicompat.WithAPIKey
+ // WithHeaders is an alias for openaicompat.WithHeaders.
+ WithHeaders = openaicompat.WithHeaders
+ // WithHTTPClient is an alias for openaicompat.WithHTTPClient.
+ WithHTTPClient = openaicompat.WithHTTPClient
+ // WithSDKOptions is an alias for openaicompat.WithSDKOptions.
+ WithSDKOptions = openaicompat.WithSDKOptions
+)
+
// New creates a new Z.ai provider using OpenAI-compatible transport/options.
func New(opts ...Option) (fantasy.Provider, error) {
options := []Option{
openaicompat.WithName(Name),
- openaicompat.WithBaseURL(BaseURL),
+ WithBaseURL(BaseURL),
}
options = append(options, opts...)
return openaicompat.New(options...)
@@ -7,7 +7,6 @@ import (
"charm.land/fantasy"
"charm.land/fantasy/providers/cerebras"
- "charm.land/fantasy/providers/openaicompat"
"gopkg.in/dnaeon/go-vcr.v4/pkg/recorder"
)
@@ -19,8 +18,8 @@ func TestCerebrasCommon(t *testing.T) {
func builderCerebras(t *testing.T, r *recorder.Recorder) (fantasy.LanguageModel, error) {
provider, err := cerebras.New(
- openaicompat.WithAPIKey(os.Getenv("FANTASY_CEREBRAS_API_KEY")),
- openaicompat.WithHTTPClient(&http.Client{Transport: r}),
+ cerebras.WithAPIKey(os.Getenv("FANTASY_CEREBRAS_API_KEY")),
+ cerebras.WithHTTPClient(&http.Client{Transport: r}),
)
if err != nil {
return nil, err
@@ -7,7 +7,6 @@ import (
"charm.land/fantasy"
"charm.land/fantasy/providers/groq"
- "charm.land/fantasy/providers/openaicompat"
"gopkg.in/dnaeon/go-vcr.v4/pkg/recorder"
)
@@ -19,8 +18,8 @@ func TestGroqCommon(t *testing.T) {
func builderGroqProvider(t *testing.T, r *recorder.Recorder) (fantasy.LanguageModel, error) {
provider, err := groq.New(
- openaicompat.WithAPIKey(os.Getenv("FANTASY_GROQ_API_KEY")),
- openaicompat.WithHTTPClient(&http.Client{Transport: r}),
+ groq.WithAPIKey(os.Getenv("FANTASY_GROQ_API_KEY")),
+ groq.WithHTTPClient(&http.Client{Transport: r}),
)
if err != nil {
return nil, err
@@ -7,7 +7,6 @@ import (
"charm.land/fantasy"
"charm.land/fantasy/providers/huggingface"
- "charm.land/fantasy/providers/openaicompat"
"gopkg.in/dnaeon/go-vcr.v4/pkg/recorder"
)
@@ -19,8 +18,8 @@ func TestHuggingFaceCommon(t *testing.T) {
func builderHuggingFaceProvider(t *testing.T, r *recorder.Recorder) (fantasy.LanguageModel, error) {
provider, err := huggingface.New(
- openaicompat.WithAPIKey(os.Getenv("FANTASY_HUGGINGFACE_API_KEY")),
- openaicompat.WithHTTPClient(&http.Client{Transport: r}),
+ huggingface.WithAPIKey(os.Getenv("FANTASY_HUGGINGFACE_API_KEY")),
+ huggingface.WithHTTPClient(&http.Client{Transport: r}),
)
if err != nil {
return nil, err
@@ -6,7 +6,6 @@ import (
"testing"
"charm.land/fantasy"
- "charm.land/fantasy/providers/openaicompat"
"charm.land/fantasy/providers/xai"
"gopkg.in/dnaeon/go-vcr.v4/pkg/recorder"
)
@@ -19,8 +18,8 @@ func TestXAICommon(t *testing.T) {
func builderXAI(t *testing.T, r *recorder.Recorder) (fantasy.LanguageModel, error) {
provider, err := xai.New(
- openaicompat.WithAPIKey(os.Getenv("FANTASY_XAI_API_KEY")),
- openaicompat.WithHTTPClient(&http.Client{Transport: r}),
+ xai.WithAPIKey(os.Getenv("FANTASY_XAI_API_KEY")),
+ xai.WithHTTPClient(&http.Client{Transport: r}),
)
if err != nil {
return nil, err
@@ -6,7 +6,6 @@ import (
"testing"
"charm.land/fantasy"
- "charm.land/fantasy/providers/openaicompat"
"charm.land/fantasy/providers/zai"
"gopkg.in/dnaeon/go-vcr.v4/pkg/recorder"
)
@@ -19,8 +18,8 @@ func TestZAICommon(t *testing.T) {
func builderZAI(t *testing.T, r *recorder.Recorder) (fantasy.LanguageModel, error) {
provider, err := zai.New(
- openaicompat.WithAPIKey(os.Getenv("FANTASY_ZAI_API_KEY")),
- openaicompat.WithHTTPClient(&http.Client{Transport: r}),
+ zai.WithAPIKey(os.Getenv("FANTASY_ZAI_API_KEY")),
+ zai.WithHTTPClient(&http.Client{Transport: r}),
)
if err != nil {
return nil, err