Skip to content

docs(llms): add more providers#2334

Open
caio-pizzol wants to merge 9 commits intomainfrom
caio-pizzol/ai-integration-examples
Open

docs(llms): add more providers#2334
caio-pizzol wants to merge 9 commits intomainfrom
caio-pizzol/ai-integration-examples

Conversation

@caio-pizzol
Copy link
Contributor

No description provided.

…Vercel AI, LangChain

Add minimal runnable examples (Node.js + Python) for four AI integrations:
- AWS Bedrock: Converse API with tool use
- Google Vertex AI: Gemini with function calling (includes schema sanitizer for const keyword)
- Vercel AI SDK: generateText with automatic agentic loop
- LangChain: LangGraph ReAct agent

Also adds a full contract review demo and an Integrations docs page split into
Cloud Platforms and Agent Frameworks sections.
SD-2165: Ship sanitizeToolSchemas, formatToolResult, formatToolError,
and mergeDiscoveredTools helpers for both Node.js and Python SDKs.

These eliminate boilerplate when integrating SuperDoc tools with cloud
platforms (Bedrock, Vertex AI) and direct APIs (OpenAI, Anthropic).
Replace inline tool conversion, result wrapping, and schema sanitization
with the new SDK helpers (formatToolResult, formatToolError,
sanitizeToolSchemas, mergeDiscoveredTools) across all integration examples
and documentation.
discover_tools is a synthetic meta-tool not in tool-name-map.json,
so dispatchSuperDocTool throws TOOL_NOT_FOUND. Fix by intercepting
discover_tools before dispatch and handling it client-side via
chooseTools. Framework examples (Vercel AI, LangChain) now use
mode='all' since they can't inject tools mid-conversation. Also
fix LangChain Python schema inference issue.
… save

- dispatchSuperDocTool now strips doc/sessionId from args before dispatch,
  since the SDK client manages session targeting after doc.open()
- Examples use absolute paths and copy-then-edit pattern to preserve
  the original document when saving
- Fix ToolGroup type cast in discover_tools handling
- Vercel AI and LangChain snippets use mode: 'all' since frameworks
  can't handle discover_tools mid-conversation
- LangChain Python uses **kwargs + infer_schema=False to fix schema
  inference
- discover_tools pattern shows correct client-side interception via
  chooseTools instead of dispatchSuperDocTool
…amples

- Switch default Bedrock model from Nova Pro to Claude Sonnet 4.6
- Fix Python examples to use dict params instead of kwargs for SDK calls
- Add venv setup to Python README instructions
- Add venv/ to .gitignore
- Update model references in docs and READMEs to Sonnet 4.6
Remove Vertex, Vercel AI, and LangChain examples and docs — they'll
be added in a follow-up PR once the intent-based tool layer lands.
…and docs

Restore non-Bedrock AI integration examples split from the Bedrock PR.
Includes Node.js and Python examples for each platform.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f2086bf571

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// Models fill these in because the tool schemas expose them, but passing them
// alongside an active session causes "stateless input.doc cannot be combined
// with a session target" errors.
const { doc: _doc, sessionId: _sid, ...cleanArgs } = args;

Choose a reason for hiding this comment

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

P1 Badge Keep doc/sessionId when dispatching lifecycle tools

This strips doc and sessionId from every tool call before validation and dispatch, which breaks operations that legitimately need those fields (for example lifecycle/session tools like open, session.close, or session.setDefault): validation will see required args as missing, or the call will target the wrong default session. The filtering needs to be conditional by operation instead of global.

Useful? React with 👍 / 👎.

client.doc.open(doc="./contract.docx")

# Anthropic format → Bedrock toolSpec shape
sd_tools = choose_tools(provider="anthropic")

Choose a reason for hiding this comment

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

P2 Badge Call choose_tools with an input dict in Python snippet

This example uses keyword arguments (choose_tools(provider="anthropic")), but the SDK API expects a single input object (choose_tools(input) in packages/sdk/langs/python/superdoc/tools_api.py), so copy-pasting this code raises TypeError for unexpected keyword arguments. Use choose_tools({"provider": "anthropic"}) in the snippet to keep it runnable.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant