pydantic / logfire

Uncomplicated Observability for Python and beyond! 🪵🔥
https://docs.pydantic.dev/logfire/
MIT License
1.62k stars 46 forks source link

No module named 'openai._legacy_response' #234

Open maximepeabody opened 3 weeks ago

maximepeabody commented 3 weeks ago

Description

I'm trying to integrate with openai. I have openai==1.3.5

I'm seeing this error:

No module named 'openai._legacy_response'

My code is like:

openai_client = openai.Client() logfire.configure() logfire.instrument_openai(openai_client)

Python, Logfire & OS Versions, related packages (not required)

logfire="0.39.0"
platform="macOS-14.4-arm64-arm-64bit"
python="3.10.14 (main, May 24 2024, 14:58:47) [Clang 15.0.0 (clang-1500.3.9.4)]"
[related_packages]
requests="2.31.0"
pydantic="2.7.0"
fastapi="0.109.2"
openai="1.3.5"
protobuf="4.25.3"
rich="13.7.1"
tomli="2.0.1"
executing="2.0.1"
opentelemetry-api="1.25.0"
opentelemetry-exporter-otlp-proto-common="1.25.0"
opentelemetry-exporter-otlp-proto-http="1.25.0"
opentelemetry-instrumentation="0.46b0"
opentelemetry-instrumentation-asgi="0.46b0"
opentelemetry-instrumentation-fastapi="0.46b0"
opentelemetry-proto="1.25.0"
opentelemetry-sdk="1.25.0"
opentelemetry-semantic-conventions="0.46b0"
opentelemetry-util-http="0.46b0"
alexmojaki commented 3 weeks ago

1.3.5 is more than 7 months old (see https://pypi.org/project/openai/1.3.5/), while the latest release is 1.31.0. Any chance you can just upgrade openai?

maximepeabody commented 3 weeks ago

Just tried upgrading, but that didn't work either. I actually had it to 1.31.0 originally, and I was testing out if downgrading would fix it!

alexmojaki commented 3 weeks ago

If I run this code:

import openai
print(openai.__version__)
import openai._legacy_response

it prints 1.31.0 and there's no error.