mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-06-09 15:11:56 +00:00
Removed tooling added
This commit is contained in:
30
src/langchain/agent/create_image.ts
Normal file
30
src/langchain/agent/create_image.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { CreateImageResponse } from "./types";
|
||||
import { create_image } from "../../tools/agent";
|
||||
|
||||
export class SolanaCreateImageTool extends BaseSolanaTool {
|
||||
name = "solana_create_image";
|
||||
description =
|
||||
"Create an image using OpenAI's DALL-E. Input should be a string prompt for the image.";
|
||||
|
||||
private validateInput(input: string): void {
|
||||
if (typeof input !== "string" || input.trim().length === 0) {
|
||||
throw new Error("Input must be a non-empty string prompt");
|
||||
}
|
||||
}
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
this.validateInput(input);
|
||||
const result = await create_image(this.solanaKit, input.trim());
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "Image created successfully",
|
||||
...result,
|
||||
} as CreateImageResponse);
|
||||
} catch (error: any) {
|
||||
return this.handleError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user