// 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
iferr_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() {
iferr!=nil{
iferr!=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)