allow @Tool methods without parameters (e.g. get current date, time, etc)
This commit is contained in:
parent
087bcd3676
commit
01a07d45a4
|
@ -10,7 +10,13 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
@Target({METHOD})
|
@Target({METHOD})
|
||||||
public @interface Tool {
|
public @interface Tool {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the tool. If not provided, method name will be used.
|
||||||
|
*/
|
||||||
String name() default "";
|
String name() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of the tool. LLM should understand what this tool is for and when it should be used.
|
||||||
|
*/
|
||||||
String value() default "";
|
String value() default "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,9 @@ class OpenAiConverters {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static dev.ai4j.openai4j.chat.Parameters toOpenAiParameters(ToolParameters toolParameters) {
|
private static dev.ai4j.openai4j.chat.Parameters toOpenAiParameters(ToolParameters toolParameters) {
|
||||||
|
if (toolParameters == null) {
|
||||||
|
return dev.ai4j.openai4j.chat.Parameters.builder().build();
|
||||||
|
}
|
||||||
return dev.ai4j.openai4j.chat.Parameters.builder()
|
return dev.ai4j.openai4j.chat.Parameters.builder()
|
||||||
.properties(toolParameters.properties())
|
.properties(toolParameters.properties())
|
||||||
.required(toolParameters.required())
|
.required(toolParameters.required())
|
||||||
|
|
Loading…
Reference in New Issue