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

Can’t create a tool without a parameter (ollama) #111

Open
hanspagel opened this issue Dec 28, 2024 · 1 comment
Open

Can’t create a tool without a parameter (ollama) #111

hanspagel opened this issue Dec 28, 2024 · 1 comment

Comments

@hanspagel
Copy link

Hey, just checking out this wonderful library and get an exception for a simple tool without any parameter. Are parameters required or is that an issue in the package?

When I comment out the withStringParameter I get an exception.

$tools = [
    Tool::as('weather')
        ->for('useful when you need to search for current weather conditions')
        // Commenting this out, will break it:
        // ->withStringParameter('city', 'The city that you want the weather for')
        ->using(fn (string $city): string => 'The weather will be 75° and sunny'),
];

$response = Prism::text()
    ->using(Provider::Ollama, 'qwen2.5:1.5b')
    ->withTools($tools)
    ->withToolChoice('weather')
    ->withMaxSteps(3)
    ->withPrompt('How is the weather in Berlin?')
    ->generate();
Ollama Error: [invalid_request_error] json: cannot unmarshal array into Go struct field .tools.function.parameters.properties of type map[string]struct { Type string "json:\"type\""; Description string "json:\"description\""; Enum []string "json:\"enum,omitempty\"" }
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

No branches or pull requests

2 participants
@hanspagel and others