Skip to content

Commit

Permalink
fix: py-script execute's return type should be consistent with scorer… (
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 authored Apr 13, 2024
1 parent 91112b7 commit dd7af1f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/pink-laws-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@empiricalrun/core": minor
---

fix: py-script execute's return type should be consistent with scorer's return type
6 changes: 3 additions & 3 deletions docs/models/custom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ signature:
- **Arguments**
- inputs: dict of key-value pairs with [sample inputs](../dataset/basics)
- parameters: dict of key-value pairs with the run parameters
- **Returns**: a dict with
- output (string): The response from the model/application
- **Returns**: an output dict with
- value (string): The response from the model/application
- metadata (dict): Custom key-value pairs that are passed on to the scorer and
web reporter

Expand All @@ -40,7 +40,7 @@ signature:
def execute(inputs):
# ...
return {
"output": output,
"value": output,
"metadata": {
"key": value
}
Expand Down
3 changes: 1 addition & 2 deletions examples/rag/rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def build_query_engine(llm):
response = query_engine.query(question)
output = response.response
contexts = [c.node.get_content() for c in response.source_nodes]

return {
"output": output,
"value": output,
"metadata": {"contexts": contexts},
}
2 changes: 1 addition & 1 deletion packages/core/src/executors/run/transformers/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const scriptExecutor: Transformer = async (runConfig, sample) => {

return {
output: {
value: result["output"],
value: result["value"],
metadata: result["metadata"],
},
};
Expand Down

0 comments on commit dd7af1f

Please sign in to comment.