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

How to get JSON mode working for Open AI Vision #676

Open
mingsterism opened this issue Mar 5, 2024 · 2 comments
Open

How to get JSON mode working for Open AI Vision #676

mingsterism opened this issue Mar 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@mingsterism
Copy link

is there any support for JSON mode in vision preview? i've tried to get it working with GPT4Turbo1106 as well but it does not work. below is my example

	resp, err := client.CreateChatCompletion(
		context.Background(),
		openai.ChatCompletionRequest{
			Model:     openai.GPT4Turbo1106,
			MaxTokens: 1000,
			Messages: []openai.ChatCompletionMessage{
				{
					Role: openai.ChatMessageRoleUser,
					MultiContent: []openai.ChatMessagePart{
						{
							Type: openai.ChatMessagePartTypeText,
							Text: text,
						},
						{
							Type: openai.ChatMessagePartTypeImageURL,
							ImageURL: &openai.ChatMessageImageURL{
								URL:    imgString2,
								Detail: openai.ImageURLDetailLow,
							},
						},
					},
				},
			},
			Tools: []openai.Tool{t},
			//ResponseFormat: &openai.ChatCompletionResponseFormat{
			//	Type: openai.ChatCompletionResponseFormatTypeJSONObject,
			//},
		},
	)

@mingsterism mingsterism added the bug Something isn't working label Mar 5, 2024
@HelloTQ
Copy link

HelloTQ commented May 6, 2024

has the error been fixed?

@rasmusviben
Copy link

Working for me with the new GPT4o model and if I specify in the "text" that the output should be json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants