|
NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
|
Provider wrapper that emits OpenInference LLM spans. More...
#include <openinference.h>
Public Member Functions | |
| bool | host_pumped () const noexcept override |
| Whether the SDK client behind this provider runs on a host-pumped executor (a WebAssembly host's event loop, #535). | |
| OpenInferenceProvider (std::shared_ptr< Provider > inner, Tracer &tracer, const OpenInferenceTracerSession &session, std::string span_name="llm.complete") | |
| Safe parent-aware overload. | |
| OpenInferenceProvider (std::shared_ptr< Provider > inner, Tracer &tracer, std::function< Span *()> parent_lookup=nullptr, std::string span_name="llm.complete") | |
Public Member Functions inherited from neograph::Provider | |
| template<class Outcome > | |
| Outcome | complete_endpoint (sp::runtime::PreparedEndpoint< Outcome > prepared) |
| Runs a prepared call on this provider's client and blocks for its outcome. | |
| template<class Outcome > | |
| asio::awaitable< Outcome > | complete_endpoint_async (sp::runtime::PreparedEndpoint< Outcome > prepared) |
| The same call without blocking a thread. | |
| bool | has_endpoints () const |
| Whether this provider forwards SchemaProvider endpoint calls. | |
| template<EndpointRequest Request> | |
| sp::runtime::PreparedEndpoint< EndpointOutcomeOf< Request > > | prepare_endpoint (Request request, sp::runtime::RunOptions options={}) |
| SchemaProvider's non-chat endpoints at this provider's origin (#531). | |
Protected Member Functions | |
| std::shared_ptr< sp::runtime::Client > | endpoint_runtime () const override |
| The inner provider's SchemaProvider endpoints (#531). | |
Additional Inherited Members | |
Static Public Member Functions inherited from neograph::Provider | |
| static std::optional< std::uint64_t > | invocation_upper_bound (const PreparedProviderRequest &request) |
| Most model invocations one dispatch of this request can bill: the request's model invocations times the transport attempts its retry policy allows. | |
| static std::string | request_content_digest (const PreparedProviderRequest &request) |
| What the request asks for, apart from the policy that admitted it: its family, model, mode and origin, its encoded body with the members the descriptor names set apart by role (model, messages, stream and output cap), and for an endpoint call its endpoint, method, URL and upload (#541). | |
| static std::string | request_digest (const PreparedProviderRequest &request) |
| The dispatch digest of a prepared request: its content and everything the descriptor policy decided about sending it, including the policy's identity. | |
| static std::string | request_policy_identity (const PreparedProviderRequest &request) |
| The identity of the SchemaProvider descriptor policy that admitted the request, "sha256:" and 64 hex digits. | |
Static Protected Member Functions inherited from neograph::Provider | |
| static std::shared_ptr< sp::runtime::Client > | endpoint_runtime_of (const Provider &inner) |
| For a provider that wraps another: forward the inner provider's endpoints by returning this from endpoint_runtime(). | |
| static PreparedProviderRequest | prepare_runtime (std::shared_ptr< sp::runtime::Client > client, ProviderRequest request, bool host_pumped=false) |
host_pumped is the client's executor (see host_pumped()): the prepared request then refuses to be dispatched from a blocking bridge. | |
Provider wrapper that emits OpenInference LLM spans.
Preparation delegates once to the inner provider. The exact move-only prepared handle is observed at dispatch, without re-encoding or changing its mode, deadline, cancellation, or typed callback. Each dispatched operation opens one llm.complete span and records public text and known usage only. An abandoned preparation opens no span. Original full outcomes and typed callbacks, plus provider name and family identity, pass through unchanged; tracing projections never become provider history.
Tracing failures are caught and swallowed — observability must never break the LLM call.
Definition at line 156 of file openinference.h.
| neograph::observability::OpenInferenceProvider::OpenInferenceProvider | ( | std::shared_ptr< Provider > | inner, |
| Tracer & | tracer, | ||
| std::function< Span *()> | parent_lookup = nullptr, |
||
| std::string | span_name = "llm.complete" |
||
| ) |
| inner | Provider to delegate to. |
| tracer | Tracer for span emission. Must outlive *this. |
| parent_lookup | Optional callback returning the parent span. The caller must keep that span alive until this tracer's start_span returns. Do not bind current_parent() when close may run concurrently; use the session overload below for teardown-safe parent attachment. |
| span_name | Span name for each LLM call (default "llm.complete"). |
| neograph::observability::OpenInferenceProvider::OpenInferenceProvider | ( | std::shared_ptr< Provider > | inner, |
| Tracer & | tracer, | ||
| const OpenInferenceTracerSession & | session, | ||
| std::string | span_name = "llm.complete" |
||
| ) |
Safe parent-aware overload.
The copied starter does not retain the session object and becomes a root-span starter after session teardown.
|
overridevirtualnoexcept |
Whether the SDK client behind this provider runs on a host-pumped executor (a WebAssembly host's event loop, #535).
Its calls finish only when the host runs its loop, so a synchronous entry point that waits for them on the calling thread (GraphEngine::run, Provider::dispatch, complete_endpoint) cannot work. The dispatch of such a call fails with the SDK's runtime.blocking.host_pumped refusal, nothing sent; use the _async forms on async::HostLoop.
Reimplemented from neograph::Provider.