Fabric icon indicating copy to clipboard operation
Fabric copied to clipboard

[Bug]: improve_prompt not working

Open nomopo45 opened this issue 1 year ago • 0 comments

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:

  1. In the MyReader struct, you're storing a copy of the input bytes in bytes. This is unnecessary and can be removed.

  2. The Read method of MyReader is not correctly implementing the io.Reader interface. It's supposed to read from an internal buffer, but instead it's overwriting the input buffer with its own contents.

  3. In the LimitReader function, you're reading the entire file into memory using ioutil.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.

  4. The main function is not correctly using the r variable. It's trying to call the Read method on it, but r is an io.Reader, which doesn't have a Read method. 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:

  1. Provides a specific and correct answer
  2. Includes the scientific name of the species
  3. 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": "", "scientific_name": "", "height": ""}

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

nomopo45 avatar May 27 '24 06:05 nomopo45