Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic model setting for agents #7

Merged
merged 2 commits into from
Mar 2, 2025
Merged

Conversation

MaestroError
Copy link
Owner

New Methods

model()
protected function model(): string

Override this method in your agent class to define the default model for the agent. This method should return a string representing the model identifier (e.g., 'gpt-4', 'gpt-3.5-turbo').

class YourAgent extends Agent
{
    protected function model(): string
    {
        return 'gpt-4';
    }
}
withModel()
public function withModel(string $model): static

A chainable method that allows you to dynamically set the model at runtime. This is particularly useful when you need to switch models in your controller or other parts of your application.

// In your controller
$response = YourAgent::for("chat_key")
    ->withModel('gpt-3.5-turbo')
    ->respond($message);

@MaestroError MaestroError merged commit 8d75060 into main Mar 2, 2025
33 checks passed
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.

1 participant