Closed hzpeng closed 6 months ago
The example provided under the title Code(original sample in migration guide to V2 for Python)
works correctly.
When using curl
, you must provide an input
, whereas for the SDK, you must provide inputs
.
Thanks for your quick reply. The example provided under the title Code(original sample in migration guide to V2 for Python) will always cause the following exception. Could you pls help on this ? Thanks.
genai.exceptions.ApiResponseException: Failed to handle request to https://bam-api.res.ibm.com/v2/text/generation?version=2023-11-22.
{
“error”: “Not Found”,
“extensions”: {
“code”: “NOT_FOUND”,
“state”: null
},
“message”: “Route does not exist”,
“status_code”: 404
}
Ensure your GENAI_API
is set to https://bam-api.res.ibm.com
.
Version Information
Package Version: ibm-generative-ai 2.1.0 Operating System: MacOS
What is the expected behavior?
Generate text
What is the actual behavior?
Causes an exception:
Code(original sample in migration guide to V2 for python)
Comment the inputs:
The result is as following:
The exception disappears, because input is none, then the generated text is also none. I also called BAM REST API V2 through curl command, the curl call is successful as following.
By using curl command, we must use input and in the "Migration guide to v2", it mentions:
While for IBM-Generative-AI Python SDK, we must use inputs and the call will fail. More details, please reference above exception. Could you please check and give a sample about how to call BAM REST API V2 using IBM-Generative-AI Python SDK? Thanks!