tbckr / sgpt

SGPT is a command-line tool that provides a convenient way to interact with OpenAI models, enabling users to run queries, generate shell commands and produce code directly from the terminal.
MIT License
210 stars 23 forks source link

GPT 4 Vision examples do not run #195

Closed NightMachinery closed 7 months ago

NightMachinery commented 7 months ago

What happened?

$ go install github.com/tbckr/sgpt/cmd/sgpt@latest

$ sgpt -m "gpt-4-vision-preview" -i "https://upload.wikimedia.org/wikipedia/en/c/cb/Marvin_%28HHGG%29.jpg" "what can you see on the picture?"
unknown command "what can you see on the picture?" for "sgpt"

How can we reproduce this?

_

sgpt version

version: dev
commit: unset
commitDate: unset


### Search

- [X] I did search for other open and closed issues before opening this

### Project

- [X] I have verified that I am using the Go implementation of SGPT (this project) and that it is not another project

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

### Additional context

_No response_
tbckr commented 7 months ago

Hey, thanks for your bug report. It seems like you are using an old version of SGPT. Please install the latest version of SGPT and test again.

tbckr commented 7 months ago

Ah, I think you found an error in the docs.

Could you please try the following command to install the latest version:

go install github.com/tbckr/sgpt/v2/cmd/sgpt@latest

tbckr commented 7 months ago

I am going to close this issue. If it still does not work, please feel free to reopen the issue.

NightMachinery commented 6 months ago

@tbckr Indeed, the problem went away when I installed v2. However, the outputs are truncated very shortly for my requests:

> command sgpt --temperature 0 --max-tokens 40000 -m gpt-4-vision-preview -v -i 1.png 'This is a screenshot of a part of a paper. Rewrite it in org-mode. You can use `\( ... \)` to insert inline LaTeX.'

time=2024-01-16T10:38:20.785+03:30 level=DEBUG msg="Loading config"
time=2024-01-16T10:38:20.785+03:30 level=DEBUG msg="Config file not found - using defaults"
time=2024-01-16T10:38:20.785+03:30 level=DEBUG msg="No mode provided via command line args - using default mode"
time=2024-01-16T10:38:20.785+03:30 level=DEBUG msg="Chat session manager initialized"
time=2024-01-16T10:38:20.785+03:30 level=DEBUG msg="OpenAI client created"
time=2024-01-16T10:38:20.785+03:30 level=DEBUG msg="Loading personas from path: /Users/evar/Library/Application Support/sgpt/personas"
time=2024-01-16T10:38:20.785+03:30 level=DEBUG msg="could not find custom persona"
time=2024-01-16T10:38:20.785+03:30 level=DEBUG msg="Loaded default prompts"
time=2024-01-16T10:38:20.785+03:30 level=DEBUG msg="No persona provided"
time=2024-01-16T10:38:20.785+03:30 level=WARN msg="The GPT-4 Vision API is in beta and may not work as expected"
time=2024-01-16T10:38:20.785+03:30 level=DEBUG msg="Added prompt message"
time=2024-01-16T10:38:20.785+03:30 level=DEBUG msg="Added prompt message"
time=2024-01-16T10:38:24.175+03:30 level=DEBUG msg="Received response"
Certainly! Here is the content of the image written in Org-mode with LaTeX:

time=2024-01-16T10:38:24.175+03:30 level=DEBUG msg="Printed response"
time=2024-01-16T10:38:24.175+03:30 level=DEBUG msg="Received message from OpenAI API"

Should I open another issue?

tbckr commented 6 months ago

Hi @NightMachinery, I oberserved the same issue. I think it is an issue in the OpenAI API. You can open an issue if you want to.

NightMachinery commented 6 months ago

@tbckr No, I am certain it's a bug here. I have sent requests using their own Python library and it's okay. But the default for the max returned tokens is different in the API (and much lower). So there is a need to set this parameter correctly.