Log in
Log into community
Welcome to Portkey Forum
New post
View all posts
Related posts
Was this helpful?
😞
😐
😃
Powered by
Hall
Inactive
Updated 2 months ago
0
Follow
Passing Metadata with Prompt/Completions Endpoint Using Portkey Python SDK
Passing Metadata with Prompt/Completions Endpoint Using Portkey Python SDK
Inactive
0
Follow
At a glance
H
Harold Senzei
2 months ago
·
How do we pass metadata with prompt/completions endpoint? The sdk forces the headers to empty dict
https://github.com/Portkey-AI/portkey-python-sdk/blob/1174d2f45be2f3559927b719d406e2fdb264a44f/portkey_ai/api_resources/apis/generation.py#L249
H
s
5 comments
Share
Open in Discord
H
Harold Senzei
2 months ago
One solution I found is to create a copy of the client for each request using
.with_options
and pass the metadata.
Would this be the correct approach?
s
sega
2 months ago
yes! with_options is the correct way
s
sega
2 months ago
if you dont want to initialize the client again
s
sega
2 months ago
but internally it also creates another client instance only
H
Harold Senzei
2 months ago
any specific reason the headers are being set to
{}
in the sdk? if they were not removed we can pass the metadata using header kwarg
Add a reply
Sign up and join the conversation on Discord
Join on Discord