mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 07:09:31 +00:00
Same as https://github.com/langchain-ai/langchain/pull/29043 for langchain-community. **Dependencies:** - blockbuster (test) **Twitter handle:** cbornet_ Co-authored-by: Erick Friis <erick@langchain.dev>
14 lines
298 B
Python
14 lines
298 B
Python
from __future__ import annotations
|
|
|
|
import functools
|
|
from importlib.metadata import version
|
|
|
|
from packaging.version import parse
|
|
|
|
|
|
@functools.cache
|
|
def is_openai_v1() -> bool:
|
|
"""Return whether OpenAI API is v1 or more."""
|
|
_version = parse(version("openai"))
|
|
return _version.major >= 1
|