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

Using OpenAI API compliant to support vision models #30

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

madroidmaq
Copy link
Contributor

curl

curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer OPENAI_API_KEY" \
  -d '{
    "model": "microsoft/Phi-3.5-vision-instruct",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "What’s in this image?"
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "http://images.cocodataset.org/val2017/000000039769.jpg"
            }
          }
        ]
      }
    ],
    "max_tokens": 300
  }'

response:

{
	"id": "chatcmpl-6a138c4c",
	"object": "chat.completion",
	"created": 1724780023,
	"model": "microsoft/Phi-3.5-vision-instruct",
	"choices": [{
		"index": 0,
		"message": {
			"role": "assistant",
			"content": "The image shows two cats lying on a pink couch. There are two remote controls placed on the couch next to the cats.<|end|>"
		},
		"finish_reason": "stop"
	}],
	"tool_calls": []
}

@madroidmaq madroidmaq changed the title Using OpenAI API protocol to support vision models Using OpenAI API compliant to support vision models Aug 28, 2024
@Blaizzy
Copy link
Collaborator

Blaizzy commented Sep 10, 2024

Hey @madroidmaq

Sorry for the late response, I was unavaible these past couple weeks but I'm back.

Thank you very much for the PR!

@Blaizzy
Copy link
Collaborator

Blaizzy commented Sep 10, 2024

@madroidmaq the style checks are failling, please run:

 pre-commit run --all

@Blaizzy
Copy link
Collaborator

Blaizzy commented Sep 10, 2024

After that, if all tests pass we can merge :)

@madroidmaq
Copy link
Contributor Author

@Blaizzy I have fixed some issues in pre-commit.

@Blaizzy
Copy link
Collaborator

Blaizzy commented Sep 20, 2024

Thanks @madroidmaq!

This is an awesome change. Will simplify multiple images as well.

Copy link
Collaborator

@Blaizzy Blaizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Blaizzy Blaizzy merged commit 0bbcf55 into arcee-ai:main Sep 20, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants