-
Notifications
You must be signed in to change notification settings - Fork 53
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
Added api call example #1587
Added api call example #1587
Conversation
Signed-off-by: Yoav Katz <[email protected]>
examples/api_call_evaluation.py
Outdated
print("Example prompt:") | ||
|
||
print(json.dumps(results.instance_scores[0]["source"], indent=4)) | ||
|
||
print("Instance Results:") | ||
df = results.instance_scores.to_df( | ||
columns=[ | ||
"user_request", | ||
"reference_query", | ||
"prediction", | ||
"processed_references", | ||
"processed_prediction", | ||
"score", | ||
] | ||
) | ||
for index, row in df.iterrows(): | ||
print(f"Row {index}:") | ||
for col_name, value in row.items(): | ||
print(f"{col_name}: {value}") | ||
print("-" * 20) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we simplify that part in any way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened an issue about this (#1588) The current 'results.instance_scores.summary' is not usable because it prints too long lines. I think we want to change it to print in a different way, and then we could use it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice example that share a lot of similarity with Text to SQL.
In both cases there is (1) user query (2) api/database and that target is to translate the user query to the api/database language.
I think its worth looking at how the SQL was implemented: specifically:
(1) The database is defined by its unique identifier (in this case could be OpenAPI(url="https://petstore.swagger.io/v2/pets")
(2) the representation of the database to the model is determined by a dedicated type serializer (in this case it could be OpenAPISpecificationSerializer(format="json") # can be yaml
)
(3) Metrics could also use deterministic verification like with. https://pypi.org/project/openapi-spec-validator/ that can use the OpenAPI
directly to verify schema/syntax/execution
Signed-off-by: Yoav Katz <[email protected]>
|
Signed-off-by: Yoav Katz <[email protected]>
Given the above - you think we can merge? |
No description provided.