Repository navigation
Update OpenAI agent max token - #1222
Conversation
WalkthroughVersion increments across multiple packages and dependency updates: openai and replicate dependencies in LLM agents, internal package version synchronizations in agents and CLI, and a devDependency bump (typescript-eslint) at the root. No source code or public API changes; all edits are in package.json files. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (7)
agents/llm_agents/package.json(2 hunks)llm_agents/openai_agent/package.json(2 hunks)llm_agents/openai_fetch_agent/package.json(1 hunks)llm_agents/replicate_agent/package.json(2 hunks)package.json(1 hunks)packages/agents/package.json(2 hunks)packages/cli/package.json(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build (24.x)
- GitHub Check: build (22.x)
🔇 Additional comments (10)
package.json (1)
26-26: Action Required: Verify lint across all workspacesThe bump to “typescript-eslint@^8.40.0” remains compatible with ESLint 9 (we’re on ESLint ^9.33.0), so the upgrade itself is safe. However, the verification script failed during
yarn installdue to a sqlite3 build error, preventing the lint step from running. Once the installation issue is resolved, please re-run the workspace linter to catch any renamed rules or stricter defaults:yarn install --immutable yarn workspaces run eslint .llm_agents/replicate_agent/package.json (2)
3-3: Patch version bump to 2.0.1Semver patch is appropriate for dependency-only update; no concerns.
31-31: Unable to automatically verify the upgrade to replicate@^1.1.0 in our sandbox (native sqlite3 failed to build). Please manually ensure:
All imports and type definitions still compile against replicate 1.1.x.
Your consumers’ Node.js versions satisfy any new “engines” constraints.
The workspace builds and lightweight tests pass:
yarn install yarn workspace @graphai/replicate_agent run b yarn workspace @graphai/replicate_agent run test_runOptionally, run a pure type‐check to catch any typing drifts:
cd llm_agents/replicate_agent npx tsc --noEmitllm_agents/openai_agent/package.json (1)
3-3: Version 2.0.7: PR title mentions “Update OpenAI agent max token,” but this file shows only version/dep bumpsIf the “max token” change landed inside the published package code (not shown in this PR), consider referencing the upstream change or changelog in the PR description. Otherwise, this PR does not reflect a direct code change to max token handling.
Please confirm in the changelog of @graphai/[email protected] that the “max token” behavior changed as intended.
llm_agents/openai_fetch_agent/package.json (1)
3-3: Patch bump to 1.0.1Metadata-only update; LGTM.
agents/llm_agents/package.json (2)
3-3: Version to 2.0.11Coordinated bump aligns this meta-package with its agent deps; no issues spotted.
32-34: Deps versions confirmed on npmAll three internal agent packages were successfully verified on the npm registry at the specified versions:
- @graphai/openai_agent@^2.0.7 → 2.0.7
- @graphai/openai_fetch_agent@^1.0.1 → 1.0.1
- @graphai/replicate_agent@^2.0.1 → 2.0.1
The subsequent
yarn install --immutablefailure stems from a native sqlite3 build error in the CI environment and does not affect these agent dependencies. No further action on version availability is required before publishing.packages/agents/package.json (1)
32-32: Confirm [email protected] includes the OpenAI “max token” update and uses consistent parameter mappings
- We’ve verified that
@graphai/[email protected]depends on@graphai/openai_agent@^2.0.7, which introduced the switch frommax_tokenstomax_completion_tokensto align with OpenAI’s newer models .- Within the
llm_agentspackage, each provider uses the parameter name expected by its underlying API:
- OpenAI agents (
openAIAgentandopenAIFetchAgent) usemax_completion_tokens(falling back tomax_tokensfor compatibility).- Groq and Anthropic agents continue to use
max_tokens.- Gemini agent maps our
max_tokensinput tomaxOutputTokensas required by Google’s Vertex AI API.No mismatches or drift between parameter names were found across these agents.
packages/cli/package.json (2)
3-3: CLI version bump to 2.0.11 is fine; ensure it’s released after agents 2.0.14.Keeps workspace versions moving forward without API changes. Publish sequencing matters so the CLI can resolve @graphai/agents ^2.0.14 immediately after release.
If you maintain a CHANGELOG for the CLI, add an “Internal: dependency alignment” entry tied to PR #1222.
37-37: Dependency alignment for @graphai/agents ^2.0.14 looks correct—please verify with a smoke type-check/buildA quick build of the CLI workspace will confirm there are no TypeScript definition shifts (this dependency pulls in @graphai/llm_agents@^2.0.11 transitively after the OpenAI SDK bump).
• package needing verification:
- packages/cli/package.json (dependency line 37)
• Steps to verify:
- Update your lockfile (e.g.
npm install/pnpm install/yarn install)- Run the CLI build in your workspace:
• For pnpm:pnpm -w install --ignore-scripts && pnpm --filter @receptron/graphai_cli build
• For yarn:yarn install --mode=skip-build && yarn workspace @receptron/graphai_cli run build
• Adjust commands if you use npm or another managerOnce you’ve confirmed a clean type-check/build with no errors, this change can be approved.
| "dependencies": { | ||
| "@graphai/llm_utils": "^2.0.3", | ||
| "openai": "^5.12.2" | ||
| "openai": "^5.15.0" |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
openai dep -> ^5.15.0: ensure param name alignment (max_tokens vs max_output_tokens)
Recent OpenAI SDKs emphasize the Responses API which uses max_output_tokens, while legacy Chat Completions uses max_tokens. If your agent switched or abstracts both, verify you set the correct field.
Scan for token-limit fields and OpenAI import style:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Look for token limit keys across the repo
rg -nP --type=ts -C2 '\bmax_?output_?tokens\b|\bmax_?tokens\b'
# Ensure no CommonJS require for 'openai' (SDK is ESM-only)
rg -nP "require\\(['\"]openai['\"]\\)"Length of output: 11362
Ensure OpenAI SDK v5.15.0 parameter names and ESM import style are correct
-
The agent code defines both
max_tokensand a custommax_completion_tokens, yet the OpenAI v5 Chat Completion API expects onlymax_tokens, and the new Responses API usesmax_output_tokens. You should:
• Decide whether you’re callingopenai.chat.completions.create(legacy) oropenai.responses.create(Responses API)
• Rename your agent parameter frommax_completion_tokensto eithermax_tokens(for chat completions) ormax_output_tokens(for responses) and map it accordingly when building the request payload
• Remove the deprecated alias inllm_agents/openai_agent/src/openai_agent.ts(lines 22–24) andllm_agents/openai_fetch_agent/src/openai_fetch_agent.ts(lines 11–13), and update the assignment at line 182 (and line 119 in fetch agent) to use the correct field name. -
Update any test fixtures that still use
max_tokens, for example inllm_agents/openai_agent/tests/graphData.ts(line 13), to match the final chosen parameter. -
The compiled artifacts (
lib/openai_agent.jsandlib/openai_image_agent.js, both at line 7) are emitting CommonJSrequire("openai"). Since OpenAI’s SDK v5.15.0 is ESM‐only, you must:
• Reconfigure your build to output ESM modules (e.g. setmodule: "ESNext"intsconfig.json)
• Or convert those imports to dynamic ESM imports (await import("openai")) so they load correctly at runtime.
🤖 Prompt for AI Agents
In llm_agents/openai_agent/package.json around line 32 and related files, the
project uses OpenAI SDK v5.15.0 (ESM-only) but the agent code mixes deprecated
parameter names and emits CommonJS imports: remove the custom alias
max_completion_tokens and decide which API you call (chat completions or
Responses API); rename the agent parameter to max_tokens (for
chat.completions.create) or max_output_tokens (for openai.responses.create),
update usages and the assignment in llm_agents/openai_agent/src/openai_agent.ts
(remove lines 22–24 and change the assignment at ~line 182) and in
llm_agents/openai_fetch_agent/src/openai_fetch_agent.ts (remove lines 11–13 and
update the assignment at ~line 119), update any test fixtures such as
llm_agents/openai_agent/tests/graphData.ts (line 13) to use the chosen
parameter, and fix ESM import issues by either changing the build to output ESM
modules (e.g., set module: "ESNext" in tsconfig.json) or replacing static
require imports in compiled artifacts with dynamic ESM imports (await
import("openai")) so the SDK loads correctly at runtime.
| { | ||
| "name": "@graphai/agents", | ||
| "version": "2.0.12", | ||
| "version": "2.0.14", |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Version bump to 2.0.14 looks consistent; confirm release hygiene and publish order.
No code/API changes here. Ensure CHANGELOG entry, git tag, and publish order so that dependents (CLI) resolve this version without race conditions during release.
Run the script below to list all package versions and highlight consumers of @graphai/agents and @graphai/llm_agents across the repo to verify consistency before publishing:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Package versions =="
fd -a package.json -E node_modules | while read -r f; do
name=$(jq -r '.name // empty' "$f")
version=$(jq -r '.version // empty' "$f")
if [[ -n "$name" && -n "$version" ]]; then
printf "%-50s %-40s %s\n" "$f" "$name" "$version"
fi
done | sort
echo
echo "== Dependencies on @graphai/agents and @graphai/llm_agents =="
fd -a package.json -E node_modules | while read -r f; do
ag=$(jq -r '.dependencies["@graphai/agents"] // empty' "$f")
llm=$(jq -r '.dependencies["@graphai/llm_agents"] // empty' "$f")
if [[ -n "$ag" || -n "$llm" ]]; then
printf "%-50s agents:%-10s llm:%s\n" "$f" "$ag" "$llm"
fi
done | sortLength of output: 27546
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate CHANGELOG file
changelog=$(find . -type f -iname 'CHANGELOG.md' | head -n1)
echo "Changelog file: $changelog"
if [[ -z "$changelog" ]]; then
echo "No CHANGELOG.md found"
exit 0
fi
# Check for version entry
echo "Entries for version 2.0.14:"
grep -E "##?\\s*2\\.0\\.14" "$changelog" || echo "No entries for 2.0.14 found"Length of output: 201
Release 2.0.14: add missing release artifacts and verify publish order
- No CHANGELOG.md (or equivalent) entry found for version 2.0.14. Please add a section summarizing what’s new in
@graphai/[email protected]. - No Git tag detected for this release. Create and push a tag (e.g.
v2.0.14) that matches the version inpackages/agents/package.json. - To avoid dependency races, publish in this sequence:
- @graphai/llm_agents v2.0.11
- @graphai/agents v2.0.14
- Re-publish the CLI (
packages/cli) so it can resolve@graphai/agents@^2.0.14.
- After the release, verify that all downstream packages resolve the new agent version without errors.
🤖 Prompt for AI Agents
packages/agents/package.json lines 3-3: The release metadata for 2.0.14 is
missing release artifacts and publish steps — add a CHANGELOG.md entry (or
update the project changelog) with a “2.0.14” section summarizing the changes
for @graphai/[email protected], create and push a matching Git tag (e.g. v2.0.14)
pointing to the release commit, publish packages in the required order (first
@graphai/llm_agents v2.0.11, then @graphai/agents v2.0.14, then re-publish the
CLI package) to avoid dependency races, and after publishing verify that
downstream packages resolve @graphai/agents@^2.0.14 without errors.
Summary by CodeRabbit