konveyor-ecosystem / kai

Konveyor AI - static code analysis driven migration to new targets via Generative AI
Apache License 2.0
8 stars 10 forks source link

[Bug] Parsing of 'updated file' contents looks broken for some situations - unable to handle multiple ways of expressing 'Updated File' #208

Open jwmatthews opened 4 days ago

jwmatthews commented 4 days ago

Using model: mistralai/mixtral-8x7b-instruct-v01 from IBM BAM

I am running example/run_demo.py

run_demo.py attempts to migrate 26 files, of this I see 6 failures, as in after exhausting all retries I see 6 files with messages of: [pom.xml] Received status code 500

These are the 6 files where Kai is saying the LLM did not return an updated file,

This is reported as:

 "The LLM did not provide an updated file for X"
 "No codeblocks detected in LLM response"

yet as I look at the debug output I can see the LLM did return an updated file.

Example of LLM Result info for CartEndPoint.java Example of LLM Result info for pom.xml

To aid debugging I captured the full console output in 2 separate gists below:

Example of kai/config.toml

[models]
provider = "ChatIBMGenAI"

[models.args]
model_id = "mistralai/mixtral-8x7b-instruct-v01"
jwmatthews commented 4 days ago

I downloaded the full console output from "LOGLEVEL=debug make run-server" and then searched for the unique ways 'Updated File' is mentioned:

https://gist.githubusercontent.com/jwmatthews/c0c94b5635200ccfdd1f7595cfaecdae/raw/7c5425121f3b91994037fa64d6d7c6f6df0e4b91/2024_June-24_kai_console_output.txt

$ cat ./2024_June-24_kai_console_output.txt | grep "Updated" | sort -u
# Updated File
## Updated File
**Updated File**

I assume the root issue is that https://github.com/konveyor-ecosystem/kai/blob/main/kai/models/file_solution.py assume we will consistently see the Updated File represented in a section of "## Updated File"