Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct keys for output parsing except block #73

Open
wants to merge 1 commit into
base: main_july_updates
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions promptify/parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,14 @@ def fit(self, json_str: str, max_completion_length: int = 5) -> Dict[str, Any]:
)
return {
"status": "completed",
"object_type": type(output["completion"]),
"data": output,
"object_type": type(output),
"data": {"completion": output, "suggestions": []},
}
except Exception as e:
return {
"status": "failed",
"object_type": None,
"data": {"error_message": str(e)},
Copy link
Contributor Author

@escesare escesare Apr 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'error_message' without 'completion' causes an unhandled error on this later line.
I just changed it to 'completion', since we already have 'status' to indicate error. Alternatively, we can leave it as 'error_message' but have to change the aforementioned line of code.

"data": {"completion": str(e)},
}

def find_max_length(self, data_list: List[Any]) -> Dict[str, List[Any]]:
Expand Down