Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AGE-162] Add instrumentation for OpenAI #1594

Open
mmabrouk opened this issue May 1, 2024 · 1 comment
Open

[AGE-162] Add instrumentation for OpenAI #1594

mmabrouk opened this issue May 1, 2024 · 1 comment
Assignees
Labels
5 points Created by Linear-GitHub Sync enhancement New feature or request feature Medium priority Created by Linear-GitHub Sync

Comments

@mmabrouk
Copy link
Member

mmabrouk commented May 1, 2024

We would like instrumentation for the OpenAI library. First we need to assess the different options. I see the following implementation patterns:

  • Monkey patching (I think baserun do that)
  • Providing another implementation (Langfuse and helicone do that)
  • Providing a wrapper (Langsmith does that)

From SyncLinear.com | AGE-162

@mmabrouk mmabrouk added feature Medium priority Created by Linear-GitHub Sync labels May 1, 2024
@dosubot dosubot bot added the enhancement New feature or request label May 1, 2024
@mmabrouk mmabrouk added the 5 points Created by Linear-GitHub Sync label May 12, 2024
@mmabrouk mmabrouk added this to the v.45 milestone May 12, 2024
@mmabrouk
Copy link
Member Author

Solution used in Logfire:

import openai
import logfire

client = openai.Client()

logfire.instrument_openai(client)  

response = client.chat.completions.create(
    model='gpt-4',
    messages=[
        {'role': 'system', 'content': 'You are a helpful assistant.'},
        {'role': 'user', 'content': 'Please write me a limerick about Python logging.'},
    ],
)
print(response.choices[0].message)

@mmabrouk mmabrouk modified the milestones: v.45, v.46, v.47 May 19, 2024
@mmabrouk mmabrouk modified the milestones: v.47, v.48 Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 points Created by Linear-GitHub Sync enhancement New feature or request feature Medium priority Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

2 participants