Skip to content

Commit

Permalink
Merge pull request #31 from MinuliKannangara/main
Browse files Browse the repository at this point in the history
Modify the function signature of the getTools function.
  • Loading branch information
nadheesh authored Oct 25, 2023
2 parents f41c947 + bd13898 commit 00f219c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions ballerina/agent.bal
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public class AgentExecutor {
private boolean isCompleted;
PromptConstruct prompt;


isolated function init(Agent agent, string query, ExecutionStep[] previousSteps = [], string|map<json> context = {}) {
string instruction = agent.getInstructionPrompt();
if context != {} {
Expand Down Expand Up @@ -187,7 +186,7 @@ public class AgentExecutor {
}

# Allow retrieving the execution history during previous steps.
#
#
# + return - Execution history of the agent (A list of ExecutionStep)
public isolated function getExecutionHistory() returns ExecutionStep[] {
return self.prompt.history;
Expand Down
10 changes: 7 additions & 3 deletions ballerina/toolkit.bal
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,16 @@ public type HttpOutput record {|

# Allows implmenting custom toolkits by extending this type. Toolkits can help to define new types of tools so that agent can understand them.
public type BaseToolKit distinct object {
isolated function getTools() returns Tool[]|error;
# Useful to retrieve the Tools extracted from the Toolkit.
# + return - A Tool record or an error if tools creation fails.
public isolated function getTools() returns Tool[]|error;
};

# Provide definition to an HTTP header
public type HttpHeader readonly & record {|string|string[]...;|};

# Defines a HTTP tool kit. This is a special type of tool kit that can be used to invoke HTTP resources.
# Require to initialize the toolkit with the service url and http tools that are belongs to a singel API.
# Require to initialize the toolkit with the service url and http tools that are belongs to a single API.
public isolated class HttpServiceToolKit {
*BaseToolKit;
private final Tool[] & readonly tools;
Expand Down Expand Up @@ -185,7 +187,9 @@ public isolated class HttpServiceToolKit {
}
}

isolated function getTools() returns Tool[]|error => self.tools;
# Useful to retrieve the Tools extracted from the HttpTools.
# + return - A Tool record or an error if tools creation fails.
public isolated function getTools() returns Tool[]|error => self.tools;

private isolated function get(HttpInput httpInput) returns HttpOutput|error {
string path = check getPathWithParams(httpInput.path, httpInput?.pathParameters, httpInput?.queryParameters);
Expand Down

0 comments on commit 00f219c

Please sign in to comment.