feat: Enhance chat completion with tool calling capabilities
- Added support for tools in ChatCompletionRequest, including tool choice and parallel tool calls. - Introduced ChatCompletionTool and ChatCompletionFunction classes to define tool specifications. - Updated ChatMessage to include tool calls and tool call IDs. - Created ChatToolCall and ChatToolFunction classes for managing tool call details. - Modified TextCompletionClient to support tool calling. - Updated Grader and Grader2 classes to handle new tool-related logic. - Enhanced Agent and AgentTest classes to incorporate tool calling in agent workflows. - Added tests for tool calling functionality in CachedClientTest and CompletionClientTest.
This commit is contained in:
@@ -36,6 +36,7 @@ public class Grader {
|
||||
Only provide the response as a single word and no preamble and no explanation.""",
|
||||
"Here is the text:\n" + text + "\n\n" +
|
||||
"Here is the user question: " + question),
|
||||
null,
|
||||
true);
|
||||
LOGGER.info(completion.response());
|
||||
score += Boolean.parseBoolean(completion.response().strip()) ? 1 : -1;
|
||||
|
||||
@@ -50,6 +50,7 @@ public class Grader2 {
|
||||
- 'false': The text does not provide a truthful answer.
|
||||
Only provide the response as a single word. Do not include any preamble or explanation.
|
||||
""".formatted(question, text)),
|
||||
null,
|
||||
true);
|
||||
LOGGER.info(completion.response());
|
||||
score += Boolean.parseBoolean(completion.response().strip()) ? 1 : -1;
|
||||
|
||||
@@ -30,6 +30,7 @@ public class AnswerGrader {
|
||||
The question is: {{questions}}
|
||||
The answer is: {{answer}}
|
||||
""",
|
||||
null,
|
||||
new JsonAgentResponseHandler(),
|
||||
context -> {
|
||||
context.setSkipCache(true);
|
||||
|
||||
@@ -42,6 +42,7 @@ public class AnswerGrader2 {
|
||||
### Output Format
|
||||
{{qaOutputFormat}}
|
||||
""",
|
||||
null,
|
||||
new JsonAgentResponseHandler(),
|
||||
context -> {
|
||||
final Boolean outputDescription = context.getValue("qaOutputDescription", Boolean.class);
|
||||
|
||||
@@ -33,6 +33,7 @@ public class AnswerGraderBinary {
|
||||
Output Format:
|
||||
{{qaOutputFormat}}
|
||||
""",
|
||||
null,
|
||||
new JsonAgentResponseHandler(),
|
||||
context -> {
|
||||
final Boolean outputDescription = context.getValue("qaOutputDescription", Boolean.class);
|
||||
|
||||
Reference in New Issue
Block a user