Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Jan 1, 2025
1 parent a4efb03 commit a1a4ed0
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/shortest/src/ai/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class AIClient {
constructor(config: AIConfig, debugMode: boolean = false) {
if (!config.apiKey) {
throw new Error(
"Anthropic API key is required. Set it in shortest.config.ts or ANTHROPIC_API_KEY env var"
"Anthropic API key is required. Set it in shortest.config.ts or ANTHROPIC_API_KEY env var",
);
}

Expand All @@ -38,9 +38,9 @@ export class AIClient {
prompt: string,
browserTool: BrowserTool,
outputCallback?: (
content: Anthropic.Beta.Messages.BetaContentBlockParam
content: Anthropic.Beta.Messages.BetaContentBlockParam,
) => void,
toolOutputCallback?: (name: string, input: any) => void
toolOutputCallback?: (name: string, input: any) => void,
) {
const maxRetries = 3;
let attempts = 0;
Expand All @@ -51,7 +51,7 @@ export class AIClient {
prompt,
browserTool,
outputCallback,
toolOutputCallback
toolOutputCallback,
);
} catch (error: any) {
attempts++;
Expand All @@ -67,9 +67,9 @@ export class AIClient {
prompt: string,
browserTool: BrowserTool,
_outputCallback?: (
content: Anthropic.Beta.Messages.BetaContentBlockParam
content: Anthropic.Beta.Messages.BetaContentBlockParam,
) => void,
_toolOutputCallback?: (name: string, input: any) => void
_toolOutputCallback?: (name: string, input: any) => void,
) {
const messages: Anthropic.Beta.Messages.BetaMessageParam[] = [];
// temp cache store
Expand Down Expand Up @@ -123,7 +123,7 @@ export class AIClient {

// Collect executable tool actions
const toolRequests = response.content.filter(
(block) => block.type === "tool_use"
(block) => block.type === "tool_use",
) as Anthropic.Beta.Messages.BetaToolUseBlock[];

if (toolRequests.length > 0) {
Expand All @@ -134,7 +134,7 @@ export class AIClient {
try {
const toolResult = await new BashTool().execute(
(toolRequest as LLMResponse<LLMResponseBash>).input
.command
.command,
);
return { toolRequest, toolResult };
} catch (error) {
Expand All @@ -144,7 +144,7 @@ export class AIClient {
default:
try {
const toolResult = await browserTool.execute(
(toolRequest as LLMResponse<LLMResponseComputer>).input
(toolRequest as LLMResponse<LLMResponseComputer>).input,
);

let extras: any = {};
Expand All @@ -154,7 +154,7 @@ export class AIClient {
const componentStr =
await browserTool.getNormalizedComponentStringByCoords(
x,
y
y,
);
extras = { componentStr };
}
Expand All @@ -177,7 +177,7 @@ export class AIClient {
return null;
}
}
})
}),
);

toolResults.forEach((result) => {
Expand Down

0 comments on commit a1a4ed0

Please sign in to comment.