ndrstmr/steg-bundle
最新稳定版本:v0.1.1
Composer 安装命令:
composer require ndrstmr/steg-bundle
包简介
Symfony Bundle for Steg — auto-configuration, profiler panel, and DI integration
README 文档
README
Symfony Bundle for Steg — auto-configuration, profiler panel, and DI integration.
Requirements
- PHP 8.2+
- Symfony 7.0+ or 8.0+
- ndrstmr/steg ^1.0.1 (v1.0.0 has an incompatible
StegClientand is not supported)
Installation
composer require ndrstmr/steg-bundle
Symfony Flex will register the bundle automatically. Without Flex, add it manually:
// config/bundles.php return [ // ... Steg\Bundle\StegBundle::class => ['all' => true], ];
Configuration
Create config/packages/steg.yaml:
steg: connections: vllm_local: dsn: '%env(STEG_VLLM_DSN)%' # e.g. vllm://gpu-server:8000/v1?model=llama-3.3-70b-awq timeout: 120 ollama_dev: dsn: 'ollama://localhost:11434?model=qwen2.5:7b' timeout: 60 mock: dsn: 'mock://default' default_connection: vllm_local
DSN format
| Scheme | Example |
|---|---|
vllm:// |
vllm://gpu-server:8000/v1?model=llama-3.3-70b-awq |
ollama:// |
ollama://localhost:11434?model=qwen2.5:7b |
mock:// |
mock://default |
Alternative: explicit base_url
steg: connections: vllm_local: base_url: '%env(VLLM_BASE_URL)%' model: '%env(VLLM_MODEL_NAME)%' api_key: '%env(VLLM_API_KEY)%' timeout: 120
Usage
Autowiring (default connection)
use Steg\Client\InferenceClientInterface; use Steg\Model\ChatMessage; final class MyService { public function __construct( private readonly InferenceClientInterface $steg, ) {} public function translate(string $text): string { $response = $this->steg->complete([ ChatMessage::system('You are a translation assistant.'), ChatMessage::user($text), ]); return $response->content; } }
Named connections via #[Autowire]
use Steg\Client\InferenceClientInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; final class MyService { public function __construct( #[Autowire(service: 'steg.client.vllm_local')] private readonly InferenceClientInterface $vllm, #[Autowire(service: 'steg.client.ollama_dev')] private readonly InferenceClientInterface $ollama, ) {} }
Available service IDs
| Service ID | Description |
|---|---|
steg.client.{name} |
Named connection client |
steg.client |
Alias for the default connection |
Steg\Client\InferenceClientInterface |
Alias for the default connection |
Symfony Profiler
When StegDataCollector is wired, the Symfony Profiler shows a Steg panel with:
- Request count and total duration
- Prompt and completion token usage
- Per-request timeline (connection, model, duration, tokens, response preview)
To enable profiling, decorate your client services with ProfilingClient in the DI configuration.
License
EUPL-1.2 — see LICENSE.
Built by 👾 public sector dev crew
Notice
This repository was developed with the assistance of AI code agents (Claude Code, Anthropic). The code was created as part of a development sprint and is not cleared for production use without prior review. Use at your own risk.
License: European Union Public Licence v. 1.2 (EUPL-1.2) — Copyright © 2026 Andreas Teumer
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 1
其他信息
- 授权协议: EUPL-1.2
- 更新时间: 2026-05-06