Chainlit / literalai-python

https://docs.getliteral.ai/
Apache License 2.0
12 stars 0 forks source link

feat: Add support for tags with OpenAI Instrumentation #63

Closed Granipouss closed 6 months ago

Granipouss commented 6 months ago

https://linear.app/chainlit/issue/ENG-1145/openai-instrumentation-with-metadata-and-tags

In the wrapper we have to remove extra arguments because OpenAI throws if we don't.

Documentation incoming...


This change is Reviewable

linear[bot] commented 6 months ago
ENG-1145 OpenAI Instrumentation with metadata and tags

``` import os from literalai import LiteralClient from openai import OpenAI openai_client = OpenAI( api_key=) literal_client = LiteralClient( api_key=) literal_client.instrument_openai() query = "What's 2+2?" messages = [{"role": "user", "content": query}] res = openai_client.chat.completions.create( messages=messages, model="gpt-4", extra_query={ "user-category": "2" }, #extra_body #extra_headers ) print(res) ``` This is important for ppl only using the instrumentation. How do they pass in the user, metadata or tags? Is this possible? Is this also an advantage for having an AI proxy? DoD: * Recommendation on how to tackle this use case.

Granipouss commented 6 months ago

Requires https://github.com/Chainlit/chainlit-cloud/pull/456