Skip to content

Conversation

@ksylvan
Copy link
Collaborator

@ksylvan ksylvan commented Apr 18, 2025

CHANGES

  • Introduce Cerebras AI plugin import in plugin registry.
  • Register Cerebras client in the NewPluginRegistry function.

What this Pull Request (PR) does

This PR adds support for Cerebras AI to the Fabric CLI, enabling users to access models hosted on the Cerebras platform.

Related issues

N/A - Rework of #1424

Screenshots

N/A

Files Changed

  • core/plugin_registry.go: Updated to include the Cerebras plugin in the list of AI plugins and instantiate its client in the plugin registry.
  • plugins/ai/cerebras/cerebras.go: A new file was added to define the Cerebras client, leveraging the OpenAI-compatible client structure for seamless integration.
  • plugins/ai/cerebras/cerebras_test.go: New file added with unit tests to validate the initialization and configuration of the Cerebras client.

Code Changes

  • In core/plugin_registry.go, the Cerebras package is imported, and its client is added to the registry initialization:
    +     "github.com/danielmiessler/fabric/plugins/ai/cerebras"
    ...
    +     cerebras.NewClient(),
  • In plugins/ai/cerebras/cerebras.go, a new Client struct is defined, embedding the OpenAI client for compatibility:
    ret.Client = openai.NewClientCompatible("Cerebras", "https://api.cerebras.ai/v1", nil)
  • In plugins/ai/cerebras/cerebras_test.go, tests are added to ensure the client is initialized correctly and configured with the expected name and base URL.

Reason for Changes

The addition of the Cerebras AI plugin expands the range of AI service providers supported by the fabric project. This change allows users to interact with Cerebras AI models through the same interface used for other AI providers, promoting flexibility and extensibility in the application.

Impact of Changes

  • Functionality: Users can now select Cerebras as an AI backend, potentially benefiting from its unique capabilities or pricing models.
  • Performance: As the Cerebras client uses the OpenAI-compatible structure, there should be no significant performance overhead compared to other similar plugins.
  • Compatibility: This change maintains backward compatibility with existing plugins and does not alter the core functionality of the plugin registry.

Test Plan

  • Unit tests have been added in cerebras_test.go to verify that the Cerebras client initializes correctly and is configured with the right name and API base URL.
  • Integration testing should be conducted to ensure the Cerebras client interacts correctly with the API endpoint under real-world conditions, including authentication and request handling.
  • Reviewers are encouraged to test the plugin with a valid Cerebras API key to confirm functionality.

### CHANGES
- Introduce Cerebras AI plugin import in plugin registry.
- Register Cerebras client in the NewPluginRegistry function.
@ksylvan ksylvan mentioned this pull request Apr 18, 2025
@ksylvan
Copy link
Collaborator Author

ksylvan commented Apr 18, 2025

@eugeis Please merge this.

@eugeis eugeis merged commit 5945c0e into danielmiessler:main Apr 19, 2025
1 check passed
@ksylvan ksylvan deleted the 0418-cerebras-ai branch April 19, 2025 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants