Skip to content

docs(integrations): add AI SDK C++ integration page - #2943

Merged
jannikmaierhoefer merged 4 commits into
mainfrom
claude/optimistic-feistel-f7d0e5
May 13, 2026
Merged

docs(integrations): add AI SDK C++ integration page#2943
jannikmaierhoefer merged 4 commits into
mainfrom
claude/optimistic-feistel-f7d0e5

Conversation

@jannikmaierhoefer

@jannikmaierhoefer jannikmaierhoefer commented May 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a new integration page documenting the ai::langfuse tracing module added in ClickHouse/ai-sdk-cpp#42.
  • Covers trace shape (1 trace + 1 generation + 1 span per tool call), CMake/linking, env setup, an end-to-end generate_text example, the Config fields, and the documented MVP limitations.
  • Registers the new slug in the Frameworks meta.json and adds a ClickHouse icon under public/images/integrations/ for the page logo (the SDK is maintained by ClickHouse).

Test plan

  • pnpm dev and verify the page renders at /integrations/frameworks/ai-sdk-cpp
  • Confirm the page appears in the Frameworks list on /integrations
  • Confirm the logo loads and code blocks render correctly

🤖 Generated with Claude Code

Greptile Summary

This PR adds a new documentation page for the AI SDK C++ integration with Langfuse, covering CMake setup, credential configuration, an end-to-end generate_text example, the Config reference table, and the Trace API. The ClickHouse icon and the meta.json entry are also added correctly.

  • The main code example correctly guards result.text behind if (result), but the shorter "Trace API" snippet accesses result.text unconditionally — users who copy the snippet verbatim could ship code that silently produces wrong output or crashes on LLM errors.
  • The "Tracer configuration" and "Trace API" reference sections are positioned inside the <Steps> component, so they render as numbered setup steps rather than reference material; moving them outside </Steps> would fix the visual structure.

Confidence Score: 3/5

Safe to merge after addressing the incomplete error-handling pattern in the Trace API code snippet, which could lead users to write crash-prone code.

The Trace API section's code snippet calls result.text without first checking whether the generate call succeeded — a pattern the very next section of the same page explicitly guards against. Documentation that ships unsafe example code is likely to be copy-pasted directly by users. The <Steps> structure issue is cosmetic but affects how readers interpret the reference material.

content/integrations/frameworks/ai-sdk-cpp.mdx — the Trace API snippet and the Steps boundary both need attention.

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
content/integrations/frameworks/ai-sdk-cpp.mdx:154-155
Potential unsafe access in the Trace API snippet: `result.text` is accessed unconditionally after `generate_text`, but the earlier end-to-end example guards the same access with `if (result)`. If the LLM call fails, `result.text` may be empty or access an error state, silently giving the user incorrect output or — depending on how the result type is implemented in C++ — undefined behavior. Users copying this abbreviated snippet are likely to miss adding the guard themselves.

```suggestion
if (result) {
  trace->set_output(result.text);
} else {
  trace->set_output(ai::JsonValue{{"error", result.error_message()}});
}
trace->end();  // idempotent, synchronous flush
```

### Issue 2 of 2
content/integrations/frameworks/ai-sdk-cpp.mdx:124-126
The "Tracer configuration" and "Trace API" sections are inside the `<Steps>` component (which closes on line 160), so they will be rendered as numbered installation steps alongside "Install", "Configure credentials", and "Instrument a call". These sections are reference material, not sequential setup steps, so they should live outside `</Steps>` with the "Notes and limitations" and "Learn more" sections to avoid misleading the reader.

```suggestion
</Steps>

## Tracer configuration

`ai::langfuse::Config` accepts the following options:
```

Reviews (1): Last reviewed commit: "docs(integrations): add AI SDK C++ integ..." | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

Documents the new `ai::langfuse` tracing module added in
ClickHouse/ai-sdk-cpp#42, which wraps `ai::Client::generate_text` calls
and emits Langfuse traces for the LLM round-trip and each tool invocation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Langfuse-Session: https://cloud.langfuse.com/project/cloramnkj0002jz088vzn1ja4/sessions/0513d864-5246-4f7c-ae5c-e95d55feb120
@vercel

vercel Bot commented May 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
langfuse-docs Ready Ready Preview, Comment May 13, 2026 2:14pm

