Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ Each release-gated test class is `skipif`-gated on the env vars its provider nee
| OpenRouter | `OPENROUTER_API_KEY` |
| Perplexity | `PERPLEXITY_API_KEY` (note: tool-calling tests skip — Perplexity API doesn't support tools) |
| MiniMax | `MINIMAX_API_KEY` |
| SiliconFlow | `SILICONFLOW_API_KEY` |
| DashScope (Qwen) | `DASHSCOPE_API_KEY` |
| Jina | `JINA_API_KEY` |
| Voyage | `VOYAGE_API_KEY` |
Expand Down
53 changes: 53 additions & 0 deletions tests/integration/test_chat_completion_real.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,59 @@ async def test_async_streaming(self):
assert len(total_content) > 0


# =============================================================================
# SiliconFlow Tests
# =============================================================================


@pytest.mark.release
@pytest.mark.skipif(
not os.getenv("SILICONFLOW_API_KEY"),
reason="SILICONFLOW_API_KEY not configured",
)
class TestSiliconFlowChat:
"""Real integration tests for SiliconFlow chat and model discovery."""

MODEL = "deepseek-ai/DeepSeek-V3.1-Terminus"

def test_sync_chat_complete(self):
model = AIFactory.create_language("siliconflow", self.MODEL)
response = model.chat_complete(messages=MESSAGES)
assert isinstance(response, ChatCompletion)
assert response.choices[0].message.content

async def test_async_chat_complete(self):
model = AIFactory.create_language("siliconflow", self.MODEL)
response = await model.achat_complete(messages=MESSAGES)
assert isinstance(response, ChatCompletion)
assert response.choices[0].message.content

def test_sync_streaming(self):
model = AIFactory.create_language("siliconflow", self.MODEL)
response = model.chat_complete(messages=MESSAGES, stream=True)
total_content = ""
for chunk in response:
assert isinstance(chunk, ChatCompletionChunk)
if chunk.choices[0].delta.content:
total_content += chunk.choices[0].delta.content
assert total_content

async def test_async_streaming(self):
model = AIFactory.create_language("siliconflow", self.MODEL)
response = await model.achat_complete(messages=MESSAGES, stream=True)
total_content = ""
async for chunk in response:
assert isinstance(chunk, ChatCompletionChunk)
if chunk.choices[0].delta.content:
total_content += chunk.choices[0].delta.content
assert total_content

def test_model_discovery(self):
models = AIFactory.get_provider_models("siliconflow")
assert models
assert any(model.id == self.MODEL for model in models)


# =============================================================================
# MiniMax Tests
# =============================================================================
Expand Down
Loading