Skip to content

Commit 1c7f2e0

Browse files
gustavocidornelaswhoseoyster
authored andcommitted
Fixes OPEN-5845 Issues caused by openai.beta type hints
1 parent a202e1b commit 1c7f2e0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

openlayer/llm_monitors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def _overwrite_completion_methods(self) -> None:
393393
)
394394
self.openai_client.completions.create = self.modified_create_completion
395395

396-
def monitor_thread_run(self, run: openai.types.beta.threads.run.Run) -> None:
396+
def monitor_thread_run(self, run: "openai.types.beta.threads.run.Run") -> None:
397397
"""Monitor a run from an OpenAI assistant.
398398
399399
Once the run is completed, the thread data is published to Openlayer,
@@ -428,13 +428,13 @@ def monitor_thread_run(self, run: openai.types.beta.threads.run.Run) -> None:
428428
except Exception as e:
429429
print(f"Failed to monitor run. {e}")
430430

431-
def _type_check_run(self, run: openai.types.beta.threads.run.Run) -> None:
431+
def _type_check_run(self, run: "openai.types.beta.threads.run.Run") -> None:
432432
"""Validate the run object."""
433433
if not isinstance(run, openai.types.beta.threads.run.Run):
434434
raise ValueError(f"Expected a Run object, but got {type(run)}.")
435435

436436
def _extract_run_vars(
437-
self, run: openai.types.beta.threads.run.Run
437+
self, run: "openai.types.beta.threads.run.Run"
438438
) -> Dict[str, any]:
439439
"""Extract the variables from the run object."""
440440
return {
@@ -453,7 +453,7 @@ def _extract_run_vars(
453453
}
454454

455455
def _extract_run_metadata(
456-
self, run: openai.types.beta.threads.run.Run
456+
self, run: "openai.types.beta.threads.run.Run"
457457
) -> Dict[str, any]:
458458
"""Extract the metadata from the run object."""
459459
return {
@@ -463,7 +463,7 @@ def _extract_run_metadata(
463463

464464
@staticmethod
465465
def thread_messages_to_prompt(
466-
messages: List[openai.types.beta.threads.thread_message.ThreadMessage],
466+
messages: List["openai.types.beta.threads.thread_message.ThreadMessage"],
467467
) -> List[Dict[str, str]]:
468468
"""Given list of ThreadMessage, return its contents in the `prompt` format,
469469
i.e., a list of dicts with 'role' and 'content' keys."""

0 commit comments

Comments
 (0)