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

Debug mechanism for showing OpenAI responses #286

Closed
simonw opened this issue Sep 19, 2023 · 2 comments
Closed

Debug mechanism for showing OpenAI responses #286

simonw opened this issue Sep 19, 2023 · 2 comments

Comments

@simonw
Copy link
Owner

simonw commented Sep 19, 2023

I figured out a pattern for this here and it's really useful: #284 (comment)

@simonw
Copy link
Owner Author

simonw commented Sep 19, 2023

This is particularly useful for writing tests, since seeing the raw HTTP response from the OpenAI endpoint shows me what I need to mock.

@simonw
Copy link
Owner Author

simonw commented Sep 19, 2023

I'm going to do this with an environment variable:

LLM_OPENAI_SHOW_RESPONSES=1 llm -m chatgpt 'three word slogan for an an otter-run bakery'

Output:

data: {"id":"chatcmpl-80MK5s4E5KmkkskxTKVzEyD1WUcHc","object":"chat.completion.chunk","created":1695096501,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}

data: {"id":"chatcmpl-80MK5s4E5KmkkskxTKVzEyD1WUcHc","object":"chat.completion.chunk","created":1695096501,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"\""},"finish_reason":null}]}

data: {"id":"chatcmpl-80MK5s4E5KmkkskxTKVzEyD1WUcHc","object":"chat.completion.chunk","created":1695096501,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"Fresh"},"finish_reason":null}]}

data: {"id":"chatcmpl-80MK5s4E5KmkkskxTKVzEyD1WUcHc","object":"chat.completion.chunk","created":1695096501,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"ly"},"finish_reason":null}]}

data: {"id":"chatcmpl-80MK5s4E5KmkkskxTKVzEyD1WUcHc","object":"chat.completion.chunk","created":1695096501,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":" B"},"finish_reason":null}]}

data: {"id":"chatcmpl-80MK5s4E5KmkkskxTKVzEyD1WUcHc","object":"chat.completion.chunk","created":1695096501,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"aked"},"finish_reason":null}]}

data: {"id":"chatcmpl-80MK5s4E5KmkkskxTKVzEyD1WUcHc","object":"chat.completion.chunk","created":1695096501,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":" Happiness"},"finish_reason":null}]}

data: {"id":"chatcmpl-80MK5s4E5KmkkskxTKVzEyD1WUcHc","object":"chat.completion.chunk","created":1695096501,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"\""},"finish_reason":null}]}

data: {"id":"chatcmpl-80MK5s4E5KmkkskxTKVzEyD1WUcHc","object":"chat.completion.chunk","created":1695096501,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]


"Freshly Baked Happiness"

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

No branches or pull requests

1 participant