mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-06-03 06:29:55 +08:00
feat: enhance openai-compatible provider support and patch responses API instructions handling
- Add compatibility patch for langchain-openai responses API to ensure system messages are extracted as top-level instructions, addressing Codex endpoint requirements. - Update provider list: add Alibaba, Volcengine, and Tencent TokenHub; adjust SiliconFlow and MiniMax endpoints; refine provider ordering and model list strategies. - Extend models.dev-only listing logic for providers lacking stable models.list endpoints. - Increase models.dev cache TTL for improved efficiency. - Add tests for openai responses API and streaming compatibility patches.
This commit is contained in:
9
test_openai_copilot_patch.py
Normal file
9
test_openai_copilot_patch.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from app.agent.llm.helper import _patch_openai_responses_instructions_support
|
||||
from langchain_openai import ChatOpenAI
|
||||
from langchain_core.messages import SystemMessage, HumanMessage
|
||||
import json
|
||||
|
||||
_patch_openai_responses_instructions_support()
|
||||
model = ChatOpenAI(model="gpt-4o", openai_api_key="sk-123", base_url="https://api.githubcopilot.com", stream_usage=True)
|
||||
payload = model._get_request_payload([SystemMessage(content="Hello system"), HumanMessage(content="Hello user")])
|
||||
print(json.dumps(payload, indent=2))
|
||||
Reference in New Issue
Block a user