[Bug]: improve_prompt not working
What happened?
I am using fabric with lm studio for the pattern improve_prompt it's not working depending the prompt you give him, and in the case it does not work it will instead of improving the prompt answer to the prompt directly. I use fabric --gui with improve_prompt as pattern and lm-studio with llama 3 instruct 7B
Examples
Prompt given : Can you help me to improve the following go code ? Answer : I'd be happy to help! However, I don't see any Go code provided. Please paste the code you'd like to improve and let me know what specific issues or areas of improvement you're concerned about (e.g. performance, readability, maintainability, etc.).
Prompt given: Can you help me to improve the following go code ?
type MyReader struct {
bytes []byte
length int
}
func (myReader *MyReader) Read(p []byte) (int, error) {
fmt.Println("be invoked")
myReader.bytes = p
myReader.length = len(p)
fmt.Printf("length: %d\n", myReader.length)
return len(p), nil
}
func LimitReader(r io.Reader, n int64) io.Reader {
filecontent, _ := ioutil.ReadFile("./testfile.txt")
r.Read(filecontent[:n])
return r
}
func main() {
myReader := &MyReader{}
r := LimitReader(myReader, 100)
filecontent, _ := ioutil.ReadFile("./testfile.txt")
fmt.Println(r.Read(filecontent))
}
Answer : Here are some suggestions to improve your Go code:
-
In the
MyReaderstruct, you're storing a copy of the input bytes inbytes. This is unnecessary and can be removed. -
The
Readmethod ofMyReaderis not correctly implementing theio.Readerinterface. It's supposed to read from an internal buffer, but instead it's overwriting the input buffer with its own contents. -
In the
LimitReaderfunction, you're reading the entire file into memory usingioutil.ReadFile. This can be inefficient for large files. Instead, you could use a buffered reader to limit the amount of data read from the underlying reader. -
The
mainfunction is not correctly using thervariable. It's trying to call theReadmethod on it, butris anio.Reader, which doesn't have aReadmethod. Instead, you should use a loop to read from the reader until it returns an error.
Here's an updated version of your code that addresses these issues:
type MyReader struct{}
func (myReader *MyReader) Read Be invoked lenght: Be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked be invoked Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit Be Inv Be Limit
This bug where llama3 goes in nonsense also happens a lot any idea on this ?
Prompt: What's the tallest tree in the world ? Answer: Here's a rewritten version of your prompt using the techniques from PROMPT WRITING KNOWLEDGE:
Evaluating Model Output: Identifying the Tallest Tree
Please provide a concise and accurate answer to the question "What is the tallest tree in the world?" Your response should include the scientific name of the species, its height, and any relevant context or information.
To evaluate your model's output, we will assess whether it:
- Provides a specific and correct answer
- Includes the scientific name of the species
- Mentions the height of the tree
Your response will be scored based on these criteria. Please provide your answer in a clear and concise format.
Example Input
Here is an example input that meets the evaluation criteria:
"The tallest tree in the world is a coast redwood (Sequoia sempervirens) named Hyperion, standing at 115.55 meters (379.1 feet) tall."
Please note that this is just one possible correct answer, and your model's output should be evaluated based on its accuracy and completeness.
Output Format
Your response should be in the following format:
{"answer": "
For example: {"answer": "The tallest tree in the world is a coast redwood (Sequoia sempervirens) named Hyperion, standing at 115.55 meters (379.1 feet) tall.", "scientific_name": "Sequoia sempervirens", "height": "115.55 meters"}
So the topic here is why in some case it will directly answer the prompt and in other will apply the pattern and improve the prompt ?
Version check
- [X] Yes I was.
Relevant log output
No response
Relevant screenshots (optional)
No response