Skip to content

Commit

Permalink
Update metadata.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ayush-portkey authored Jun 16, 2023
1 parent 8e57486 commit 4b8a886
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ All predefined keys should be of type String, with max-length as 128 characters.

## Proxy Metadata

To include metadata in the proxy requests, you can add an `x-portkey-meta` header with a JSON string containing your metadata. Portkey will parse the JSON object and make it available for filtering.
To include metadata in the proxy requests, you can add an `x-portkey-metadata` header with a JSON string containing your metadata. Portkey will parse the JSON object and make it available for filtering.

For the JavaScript library, use the following sample code:

Expand All @@ -20,7 +20,7 @@ const configuration = new Configuration({
headers: {
"x-portkey-api-key": "<YOUR PORTKEY API KEY>", // Can be obtained from your account
"x-portkey-mode": "proxy openai", // Instructs Portkey to proxy your request to OpenAI
"x-portkey-meta": JSON.stringify({"_environment": "production", "foo": "abc", "bar": "def"}) //Enables filtering on _environment
"x-portkey-metadata": JSON.stringify({"_environment": "production", "foo": "abc", "bar": "def"}) //Enables filtering on _environment
}
}
});
Expand All @@ -44,7 +44,7 @@ response = openai.ChatCompletion.create(
headers={ # Add Portkey headers for authentication and proxy mode
"x-portkey-api-key": "<YOUR PORTKEY API KEY>",
"x-portkey-mode": "proxy openai",
"x-portkey-meta": json.dumps({"_environment": "production", "foo": "abc", "bar": "def"}) # Enables filtering on _environment
"x-portkey-metadata": json.dumps({"_environment": "production", "foo": "abc", "bar": "def"}) # Enables filtering on _environment
}
)
```
Expand Down

0 comments on commit 4b8a886

Please sign in to comment.