|
NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
|
C++ peer of neograph_engine.openinference (issue #9).
More...
#include <neograph/api.h>#include <neograph/graph/types.h>#include <neograph/observability/tracer.h>#include <neograph/provider.h>#include <memory>#include <string>Go to the source code of this file.
Classes | |
| class | neograph::observability::OpenInferenceProvider |
| Provider wrapper that emits OpenInference LLM spans. More... | |
| class | neograph::observability::OpenInferenceTracerSession |
RAII session returned by openinference_tracer. More... | |
Functions | |
| NEOGRAPH_API OpenInferenceTracerSession | neograph::observability::openinference_tracer (Tracer &tracer, std::string root_name="graph.run", std::string node_span_prefix="node.") |
Open a CHAIN-kind root span and return a session whose cb opens per-node CHAIN child spans + LLM_TOKEN events under it. | |
C++ peer of neograph_engine.openinference (issue #9).
Two pieces, mirroring the Python module:
openinference_tracer(tracer) — opens a CHAIN-kind root span, returns an OpenInferenceTracerSession whose cb field plugs into engine.run_stream() / engine.run_stream_async() and opens a CHAIN-kind child span per node, with NODE_START / END payloads stuffed into input.value / output.value JSON blobs and LLM_TOKEN streamed-chunk events recorded as discrete span events. Closing the session ends the root span.OpenInferenceProvider(inner, tracer) — wraps any Provider. Each complete* call opens an LLM-kind child span tagged with llm.model_name, llm.invocation_parameters, llm.input_messages.{i}.message.{role,content}, llm.output_messages.0.message.{role,content}, and llm.token_count.{prompt,completion,total}. The streaming overloads (complete_stream / complete_stream_async) also accumulate streamed tokens into the LLM span's output.value and emit one llm.token event per chunk.Phoenix / Arize / Langfuse render the resulting trace as a chat chain with token counts and per-message bubbles — the same UX the Python wrapper produces.
Tracer adapter: NeoGraph itself does not link against opentelemetry-cpp. Downstream provides an adapter implementing neograph::observability::Tracer that wraps its own backend (OTel SDK, in-memory test fake, logging recorder, etc.). See tests/test_openinference_cpp.cpp for an InMemoryTracer reference impl used by the parity tests.
Definition in file openinference.h.
| NEOGRAPH_API OpenInferenceTracerSession neograph::observability::openinference_tracer | ( | Tracer & | tracer, |
| std::string | root_name = "graph.run", |
||
| std::string | node_span_prefix = "node." |
||
| ) |
Open a CHAIN-kind root span and return a session whose cb opens per-node CHAIN child spans + LLM_TOKEN events under it.
| tracer | Tracer adapter. Must outlive the session. |
| root_name | Span name for the root (default "graph.run"). |
| node_span_prefix | Prefix for per-node spans (default "node."). |