Update OpenAI client to use stable API and bump minimum version to 2.0.0
- Remove beta prefix from completions.parse - Update OpenAI dependency to >=2.0.0 - Fix whitespace formatting - Update all requirement files - Clean up pyproject.toml dependencies
This commit is contained in:
parent
9f69c5bf85
commit
02fdceb959
6 changed files with 17 additions and 13 deletions
|
|
@ -90,7 +90,7 @@ async def azure_openai_complete_if_cache(
|
||||||
messages.append({"role": "user", "content": prompt})
|
messages.append({"role": "user", "content": prompt})
|
||||||
|
|
||||||
if "response_format" in kwargs:
|
if "response_format" in kwargs:
|
||||||
response = await openai_async_client.beta.chat.completions.parse(
|
response = await openai_async_client.chat.completions.parse(
|
||||||
model=model, messages=messages, **kwargs
|
model=model, messages=messages, **kwargs
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ async def openai_complete_if_cache(
|
||||||
try:
|
try:
|
||||||
# Don't use async with context manager, use client directly
|
# Don't use async with context manager, use client directly
|
||||||
if "response_format" in kwargs:
|
if "response_format" in kwargs:
|
||||||
response = await openai_async_client.beta.chat.completions.parse(
|
response = await openai_async_client.chat.completions.parse(
|
||||||
model=model, messages=messages, **kwargs
|
model=model, messages=messages, **kwargs
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|
@ -492,7 +492,9 @@ async def openai_complete_if_cache(
|
||||||
reasoning_content = safe_unicode_decode(
|
reasoning_content = safe_unicode_decode(
|
||||||
reasoning_content.encode("utf-8")
|
reasoning_content.encode("utf-8")
|
||||||
)
|
)
|
||||||
final_content = f"<think>{reasoning_content}</think>{final_content}"
|
final_content = (
|
||||||
|
f"<think>{reasoning_content}</think>{final_content}"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
# COT disabled, only use regular content
|
# COT disabled, only use regular content
|
||||||
final_content = content or ""
|
final_content = content or ""
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ api = [
|
||||||
"nano-vectordb",
|
"nano-vectordb",
|
||||||
"networkx",
|
"networkx",
|
||||||
"numpy>=1.24.0,<2.0.0",
|
"numpy>=1.24.0,<2.0.0",
|
||||||
"openai>=1.0.0,<3.0.0",
|
"openai>=2.0.0,<3.0.0",
|
||||||
"pandas>=2.0.0,<2.4.0",
|
"pandas>=2.0.0,<2.4.0",
|
||||||
"pipmaster",
|
"pipmaster",
|
||||||
"pydantic",
|
"pydantic",
|
||||||
|
|
@ -115,7 +115,7 @@ offline-storage = [
|
||||||
|
|
||||||
offline-llm = [
|
offline-llm = [
|
||||||
# LLM provider dependencies
|
# LLM provider dependencies
|
||||||
"openai>=1.0.0,<3.0.0",
|
"openai>=2.0.0,<3.0.0",
|
||||||
"anthropic>=0.18.0,<1.0.0",
|
"anthropic>=0.18.0,<1.0.0",
|
||||||
"ollama>=0.1.0,<1.0.0",
|
"ollama>=0.1.0,<1.0.0",
|
||||||
"zhipuai>=2.0.0,<3.0.0",
|
"zhipuai>=2.0.0,<3.0.0",
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,6 @@ google-api-core>=2.0.0,<3.0.0
|
||||||
google-genai>=1.0.0,<2.0.0
|
google-genai>=1.0.0,<2.0.0
|
||||||
llama-index>=0.9.0,<1.0.0
|
llama-index>=0.9.0,<1.0.0
|
||||||
ollama>=0.1.0,<1.0.0
|
ollama>=0.1.0,<1.0.0
|
||||||
openai>=1.0.0,<3.0.0
|
openai>=2.0.0,<3.0.0
|
||||||
voyageai>=0.2.0,<1.0.0
|
voyageai>=0.2.0,<1.0.0
|
||||||
zhipuai>=2.0.0,<3.0.0
|
zhipuai>=2.0.0,<3.0.0
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ google-genai>=1.0.0,<2.0.0
|
||||||
llama-index>=0.9.0,<1.0.0
|
llama-index>=0.9.0,<1.0.0
|
||||||
neo4j>=5.0.0,<7.0.0
|
neo4j>=5.0.0,<7.0.0
|
||||||
ollama>=0.1.0,<1.0.0
|
ollama>=0.1.0,<1.0.0
|
||||||
openai>=1.0.0,<3.0.0
|
openai>=2.0.0,<3.0.0
|
||||||
openpyxl>=3.0.0,<4.0.0
|
openpyxl>=3.0.0,<4.0.0
|
||||||
pycryptodome>=3.0.0,<4.0.0
|
pycryptodome>=3.0.0,<4.0.0
|
||||||
pymilvus>=2.6.2,<3.0.0
|
pymilvus>=2.6.2,<3.0.0
|
||||||
|
|
|
||||||
8
uv.lock
generated
8
uv.lock
generated
|
|
@ -2735,7 +2735,6 @@ requires-dist = [
|
||||||
{ name = "json-repair", marker = "extra == 'api'" },
|
{ name = "json-repair", marker = "extra == 'api'" },
|
||||||
{ name = "langfuse", marker = "extra == 'observability'", specifier = ">=3.8.1" },
|
{ name = "langfuse", marker = "extra == 'observability'", specifier = ">=3.8.1" },
|
||||||
{ name = "lightrag-hku", extras = ["api", "offline-llm", "offline-storage"], marker = "extra == 'offline'" },
|
{ name = "lightrag-hku", extras = ["api", "offline-llm", "offline-storage"], marker = "extra == 'offline'" },
|
||||||
{ name = "lightrag-hku", extras = ["pytest"], marker = "extra == 'evaluation'" },
|
|
||||||
{ name = "llama-index", marker = "extra == 'offline-llm'", specifier = ">=0.9.0,<1.0.0" },
|
{ name = "llama-index", marker = "extra == 'offline-llm'", specifier = ">=0.9.0,<1.0.0" },
|
||||||
{ name = "nano-vectordb" },
|
{ name = "nano-vectordb" },
|
||||||
{ name = "nano-vectordb", marker = "extra == 'api'" },
|
{ name = "nano-vectordb", marker = "extra == 'api'" },
|
||||||
|
|
@ -2745,14 +2744,15 @@ requires-dist = [
|
||||||
{ name = "numpy", specifier = ">=1.24.0,<2.0.0" },
|
{ name = "numpy", specifier = ">=1.24.0,<2.0.0" },
|
||||||
{ name = "numpy", marker = "extra == 'api'", specifier = ">=1.24.0,<2.0.0" },
|
{ name = "numpy", marker = "extra == 'api'", specifier = ">=1.24.0,<2.0.0" },
|
||||||
{ name = "ollama", marker = "extra == 'offline-llm'", specifier = ">=0.1.0,<1.0.0" },
|
{ name = "ollama", marker = "extra == 'offline-llm'", specifier = ">=0.1.0,<1.0.0" },
|
||||||
{ name = "openai", marker = "extra == 'api'", specifier = ">=1.0.0,<3.0.0" },
|
{ name = "openai", marker = "extra == 'api'", specifier = ">=2.0.0,<3.0.0" },
|
||||||
{ name = "openai", marker = "extra == 'offline-llm'", specifier = ">=1.0.0,<3.0.0" },
|
{ name = "openai", marker = "extra == 'offline-llm'", specifier = ">=2.0.0,<3.0.0" },
|
||||||
{ name = "openpyxl", marker = "extra == 'api'", specifier = ">=3.0.0,<4.0.0" },
|
{ name = "openpyxl", marker = "extra == 'api'", specifier = ">=3.0.0,<4.0.0" },
|
||||||
{ name = "pandas", specifier = ">=2.0.0,<2.4.0" },
|
{ name = "pandas", specifier = ">=2.0.0,<2.4.0" },
|
||||||
{ name = "pandas", marker = "extra == 'api'", specifier = ">=2.0.0,<2.4.0" },
|
{ name = "pandas", marker = "extra == 'api'", specifier = ">=2.0.0,<2.4.0" },
|
||||||
{ name = "passlib", extras = ["bcrypt"], marker = "extra == 'api'" },
|
{ name = "passlib", extras = ["bcrypt"], marker = "extra == 'api'" },
|
||||||
{ name = "pipmaster" },
|
{ name = "pipmaster" },
|
||||||
{ name = "pipmaster", marker = "extra == 'api'" },
|
{ name = "pipmaster", marker = "extra == 'api'" },
|
||||||
|
{ name = "pre-commit", marker = "extra == 'evaluation'" },
|
||||||
{ name = "pre-commit", marker = "extra == 'pytest'" },
|
{ name = "pre-commit", marker = "extra == 'pytest'" },
|
||||||
{ name = "psutil", marker = "extra == 'api'" },
|
{ name = "psutil", marker = "extra == 'api'" },
|
||||||
{ name = "pycryptodome", marker = "extra == 'api'", specifier = ">=3.0.0,<4.0.0" },
|
{ name = "pycryptodome", marker = "extra == 'api'", specifier = ">=3.0.0,<4.0.0" },
|
||||||
|
|
@ -2764,7 +2764,9 @@ requires-dist = [
|
||||||
{ name = "pypdf", marker = "extra == 'api'", specifier = ">=6.1.0" },
|
{ name = "pypdf", marker = "extra == 'api'", specifier = ">=6.1.0" },
|
||||||
{ name = "pypinyin" },
|
{ name = "pypinyin" },
|
||||||
{ name = "pypinyin", marker = "extra == 'api'" },
|
{ name = "pypinyin", marker = "extra == 'api'" },
|
||||||
|
{ name = "pytest", marker = "extra == 'evaluation'", specifier = ">=8.4.2" },
|
||||||
{ name = "pytest", marker = "extra == 'pytest'", specifier = ">=8.4.2" },
|
{ name = "pytest", marker = "extra == 'pytest'", specifier = ">=8.4.2" },
|
||||||
|
{ name = "pytest-asyncio", marker = "extra == 'evaluation'", specifier = ">=1.2.0" },
|
||||||
{ name = "pytest-asyncio", marker = "extra == 'pytest'", specifier = ">=1.2.0" },
|
{ name = "pytest-asyncio", marker = "extra == 'pytest'", specifier = ">=1.2.0" },
|
||||||
{ name = "python-docx", marker = "extra == 'api'", specifier = ">=0.8.11,<2.0.0" },
|
{ name = "python-docx", marker = "extra == 'api'", specifier = ">=0.8.11,<2.0.0" },
|
||||||
{ name = "python-dotenv" },
|
{ name = "python-dotenv" },
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue