Welcome to Portkey Forum

Updated 2 months ago

Chat Completion Trick Involves Passing Image Metadata

At a glance
Any known issue or different trick to get user to show for image generation? For chat completion I just pass it in metadata. Tried to do the same
Attachment
image.png
V
G
9 comments
Confirming that the following code works for image gen:

Plain Text
from portkey_ai import Portkey

client = Portkey(
    api_key = "...",
    virtual_key = "...",
    metadata={"_user":"gijs"}
)

client.images.generate(
  model="dall-e-3",
  prompt="A cute baby sea otter",
  n=1,
  size="1024x1024"
)
Attachment
CleanShot_2024-12-23_at_21.55.142x.png
Check this doc:
Attachment
CleanShot_2024-12-23_at_21.56.262x.png
Oh interesting! In chat completions I'm passing it in the request itself.

This works though, thanks
from portkey_ai import Portkey

client = Portkey(
api_key = "...",
virtual_key = "...",
)

client.images.generate(
model="dall-e-3",
prompt="A cute baby sea otter",
n=1,
size="1024x1024"
metadata={"_user":"gijs"}
)
This is what I'm doing for chat, and actually I think that's what the doc says too
But problem solved, thnx!
Oh yeah this would work too!
Add a reply
Sign up and join the conversation on Discord