From 8b29f9a48b7a2c0ab4f810a54dfa25eda1e095e2 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Mon, 1 Jan 2024 11:12:31 +0530 Subject: [PATCH] (docs) pass metatadata to proxy + openai client --- docs/my-website/docs/proxy/logging.md | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/my-website/docs/proxy/logging.md b/docs/my-website/docs/proxy/logging.md index 577dba1c9..ae46c6433 100644 --- a/docs/my-website/docs/proxy/logging.md +++ b/docs/my-website/docs/proxy/logging.md @@ -524,6 +524,8 @@ curl --location 'http://0.0.0.0:8000/chat/completions' \ +Set `extra_body={"metadata": { }}` to `metadata` you want to pass + ```python import openai client = openai.OpenAI( @@ -532,15 +534,25 @@ client = openai.OpenAI( ) # request sent to model set on litellm proxy, `litellm --model` -response = client.chat.completions.create(model="gpt-3.5-turbo", messages = [ - { - "role": "user", - "content": "this is a test request, write a short poem" +response = client.chat.completions.create( + model="gpt-3.5-turbo", + messages = [ + { + "role": "user", + "content": "this is a test request, write a short poem" + } + ], + extra_body={ + "metadata": { + "generation_name": "ishaan-generation-openai-client", + "generation_id": "openai-client-gen-id22", + "trace_id": "openai-client-trace-id22", + "trace_user_id": "openai-client-user-id2" + } } -]) +) print(response) - ```