Skip to content

Commit

Permalink
mention data source
Browse files Browse the repository at this point in the history
  • Loading branch information
Liuhaai committed Jan 9, 2025
1 parent 0b77e35 commit bcf29da
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/tools/api_tool.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
export interface Tool {
name: string;
description: string;
twitterAccount: string;
execute(input: string): Promise<string>;
}

export abstract class APITool implements Tool {
name: string;
description: string;
twitterAccount: string = '';
protected apiKey: string;

constructor(name: string, description: string, apiKey: string) {
Expand Down
1 change: 1 addition & 0 deletions src/tools/tool.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export interface Tool {
name: string;
description: string;
twitterAccount: string;
execute(input: string): Promise<string>;
}
2 changes: 2 additions & 0 deletions src/tools/weatherapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ interface NubilaWeatherResponse {
export class WeatherTool implements Tool {
name: string = "WeatherAPI";
description: string = "Gets the current weather from Nubila API. Input is json with latitude and longitude to retrieve weather data.";
twitterAccount: string = "nubilanetwork";

private readonly apiKey: string;
private readonly baseUrl: string;

Expand Down
2 changes: 1 addition & 1 deletion src/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class Workflow {
Tool Input: ${action.output}
Tool Output: ${toolOutput}
Generate a human-readable response based on the tool output.
Generate a human-readable response based on the tool output${action.tool.twitterAccount.length > 0 ? ` and mention the source of data by tagging the twitter account ${action.tool.twitterAccount} in the response` : ''}.
`;
output = await this.llm.generate(finalPrompt);

Expand Down

0 comments on commit bcf29da

Please sign in to comment.