Gateway
ractogateway.gateway — Unified Gateway Runner.
Orchestrates prompt compilation, adapter selection, tool injection, and response standardization into a single high-level interface.
- class ractogateway.gateway.Gateway(adapter, *, tools=None, default_prompt=None)[source]
Bases:
objectUnified entry point that wraps any
BaseLLMAdapter.- Parameters:
adapter (
BaseLLMAdapter) – A concrete adapter instance (OpenAILLMKit,GoogleLLMKit,AnthropicLLMKit).tools (
ToolRegistry|None) – An optionalToolRegistrycontaining registered tools that the LLM is allowed to call.default_prompt (
RactoPrompt|None) – An optionalRactoPromptto use whenrun()is called without an explicit prompt.Usage:: –
from ractogateway import RactoPrompt, Gateway from ractogateway.adapters import OpenAILLMKit
adapter = OpenAILLMKit(model=”gpt-4o”, api_key=”sk-…”) prompt = RactoPrompt(…) gw = Gateway(adapter=adapter)
response = gw.run(prompt, “Analyse this code for bugs.”) print(response.parsed) # auto-parsed JSON dict
- run(prompt=None, user_message='', *, tools=None, temperature=0.0, max_tokens=4096, response_model=None, **kwargs)[source]
Execute a request and return a standardised
LLMResponse.- Parameters:
prompt (
RactoPrompt|None) – The RACTO prompt. Falls back todefault_prompt.user_message (
str) – The end-user’s query.tools (
ToolRegistry|None) – Override the gateway-level tool registry for this call.temperature (
float) – Sampling temperature.max_tokens (
int) – Maximum tokens in the response.response_model (
type[BaseModel] |None) – Optional Pydantic model to validateparsedoutput against. If provided and the LLM returns valid JSON, it is validated through this model and attached toresponse.parsed.**kwargs (
Any) – Passed through to the adapter.
- Return type: