Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
a06bdca to
622b76a
Compare
|
@codex review |
|
@seratch ready for review! |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting |
seratch
left a comment
There was a problem hiding this comment.
Looks good to me; I've confirmed the image_url works with data URL too (using the code from local_image.py).
|
If you want to add data URL example too, something like this works, but it's nice-to-have: FILEPATH = os.path.join(os.path.dirname(__file__), "media/image_bison.jpg")
def image_to_base64(image_path):
with open(image_path, "rb") as image_file:
encoded_string = base64.b64encode(image_file.read()).decode("utf-8")
return encoded_string
@function_tool
def fetch_random_image() -> ToolOutputImage | ToolOutputImageDict:
"""Fetch a random image."""
print("Image tool called")
b64_image = image_to_base64(FILEPATH)
return {
"type": "image",
"image_url": f"data:image/jpeg;base64,{b64_image}",
"detail": "auto",
} |
|
I am a bit confused how this will work. I tried return a list of PIL images but the model seems did not get them |
To allow the new output types for image/file, you can now return one of the three new types (or lists of those types, or even a typed dict version). If you use those, we'll convert to the correct tool call output type.
Resolves #1850