Request Review

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. docs labels May 13, 2026
@github-actions

Copy link
Copy Markdown

@claude review

Comment thread content/integrations/frameworks/ai-sdk-cpp.mdx Outdated
Comment thread content/integrations/frameworks/ai-sdk-cpp.mdx
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Comment thread content/integrations/frameworks/ai-sdk-cpp.mdx
Comment thread content/integrations/frameworks/ai-sdk-cpp.mdx
- Close `<Steps>` before the Tracer configuration / Trace API reference
  sections so they no longer render as numbered walkthrough steps.
- Guard `result.text` access in the Trace API snippet so users copying
  it do not access an unset field on failure.
- Add Japan and HIPAA cloud regions to the LANGFUSE_HOST comment block
  to match the convention used on other integration pages.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Langfuse-Session: https://cloud.langfuse.com/project/cloramnkj0002jz088vzn1ja4/sessions/0513d864-5246-4f7c-ae5c-e95d55feb120
Comment thread content/integrations/frameworks/ai-sdk-cpp.mdx Outdated

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All prior review feedback (Steps tag balance, reference sections outside Steps, error-guarded Trace API snippet, JP/HIPAA host regions) has been addressed in 67cef13.

Extended reasoning...

Overview

This is a docs-only PR adding a new integration page at content/integrations/frameworks/ai-sdk-cpp.mdx, registering its slug in content/integrations/frameworks/meta.json, and adding a ClickHouse SVG logo under public/images/integrations/. No application code, no build config, no runtime behavior is touched.

Security risks

None. The change is a static MDX page plus an SVG. The SVG was inspected — it contains only standard <svg>/<rect>/<path> elements with no <script>, <foreignObject>, or event handlers. The page references public URLs only (langfuse.com domains, GitHub).

Level of scrutiny

Low. This is a new, isolated documentation page that follows the established pattern of other entries in frameworks/ (e.g. koog.mdx, vercel-ai-sdk.mdx). The only correctness concerns were docs-rendering issues (Steps tag structure, region coverage, unsafe sample snippet) — all of which were raised by greptile and prior claude[bot] reviews and have now been resolved in commit 67cef13.

Other factors

Verified the current state of the file directly: <Steps> opens at line 25 and closes exactly once at line 126, with ## Tracer configuration and ## Trace API correctly outside the Steps block. The Trace API example (lines 158-162) now guards result.text access with if (result). The LANGFUSE_HOST comment block (lines 55-60) now lists all four regions plus self-host. The meta.json insertion preserves alphabetical ordering. No outstanding reviewer comments remain unaddressed.

@dosubot dosubot Bot added the auto-merge This PR is set to be merged label May 13, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs-only addition for a new AI SDK C++ integration page; all prior review feedback (Steps boundary, error guard, cloud regions) has been incorporated.

Extended reasoning...

Overview

This PR adds a new docs page content/integrations/frameworks/ai-sdk-cpp.mdx for the AI SDK C++ Langfuse tracing module, registers its slug in content/integrations/frameworks/meta.json, and adds a ClickHouse SVG icon as the page logo. No application code is touched.

Security risks

None. The diff is markdown/MDX content, a JSON index entry, and a static SVG asset. The MDX page only documents env-var usage (placeholders, not real credentials) and external links to ClickHouse and Langfuse — no executed code, no auth/permission surface affected.

Level of scrutiny

Low — this is a content-only change to the docs site. The only build-time risk was an MDX parse error from unbalanced <Steps> tags, which was flagged on an earlier revision and has now been fixed (current file has exactly one <Steps> opener and one </Steps> closer, with reference sections correctly outside the Steps block).

Other factors

All prior feedback from greptile and my earlier reviews has been incorporated: the result.text access in the Trace API snippet is now guarded by if (result), the LANGFUSE_HOST comment now lists all four cloud regions (EU/US/JP/HIPAA), and the </Steps> placement is correct. No outstanding comments remain.

@dosubot dosubot Bot removed the auto-merge This PR is set to be merged label May 13, 2026
@jannikmaierhoefer
jannikmaierhoefer merged commit fe861f0 into main May 13, 2026
16 checks passed
@jannikmaierhoefer
jannikmaierhoefer deleted the claude/optimistic-feistel-f7d0e5 branch May 13, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant