mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-11 07:18:03 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e7830ff77 | ||
|
|
5945c0e16b | ||
|
|
29ee141822 |
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/danielmiessler/fabric/plugins/ai"
|
||||
"github.com/danielmiessler/fabric/plugins/ai/anthropic"
|
||||
"github.com/danielmiessler/fabric/plugins/ai/azure"
|
||||
"github.com/danielmiessler/fabric/plugins/ai/cerebras"
|
||||
"github.com/danielmiessler/fabric/plugins/ai/deepseek"
|
||||
"github.com/danielmiessler/fabric/plugins/ai/dryrun"
|
||||
"github.com/danielmiessler/fabric/plugins/ai/gemini"
|
||||
@@ -73,6 +74,7 @@ func NewPluginRegistry(db *fsdb.Db) (ret *PluginRegistry, err error) {
|
||||
exolab.NewClient(),
|
||||
litellm.NewClient(),
|
||||
grokai.NewClient(),
|
||||
cerebras.NewClient(),
|
||||
)
|
||||
_ = ret.Configure()
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
"1.4.173"
|
||||
"1.4.174"
|
||||
|
||||
18
plugins/ai/cerebras/cerebras.go
Normal file
18
plugins/ai/cerebras/cerebras.go
Normal file
@@ -0,0 +1,18 @@
|
||||
// File: plugins/ai/cerebras/cerebras.go
|
||||
package cerebras
|
||||
|
||||
import (
|
||||
"github.com/danielmiessler/fabric/plugins/ai/openai"
|
||||
)
|
||||
|
||||
// NewClient initializes and returns a new Cerebras Client.
|
||||
func NewClient() (ret *Client) {
|
||||
ret = &Client{}
|
||||
ret.Client = openai.NewClientCompatible("Cerebras", "https://api.cerebras.ai/v1", nil)
|
||||
return
|
||||
}
|
||||
|
||||
// Client wraps the openai.Client to provide additional functionality specific to Cerebras.
|
||||
type Client struct {
|
||||
*openai.Client
|
||||
}
|
||||
27
plugins/ai/cerebras/cerebras_test.go
Normal file
27
plugins/ai/cerebras/cerebras_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// File: plugins/ai/cerebras/cerebras_test.go
|
||||
package cerebras
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Test the client initialization
|
||||
func TestNewClient_EmbeddedClientNotNil(t *testing.T) {
|
||||
client := NewClient()
|
||||
if client.Client == nil {
|
||||
t.Fatalf("Expected embedded openai.Client to be non-nil, got nil")
|
||||
}
|
||||
}
|
||||
|
||||
// Test the client name and URL configuration
|
||||
func TestNewClient_ConfiguredCorrectly(t *testing.T) {
|
||||
client := NewClient()
|
||||
if client.GetName() != "Cerebras" {
|
||||
t.Errorf("Expected client name to be 'Cerebras', got '%s'", client.GetName())
|
||||
}
|
||||
|
||||
// Check if the ApiBaseURL is set correctly
|
||||
if client.ApiBaseURL.Value != "https://api.cerebras.ai/v1" {
|
||||
t.Errorf("Expected base URL to be 'https://api.cerebras.ai/v1', got '%s'", client.ApiBaseURL.Value)
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
package main
|
||||
|
||||
var version = "v1.4.173"
|
||||
var version = "v1.4.174"
|
||||
|
||||
Reference in New Issue
Block a user