-
-
Notifications
You must be signed in to change notification settings - Fork 102
Closed
Labels
BugSomething isn't workingSomething isn't workingPlatformIssues & PRs about the AI Platform componentIssues & PRs about the AI Platform componentStatus: Needs Review
Description
Currently, AbstractModelCatalog::parseModelName()
relies on AbstractModelCatalog::convertNumericStrings()
which only converts numeric strings to integers/floats.
However, boolean-like query parameters (e.g. ?think=false
) are always parsed as strings. This makes it harder to pass boolean options to models, since they need to be manually casted.
Example:
$catalog = new \Symfony\AI\Platform\Bridge\Ollama\ModelCatalog();
$model = $catalog->getModel('qwen3:0.6b?think=false');
$client = new \Symfony\AI\Platform\Bridge\Ollama\OllamaClient(
Symfony\Component\HttpClient\HttpClient::create(),
$_ENV['OLLAMA_HOST']
);
$options = $model->getOptions(); // ['think' => 'false']
// will throw an exception because ollama responds with 400 Bad request
// {"error":"invalid think value: \"false\" (must be \"high\", \"medium\", \"low\", true, or false)"}
$client->request(
$model,
[new \Symfony\AI\Platform\Message\UserMessage(
new \Symfony\AI\Platform\Message\Content\Text('Hello world'),
)],
$model->getOptions()
);
Here think=false
is passed as a string ('false'
), but Ollama server expects a real boolean false
.
Expected behavior:
Boolean-like strings should be automatically converted to booleans.
Proposed solution:
Introduce a more general converter, e.g. convertScalarStrings()
, that handles both numeric and boolean strings.
OskarStark
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't workingPlatformIssues & PRs about the AI Platform componentIssues & PRs about the AI Platform componentStatus: Needs Review