Pool
infra.llm.providers.open_router.pool
Summary
OpenRouter pool adaptors.
Wire OpenRouter configuration and model ports into the synchronous and asynchronous LLM pool adaptors.
Classes
AsyncOpenRouterPool
Bases: AsyncPoolAdaptor
Asynchronous LLM pool backed by OpenRouter.
Initialize the pool with OpenRouter defaults.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs |
Overrides for the client and model ports. |
{}
|
Functions
generate
async
Generate text for a prompt asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt |
str
|
User prompt text. |
required |
system_prompt |
Optional[str]
|
Optional system instruction. |
None
|
max_tokens |
Optional[int]
|
Token cap overriding model defaults. |
None
|
models |
Optional[list]
|
Model ports overriding the pool defaults. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Generated content. |
SyncOpenRouterPool
Bases: PoolAdaptor
Synchronous LLM pool backed by OpenRouter.
Initialize the pool with OpenRouter defaults.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs |
Overrides for the client and model ports. |
{}
|
Functions
generate
Generate text for a prompt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt |
str
|
User prompt text. |
required |
system_prompt |
Optional[str]
|
Optional system instruction. |
None
|
max_tokens |
Optional[int]
|
Token cap overriding model defaults. |
None
|
models |
Optional[list]
|
Model ports overriding the pool defaults. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Generated content. |