What's the best way to check if an openai.Client()
was patched by instructor?
#457
-
I want to know if there's a good way to programmatically check if an For example: import instructor
import openai
openai_client = openai.Client()
# openai_client is the original OpenAI client -> so its chat.completions.create method will return a `ChatCompletion` object
patched_client = instructor.patch(openai_client)
# patched_client was patched by instructor -> so its chat.completions.create method might return an object defined by `response_model` I'd like to know what's the best way to write a function like is_patched_client(openai_client)
# returns False
is_patched_client(patched_client)
# returns True I can obviously check the type of the object I get from Any help is appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
this will be possible in 1.0 if you can wait a week or so! It'll be
|
Beta Was this translation helpful? Give feedback.
this will be possible in 1.0 if you can wait a week or so! It'll be
type(client) == InstructorOpenAI