Skip to content
Snippets Groups Projects
Commit 6192d3ea authored by Ammar Ahmed's avatar Ammar Ahmed :speech_balloon:
Browse files

handle extract error

parent 424f0251
Branches
No related tags found
No related merge requests found
...@@ -48,7 +48,13 @@ func main() { ...@@ -48,7 +48,13 @@ func main() {
// Update the conversation context with the response // Update the conversation context with the response
conversationContext = updatedContext conversationContext = updatedContext
generatedCode, _ := extraction.Extract(response) // Handle error with string generatedCode, err_extract := extraction.Extract(response) // Handle error with string
if err_extract != nil {
fmt.Printf("The LLM gave a improper string in response: %v", response)
userPrompt = "exit"
continue
}
fmt.Println("Ollama's response:", generatedCode) fmt.Println("Ollama's response:", generatedCode)
...@@ -57,7 +63,7 @@ func main() { ...@@ -57,7 +63,7 @@ func main() {
if err != nil { if err != nil {
userPrompt = output + "\nFollowing are the errors, please fix the code. Write it again, and write only source code along with same test cases with no further explanation. The format should be ```rust <yourcode + testcases> ```" userPrompt = output + "\nFollowing are the errors, please fix the code. Write it again, and write only source code along with same test cases with no further explanation. The format should be ```rust <yourcode + testcases> ```"
} else { } else {
fmt.Println("Compiled successfully. Here is the output: %v", output) fmt.Printf("Compiled successfully. Here is the output: %v", output)
userPrompt = "exit" userPrompt = "exit"
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment