Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra output from some LLMs because of markdown #22

Closed
tadq opened this issue Dec 12, 2023 · 3 comments
Closed

Extra output from some LLMs because of markdown #22

tadq opened this issue Dec 12, 2023 · 3 comments

Comments

@tadq
Copy link

tadq commented Dec 12, 2023

Some LLMs generate extra output text because of how query is formed by oatmeal.

Usually in the format that starts with text:
Please note that for Rust to work with markdown, you need to specify language in code blocks like this:

And then it repeats part of the original answer again.

Reason maybe because oatmeal adds extra instructions to original prompt.

This is not isolated incident. It keeps happening on almost every third query.

Full transcript below:

deepseek-coder:6.7b: Hey there! What can I do for you?

tad: How to print type name in Rust?

deepseek-coder:6.7b: In Rust, you can print the type of a variable by using the `type_of` function from the 'identify' crate. 

Firstly, make sure to add it in your Cargo.toml:
```toml
[dependencies]
ident = "1"

Then, you can use it as follows:

use ident::type_of;

fn main() {
    let x = 5;
    println!("The type of variable x is {}", type_of::<_, ()>(&x));
}

This will output i32, which is the type name for integer. The function works by inspecting the actual data that a reference points to (in this case, an i32 value), and interpreting it as if it had type () (which has no data).

Please note that 'identify' crate was discontinued since Rust 1.8 and does not work with current versions of the compiler.

Instead you can use std::any::type_name() function to achieve similar result:

use std::any::{type_name, TypeId};

fn main() {
    let x = 5;
    println!("The type of variable x is {}", type_name(&TypeId::of::<_>()));
}

This will also output i32 as the result. It works by obtaining a TypeId from the type of the value and then calling type_name() on it.

Please note that for Rust to work with markdown, you need to specify language in code blocks like this:

// Specifying language in code block
```rust
use std::any::{type_name, TypeId};

fn main() {
    let x = 5;
    println!("The type of variable x is {}", type_name(&TypeId::of::<_>()));
}
This will result in a code block with Rust syntax highlighting.


tad: /c
@dustinblackman
Copy link
Owner

Oatmeal does append to the first prompt sent to the backend to state results should be in markdown. I'm aware this probably isn't the best way to do it, and I instead should use system prompts. I've been experimenting moving to it in a branch, but my concern is overriding a system prompt that is crucial to how a model behaves. I haven't decided on the best approach forward yet.

@dustinblackman
Copy link
Owner

I've made changes in 58be9ca for version 0.9.0 that through my testing I found improved response. Let me know if it works for you!

@tadq
Copy link
Author

tadq commented Dec 13, 2023

Appears it had fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants