Compare commits

...

3 Commits

Author SHA1 Message Date
github-actions[bot]
9e7830ff77 Update version to v1.4.174 and commit 2025-04-19 06:13:44 +00:00
Eugen Eisler
5945c0e16b Merge pull request #1425 from ksylvan/0418-cerebras-ai
feat: add Cerebras AI plugin to plugin registry
2025-04-19 08:12:32 +02:00
Kayvan Sylvan
29ee141822 feat: add Cerebras AI plugin to plugin registry
### CHANGES
- Introduce Cerebras AI plugin import in plugin registry.
- Register Cerebras client in the NewPluginRegistry function.
2025-04-18 15:14:08 -07:00
5 changed files with 49 additions and 2 deletions

View File

@@ -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()

View File

@@ -1 +1 @@
"1.4.173"
"1.4.174"

View 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
}

View 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)
}
}

View File

@@ -1,3 +1,3 @@
package main
var version = "v1.4.173"
var version = "v1.4.174"