guidance-ai / guidance

A guidance language for controlling large language models.
MIT License
18.74k stars 1.03k forks source link

Lots of HTML output #1024

Open motaatmo opened 1 week ago

motaatmo commented 1 week ago

The bug When calling guidance using an openai model (GPT4o-mini; I didn't try other models yet), lots of output are created, that clutter my own output. It looks HTMLish:


("<||_html:<div style='display: flex; border-bottom: 1px solid rgba(127, 127, "
 "127, 0.2);  justify-content: center; align-items: center;'><div style='flex: "
 "0 0 80px; opacity: 0.5;'>system</div><div style='flex-grow: 1; padding: 5px; "
 'padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: '
 "pre-wrap; margin-bottom: 0px;'>_||>")
("<||_html:<div style='display: flex; border-bottom: 1px solid rgba(127, 127, "
 "127, 0.2);  justify-content: center; align-items: center;'><div style='flex: "
 "0 0 80px; opacity: 0.5;'>system</div><div style='flex-grow: 1; padding: 5px; "
 'padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: '
 "pre-wrap; margin-bottom: 0px;'>_||><||_#NODISP_||><|im_start|>system\n"

To Reproduce

import guidance

model = guidance.models.OpenAI(
    "gpt-4o-mini-2024-07-18",
    api_key=(
        "XXXXXXXXXXXXXXXXXXXX"
    ))

with guidance.user():
    model += "Das ist ein test"

System info (please complete the following information):

hudson-ai commented 6 days ago

Hey @motaatmo thanks for the issue. What context are you running this code in? Jupyter? ipython at the shell? The standard python repl?

motaatmo commented 6 days ago

I called the script using standard python (non-interactive, from the command line)

Hudson Cooper @.***> schrieb am Mo., 16. Sept. 2024, 21:18:

Hey @motaatmo https://github.com/motaatmo thanks for the issue. What context are you running this code in? Jupyter? ipython at the shell? The standard python repl?

— Reply to this email directly, view it on GitHub https://github.com/guidance-ai/guidance/issues/1024#issuecomment-2353725388, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACO5DS2TBOIAMDQOQ722QYDZW4VJNAVCNFSM6AAAAABOHSFLNWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJTG4ZDKMZYHA . You are receiving this because you were mentioned.Message ID: @.***>

hudson-ai commented 6 days ago

Got it. By default, models are quite verbose (and the experience is optimized for Jupyter notebooks -- the command line needs some love...).

For now, you should be able instantiate the model with echo=False to suppress this verbose output:

model = guidance.models.OpenAI(
    "gpt-4o-mini-2024-07-18",
    api_key=(
        "XXXXXXXXXXXXXXXXXXXX"
    ),
    echo=False,
)
motaatmo commented 6 days ago

Works perfectly, thank you!

On Mon, Sep 16, 2024 at 9:54 PM Hudson Cooper @.***> wrote:

Got it. By default, models are quite verbose (and the experience is optimized for Jupyter notebooks -- the command line needs some love...).

For now, you should be able instantiate the model with echo=False to suppress this verbose output:

model = guidance.models.OpenAI( "gpt-4o-mini-2024-07-18", api_key=( "XXXXXXXXXXXXXXXXXXXX" ), echo=False, )

— Reply to this email directly, view it on GitHub https://github.com/guidance-ai/guidance/issues/1024#issuecomment-2353791990, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACO5DS54RA3BTHIWONJNENLZW4ZO7AVCNFSM6AAAAABOHSFLNWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJTG44TCOJZGA . You are receiving this because you were mentioned.Message ID: @.***>