Skip to content

Commit

Permalink
refactor!: follow the new spec using the "content" input instead of t…
Browse files Browse the repository at this point in the history
…he old deprecated "result" input argument
  • Loading branch information
snowyu committed Aug 22, 2024
1 parent 4588a4c commit db154c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/file.ai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ tag:
- prompt
- lib
input:
- result: {required: true} # The file path passed by the prompt
- content: {required: true} # The file path passed by the prompt
output:
type: "string"
---
!fn |-
async function loadFile() {
const fs = await import('fs');
const path = await import('path');
const filename = path.basename(this.result);
const filepath = expandPath(this.result)
const filename = path.basename(this.content);
const filepath = expandPath(this.content)
const content = fs.readFileSync(filepath, 'utf8');
return `filename: ${filename}\nfile content:\n${content}`
}
Expand Down
5 changes: 1 addition & 4 deletions lib/json.ai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ prompt:
{{output}}
---
THE CONTENT:
{{result or content}}
{{content}}
---
input:
- result
- content
- output
# - output: messages[1].content
output:
type: "object"
properties:
Expand All @@ -48,7 +46,6 @@ output:
description: "Is the reviewer expressing anger?"
required: ["sentiment", "products", "anger"]
parameters:
stop_words: ['\n']
response_format:
type: "json_object"
ProtectedStartup: [input, prompt.messages]
Expand Down

0 comments on commit db154c5

Please sign in to comment.