ThePrez / WatsonX-SDK-Db2-IBMi

WatsonX client SDK for Db2 on IBM i
GNU General Public License v3.0
2 stars 0 forks source link

watsonx.generate returning 0 rows & no error #17

Closed RogNas closed 1 month ago

RogNas commented 1 month ago

generate does not return anything (no errors & no results): Here are the details: Here is the SQL statement that is failing select ltrim("generated_text") from json_table(QSYS2.HTTP_POST( 'https://us-south.ml.cloud.ibm.com/ml/v1/text/generation?version=2023-07-07', json_object('model_id': 'meta-llama/llama-2-13b-chat', 'input': 'what is the capital of New York?', 'parameters': json_object('max_new_tokens': 500, 'time_limit': 1000), 'space_id': watsonx.spaceid), json_object('headers': json_object('Authorization': 'Bearer ' concat watsonx.JobBearerToken, 'Content-Type': 'application/json', 'Accept': 'application/json')) ), 'lax $.results[*]' columns( "generated_text" varchar(10000) ccsid 1208 )); I made sure that wastonx.spaceid and wastonx,JobBearerToken are good. I am getting 0 rows back. Also, the call watsonx.getModels() is working fine. How can I debug/trace to find why the text generation is not returning anything and not giving an error?

Side notes:

  1. There is nothing in the joblog. Is there a log/trace on IFS that I can check?
  2. the GetModels worked fine
  3. I used the same apikey & spaceid from python on my PC and it worked fine.
worksofliam commented 1 month ago

@RogNas I am going to improve the logging today and then I will get you to have another go.

worksofliam commented 1 month ago

@RogNas Please try this new version, which has additional logging in the output:

https://github.com/IBM/WatsonX-SDK-Db2-IBMi/blob/main/src/generate.sql

Also, note, we are moving to that repo (IBM/WatsonX-SDK-Db2-IBMi) instead of this one for all new code changes.

worksofliam commented 1 month ago

@RogNas We just pushed another fix which should yield a working API. Thanks!