Skip to content

Commit d80d63f

Browse files
Include prompt to use if you are asking LLM to write code
1 parent 039daf9 commit d80d63f

1 file changed

Lines changed: 64 additions & 7 deletions

File tree

README.md

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ npm install @yepcode/run
3636
// Option 1: Set as environment variable (Recommended)
3737
# .env file
3838
YEPCODE_API_TOKEN=your_token_here
39-
39+
4040
// Option 2: Provide directly to the constructor (Not recommended for production)
4141
const runner = new YepCodeRun({ apiToken: 'your_token_here' });
4242
```
@@ -129,6 +129,63 @@ stream.pipe(fs.createWriteStream('./downloaded.txt'));
129129
await storage.delete('myfile.txt');
130130
```
131131

132+
## Prompt to use if you are asking LLM to write code
133+
134+
You can use the following prompt to ask LLM to write code that the YepCode Run SDK can execute.
135+
136+
You should replace the `{{task}}` and `{{envVars}}` placeholders with the actual task and environment variables names already set in your YepCode workspace.
137+
138+
```text
139+
Acts as a coding agent to help the user to achieve the described task generating a standalone script in either JavaScript or Python. Do not write any explainations, just write the code.
140+
141+
The task to solve is:
142+
143+
=====
144+
{{task}}
145+
=====
146+
147+
* We support JavaScript (NodeJS v22) or Python (v3.13).
148+
* You may use the following environment variables already set in the execution context: {{envVars}}
149+
* Use external dependencies freely from NPM or PyPI. You should import them as usually.
150+
* If package name is different from the import sentence, add an anotation for us to detect them (\`// @add-package package_name\` (javascript) or \`# @add-package package_name\` (python)).
151+
* When possible, use binary packages to avoid compilation issues.
152+
* Include debugging logs (\`console.log()\` in javascript or \`print()\` in python) if necessary for execution tracking and error debugging.
153+
* Do not catch errors, let them fail the execution.
154+
* Follow the required script structure based on the chosen language:
155+
156+
---------------------------------
157+
JavaScript
158+
----------
159+
// @add-package package_name_1
160+
const package_name_1 = require("package_name_1");
161+
// @add-package package_name_2
162+
const package_name_2 = require("package_name_2");
163+
164+
async function main() {
165+
// The generated code should go here
166+
return {"success": true, "data": result}
167+
}
168+
169+
module.exports = { main }
170+
---------------------------------
171+
172+
---------------------------------
173+
Python
174+
------
175+
# @add-package package_name_1
176+
import package_name_1
177+
# @add-package package_name_2
178+
from package_name_2.module import Module
179+
180+
def main():
181+
# The generated code should go here
182+
return {"success": True, "data": result}
183+
184+
---------------------------------
185+
186+
Important: The response should only contain the script to be executed by `python` or `node` and follow the exact structure above. Do not include any explanations neither enclosing annotations.
187+
```
188+
132189
## SDK API Reference
133190

134191
### YepCodeRun
@@ -200,12 +257,12 @@ interface Execution {
200257
comment?: string; // Execution comment
201258
}
202259

203-
type ExecutionStatus =
204-
| 'CREATED'
205-
| 'RUNNING'
206-
| 'FINISHED'
207-
| 'KILLED'
208-
| 'REJECTED'
260+
type ExecutionStatus =
261+
| 'CREATED'
262+
| 'RUNNING'
263+
| 'FINISHED'
264+
| 'KILLED'
265+
| 'REJECTED'
209266
| 'ERROR';
210267

211268
interface TimelineEvent {

0 commit comments

Comments
 (0)