Skip to content

Commit

Permalink
Add Typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
homanp committed May 31, 2023
1 parent 10e4a46 commit e679656
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "superagentai-js",
"version": "0.0.5",
"version": "0.0.6",
"types": "src/superagent.d.ts",
"description": "Superagent.sh Javascript SDK",
"main": "src/superagent.js",
"type": "module",
Expand Down
53 changes: 53 additions & 0 deletions src/superagent.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
declare module 'superagentSDK' {
type Method = "GET" | "POST" | "DELETE";

interface Prompt {
name?: string | null;
input_variables?: string[];
template?: string | null;
}

interface Document {
name: string;
url: string;
type: string;
authorization?: string | null;
}

interface Agent {
name: string;
llm: string;
type?: string;
has_memory: boolean;
}

interface Prediction {
id: string;
input: string;
has_streaming: boolean;
}

export default class SuperagentSDK {
constructor(authToken: string);
private _request(method: Method, endpoint: string, data?: any): Promise<any>;
prompts(): {
delete(id: string): Promise<any>;
get(id: string): Promise<any>;
list(): Promise<any>;
create(prompt: Prompt): Promise<any>;
};
documents(): {
delete(id: string): Promise<any>;
list(): Promise<any>;
get(id: string): Promise<any>;
create(document: Document): Promise<any>;
};
agents(): {
delete(id: string): Promise<any>;
list(): Promise<any>;
get(id: string): Promise<any>;
create(agent: Agent): Promise<any>;
predict(prediction: Prediction): Promise<any>;
};
}
}

0 comments on commit e679656

Please sign in to comment.