aimyapi 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/lib/index.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -130,6 +130,32 @@ add your open ai key:
|
|
|
130
130
|
OPENAI_API_KEY=XXXXXXXX
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
+
## API Reference for AIMyAPI
|
|
134
|
+
|
|
135
|
+
### createWithAPI(options: AIMyAPIOptions): Promise<CreateWithAPIExports>
|
|
136
|
+
|
|
137
|
+
Primary function you will use to create a module for working your API API. For a simple example with no chat history, see example1. For an example with chat history see example2.
|
|
138
|
+
|
|
139
|
+
#### options
|
|
140
|
+
|
|
141
|
+
- `apiObject`: An object representing the API to be used.
|
|
142
|
+
- `apiExports`: An object representing the exported functions and variables from the API.
|
|
143
|
+
- `apiGlobals` (optional): An object representing global variables for the API.
|
|
144
|
+
- `apiDefFilePath`: A string representing the full path to the API definition file.
|
|
145
|
+
- `apiGlobalName` (optional): A string representing the name of the global variable for the API.
|
|
146
|
+
- `apiDocsPath` (optional): A string representing the path to the documentation for the API.
|
|
147
|
+
- `debug` (optional): A boolean indicating whether to output debugging information.
|
|
148
|
+
|
|
149
|
+
### The AIMyAPI module (type: CreateWithAPIExports)
|
|
150
|
+
|
|
151
|
+
The module created by the `createWithAPI` function:
|
|
152
|
+
|
|
153
|
+
#### Methods
|
|
154
|
+
|
|
155
|
+
- `generateCode(queryText: string, userChatHistory: ChatCompletionRequestMessage[]): Promise<string>`: A function that generates code for the given query text and user chat history.
|
|
156
|
+
- `runCode(task: string): Promise<void>`: A function that runs the generated code.
|
|
157
|
+
- `processRequest(userQuery: string, context?: object): Promise<string>`: A function that processes a user request.
|
|
158
|
+
|
|
133
159
|
## Examples
|
|
134
160
|
|
|
135
161
|
Download or clone the repo. From the root folder run the following.
|
package/lib/index.ts
CHANGED
|
@@ -230,7 +230,7 @@ export interface AIMyAPIExports {
|
|
|
230
230
|
createWithAPI: (options:AIMyAPIOptions) => Promise<CreateWithAPIExports>;
|
|
231
231
|
|
|
232
232
|
createBasePrompt: (apiFilePath:string, documentationPath: string) => string;
|
|
233
|
-
|
|
233
|
+
generateCode: (queryText:string, userChatHistory:ChatCompletionRequestMessage[], createTaskPrompt:string, apiPath:string, debug:boolean) => Promise<string>;
|
|
234
234
|
createSandbox: (QuickJS:QuickJSWASMModule, globals: any) => Promise<any>;
|
|
235
235
|
}
|
|
236
236
|
|
|
@@ -240,7 +240,7 @@ const aimyapi:AIMyAPIExports = {
|
|
|
240
240
|
|
|
241
241
|
// functions for customized usage
|
|
242
242
|
createBasePrompt,
|
|
243
|
-
|
|
243
|
+
generateCode,
|
|
244
244
|
createSandbox,
|
|
245
245
|
}
|
|
246
246
|
|