[Feature][Transforms-V2] Handling LLM non-standard format responses#8551
Conversation
|
Good job, please solve the ci error as follows: https://github.com/apache/seatunnel/pull/8551/checks?check_run_id=35781798828 Unable to detect the workflow run for testing the changes in your PR. If you did not enable GitHub Actions in your forked repository, please enable it by clicking the button as shown in the image below. See also Disabling or limiting GitHub Actions for a repository for more details.
Please contact me if you meet any problem, my Linkedin(https://www.linkedin.com/in/davidzollo) or WeChat(davidzollo), please tell me your github id when added. |
|
Could you add a test case for this? Thanks |
ok, this is my first time to submit an open source project pr. please forgive me |
| try { | ||
| return OBJECT_MAPPER.convertValue( | ||
| parseResponse(responseStr), new TypeReference<List<String>>() {}); | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
Is it possible to specify the error here?
eg:
try { return OBJECT_MAPPER.convertValue( parseResponse(responseStr), new TypeReference<List<String>>() {}); } catch (IllegalArgumentException or xxxx e) { try { String result = OBJECT_MAPPER.convertValue( parseResponse(responseStr), new TypeReference<String>() {}); return Collections.singletonList(result); } catch (Exception ex) { xxxxx } }
There was a problem hiding this comment.
that better,but origin code were not handling exception here
i commit a new test case, please check it |
@SplitfireUptown Remember to retry the failure ci |
|
Please retry failed ci. |
all ci successful |
| } | ||
|
|
||
| @Test | ||
| void testCustomOllamaRequestJson() throws IOException { |
There was a problem hiding this comment.
The test case can not reach the new code. I think you can use Mockito to set http response then parse it by the code you added. Please refer
There was a problem hiding this comment.
emmmm,new code add in org.apache.seatunnel.transform.nlpmodel.llm.remote.custom.CustomModel#chatWithModel,i need call org.apache.seatunnel.transform.nlpmodel.llm.remote.AbstractModel#inference in test code, if i want test it,i need a server to mock ollama data, because request http interface code and new code in one function,i try many time and dont know how can i run it in outside test code。can u help me please
There was a problem hiding this comment.
nerver mind i got it!
| " \"eval_duration\": 14102000000\n" + | ||
| "}"; | ||
|
|
||
| // 向 MockWebServer 添加响应 |
There was a problem hiding this comment.
Remind you to develop the habit of commenting in En
There was a problem hiding this comment.
code is ok please check it



Purpose of this pull request
Does this PR introduce any user-facing change?
How was this patch tested?
Check list
New License Guide
release-note.