13#include <asio/awaitable.hpp>
20namespace neograph::graph {
class CancelToken; }
39 RateLimitError(
const std::string& message,
int retry_after_seconds = -1)
40 : std::runtime_error(message)
41 , retry_after_seconds_(retry_after_seconds) {}
47 int retry_after_seconds_;
150 [[deprecated(
"v1.0 single-dispatch: use invoke(params, nullptr) — see ROADMAP_v1.md Candidate 6")]]
175 [[deprecated(
"v1.0 single-dispatch: use invoke(params, nullptr) — see ROADMAP_v1.md Candidate 6")]]
176 virtual asio::awaitable<ChatCompletion>
200 [[deprecated(
"v1.0 single-dispatch: use invoke(params, on_chunk) — see ROADMAP_v1.md Candidate 6")]]
261 [[deprecated(
"v1.0 single-dispatch: use invoke(params, on_chunk) — see ROADMAP_v1.md Candidate 6")]]
262 virtual asio::awaitable<ChatCompletion>
310 virtual asio::awaitable<ChatCompletion>
NEOGRAPH_API export/import macro for shared-library builds.
Abstract base class for LLM providers.
virtual asio::awaitable< ChatCompletion > complete_async(const CompletionParams ¶ms)
Perform an LLM completion as a coroutine.
virtual std::string get_name() const =0
Get the provider name (e.g., "openai", "claude").
virtual ChatCompletion complete(const CompletionParams ¶ms)
Perform a synchronous LLM completion.
virtual ChatCompletion complete_stream(const CompletionParams ¶ms, const StreamCallback &on_chunk)
Perform a streaming LLM completion.
virtual asio::awaitable< ChatCompletion > complete_stream_async(const CompletionParams ¶ms, const StreamCallback &on_chunk)
Async streaming completion.
virtual asio::awaitable< ChatCompletion > invoke(const CompletionParams ¶ms, StreamCallback on_chunk=nullptr)
Single-dispatch async-streaming completion (v1.0 canonical).
Thrown by a Provider when an upstream API returned HTTP 429 (rate limit exceeded).
int retry_after_seconds() const noexcept
Seconds to wait per the upstream, or -1 if unknown.
std::function< void(const std::string &chunk)> StreamCallback
Callback invoked per token during streaming completion.
LLM completion response including the message and token usage.
Parameters for an LLM completion request.
json extra_fields
Per-call body field bindings (issue #33, v0.8+).
float temperature
Sampling temperature (0.0 = deterministic, 1.0 = creative).
std::vector< ChatTool > tools
Available tools the LLM may call.
int max_tokens
Maximum output tokens. -1 means provider default.
std::shared_ptr< graph::CancelToken > cancel_token
Optional cancel handle (v0.3+).
std::string model
Model name to use (e.g., "gpt-4o-mini").
std::vector< ChatMessage > messages
Conversation history.
Foundation types for NeoGraph: messages, tool calls, and LLM completions.