NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
neograph::CompletionParams Struct Reference

Parameters for an LLM completion request. More...

#include <provider.h>

Public Attributes

std::shared_ptr< graph::CancelTokencancel_token
 Optional cancel handle (v0.3+).
 
json extra_fields
 Per-call body field bindings (issue #33, v0.8+).
 
int max_tokens = -1
 Maximum output tokens. -1 means provider default.
 
std::vector< ChatMessagemessages
 Conversation history.
 
std::string model
 Model name to use (e.g., "gpt-4o-mini").
 
float temperature = 0.7f
 Sampling temperature (0.0 = deterministic, 1.0 = creative).
 
std::vector< ChatTooltools
 Available tools the LLM may call.
 

Detailed Description

Parameters for an LLM completion request.

Definition at line 57 of file provider.h.

Member Data Documentation

◆ cancel_token

std::shared_ptr<graph::CancelToken> neograph::CompletionParams::cancel_token

Optional cancel handle (v0.3+).

When set, async-native providers (OpenAIProvider, SchemaProvider) bind cancel_token->slot() to their ConnPool::async_post co_await, so a caller's cancel() aborts the in-flight HTTPS socket and stops billable LLM work mid-stream.

The engine populates this from RunConfig::cancel_token when a node calls ctx.provider->complete(params); user code that constructs CompletionParams directly may set it to share an abort across multiple completions.

Definition at line 77 of file provider.h.

◆ extra_fields

json neograph::CompletionParams::extra_fields

Per-call body field bindings (issue #33, v0.8+).

Map of path → value overrides that the provider stamps into the outgoing request body for THIS call only. Companion to the schema-static request.extra_fields block that ships with every body — extra_fields here is the dynamic per-call side of the same hook.

For SchemaProvider: the schema author declares which paths are bindable per-call via "request.per_call_fields": [...]. Only listed paths are honoured; unknown paths are silently dropped (the schema, not the caller, owns the contract). This keeps the per-call surface declarative and matches how temperature_path / max_tokens_path already address specific paths.

Native Provider subclasses (e.g. OpenAIProvider) may choose to honour or ignore individual keys per their own documented surface — the field is generic, the contract is provider-defined.

// Reasoning model — high effort for hard call, low for cheap call.
hard.extra_fields = {{"reasoning.effort", "high"}};
auto deep = co_await provider->complete_async(hard);
CompletionParams cheap;
cheap.extra_fields = {{"reasoning.effort", "low"}};
auto fast = co_await provider->complete_async(cheap);
Parameters for an LLM completion request.
Definition provider.h:57
json extra_fields
Per-call body field bindings (issue #33, v0.8+).
Definition provider.h:115

Default: empty json. Same lifecycle shape as the existing schema-static request.extra_fields block.

Definition at line 115 of file provider.h.


The documentation for this struct was generated from the following file: