module

LLM::Adapter

A normalized adapter interface for LLM clients.

Implementations should return a String response (JSON text after any provider-specific cleanup).

Class methods

messages(system : String | Nil, user : String) : Messages
Source

Instance methods

close

Optional cleanup hook for adapters that manage external resources.

Source
request(prompt : String, format : String = "json") : String

Send a single prompt and get a response as a String.

Source
request_bundle(system : String, user : String, format : String) : String

A bundle request: like request_with_context, but an adapter that can tell raises LLM::ContextOverflow instead of returning "", so the bundle can be re-split rather than lost.

Source
request_messages(messages : Messages, format : String = "json") : String

Send chat-style messages (system/user) and get a response as a String.

Source
request_messages_with_tools(messages : Messages, _tools : String) : String

Request next step using provider-native tool definitions. Implementations that do not support this can fallback to regular JSON-mode requests.

Source
request_with_context(system : String | Nil, user : String, format : String = "json") : String

A single system + user request.

Source
supports_native_tool_calling?

Whether this adapter can leverage provider-native tool-calling.

Source

Nested types