-
Notifications
You must be signed in to change notification settings - Fork 191
feat: add examples package for easily testing workflow #599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: c534269 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughA new set of example server workflows and supporting configuration files were added under Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant LlamaIndexServer
participant Agent
participant Tool
User->>LlamaIndexServer: Sends request (e.g., "1 + 1" or RAG query)
LlamaIndexServer->>Agent: Forwards user input
Agent->>Tool: Invokes tool (e.g., "add" or query tool)
Tool-->>Agent: Returns result
Agent-->>LlamaIndexServer: Returns final answer
LlamaIndexServer-->>User: Responds with answer
Possibly related PRs
Suggested reviewers
Poem
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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
packages/server/examples/README.md (1)
5-13:⚠️ Potential issueAdd instructions for the agentic RAG example
The README currently only covers running the simple workflow. To fully document this package, include steps foragentic-rag/index.ts, e.g.:## Running the examples ```bash export OPENAI_API_KEY=your_openai_api_key npx tsx simple-workflow/calculator.ts + npx tsx agentic-rag/index.tsOpen browser
- Calculator example: http://localhost:3000
- Agentic RAG example: http://localhost:4100
Without this, users won’t know how to launch the RAG workflow. </blockquote></details> </blockquote></details> <details> <summary>🧹 Nitpick comments (4)</summary><blockquote> <details> <summary>packages/server/examples/tsconfig.json (1)</summary><blockquote> `2-11`: **TypeScript compiler options look solid** The config enables strict mode, ES2022 targets, and bundler resolution which suits the examples. Consider explicitly setting `"rootDir": "."` to define the project root and avoid unexpected file inclusions. ```diff --- a/packages/server/examples/tsconfig.json +++ b/packages/server/examples/tsconfig.json @@ compilerOptions { + "rootDir": ".",packages/server/examples/agentic-rag/index.ts (1)
36-44: Handle server start errors
Calling.start()directly can silently fail. Wrap it to log errors and exit appropriately:new LlamaIndexServer({ /* ... */ }).start(); + .catch(err => { + console.error("Server failed to start:", err); + process.exit(1); + });packages/server/examples/simple-workflow/calculator.ts (2)
6-15: Well-structured calculator agent with a clear tool definitionThe agent is defined with a single "add" tool that has appropriate name, description, parameter validation, and execution logic. The use of zod for type validation is a good practice.
Consider adding more mathematical operations (subtract, multiply, divide) to make this example more comprehensive for users learning the framework.
17-24: Good server configuration with helpful UI elementsThe server setup correctly uses the defined agent as its workflow and provides a clear UI configuration with relevant starter questions.
Consider adding comments explaining the configuration options for newcomers to the framework. Also, since this is an example that others will run, it would be helpful to include error handling or logging when the server starts successfully.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
packages/server/examples/README.md(1 hunks)packages/server/examples/agentic-rag/index.ts(1 hunks)packages/server/examples/package.json(1 hunks)packages/server/examples/simple-workflow/calculator.ts(1 hunks)packages/server/examples/tsconfig.json(1 hunks)pnpm-workspace.yaml(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (28)
- GitHub Check: build
- GitHub Check: typescript (22, 3.11, ubuntu-22.04, nextjs, --llamacloud)
- GitHub Check: typescript (22, 3.11, ubuntu-22.04, nextjs, --example-file)
- GitHub Check: typescript (22, 3.11, ubuntu-22.04, nextjs, --no-files)
- GitHub Check: typescript (22, 3.11, windows-latest, nextjs, --llamacloud)
- GitHub Check: typescript (22, 3.11, windows-latest, nextjs, --example-file)
- GitHub Check: typescript (22, 3.11, windows-latest, nextjs, --no-files)
- GitHub Check: typescript (22, 3.11, macos-latest, nextjs, --llamacloud)
- GitHub Check: typescript (22, 3.11, macos-latest, nextjs, --example-file)
- GitHub Check: typescript (22, 3.11, macos-latest, nextjs, --no-files)
- GitHub Check: typescript (20, 3.11, ubuntu-22.04, nextjs, --llamacloud)
- GitHub Check: python (20, 3.11, ubuntu-22.04, fastapi, --llamacloud)
- GitHub Check: typescript (20, 3.11, ubuntu-22.04, nextjs, --example-file)
- GitHub Check: python (20, 3.11, ubuntu-22.04, fastapi, --example-file)
- GitHub Check: typescript (20, 3.11, ubuntu-22.04, nextjs, --no-files)
- GitHub Check: python (20, 3.11, ubuntu-22.04, fastapi, --no-files)
- GitHub Check: typescript (20, 3.11, windows-latest, nextjs, --llamacloud)
- GitHub Check: python (20, 3.11, windows-latest, fastapi, --llamacloud)
- GitHub Check: typescript (20, 3.11, windows-latest, nextjs, --example-file)
- GitHub Check: python (20, 3.11, windows-latest, fastapi, --example-file)
- GitHub Check: typescript (20, 3.11, windows-latest, nextjs, --no-files)
- GitHub Check: python (20, 3.11, windows-latest, fastapi, --no-files)
- GitHub Check: typescript (20, 3.11, macos-latest, nextjs, --llamacloud)
- GitHub Check: python (20, 3.11, macos-latest, fastapi, --llamacloud)
- GitHub Check: typescript (20, 3.11, macos-latest, nextjs, --example-file)
- GitHub Check: python (20, 3.11, macos-latest, fastapi, --example-file)
- GitHub Check: typescript (20, 3.11, macos-latest, nextjs, --no-files)
- GitHub Check: python (20, 3.11, macos-latest, fastapi, --no-files)
🔇 Additional comments (6)
pnpm-workspace.yaml (1)
1-4: Include examples package in workspace
The new"packages/server/examples"path ensures the examples package is managed by pnpm. Verify that no other workspace globs conflict with this addition.packages/server/examples/tsconfig.json (1)
12-13:include/excludepatterns are sufficient
Including all source files and excludingnode_modules/distaligns with standard conventions for example packages.packages/server/examples/agentic-rag/index.ts (1)
1-17: Core workflow implementation is correct
Imports, global settings, and theworkflowFactoryare well structured for an agentic RAG example.packages/server/examples/package.json (1)
9-18: Dependencies pinning looks correct
Usingworkspace:*for internal packages and caret ranges for external ones is appropriate for this workspace.packages/server/examples/simple-workflow/calculator.ts (2)
1-4: Appropriate imports for setting up a LlamaIndex-based agent workflowThe imports correctly bring in the necessary components from LlamaIndex packages and zod for schema validation.
1-24:✅ Verification successful
Verify OpenAI API key requirement
Since this example uses LlamaIndex which typically requires access to language models, users might need to set environment variables.
🏁 Script executed:
#!/bin/bash # Check if any environment variables are mentioned in the README cd packages/server/examples if [ -f "README.md" ]; then echo "Checking README.md for environment variable mentions:" grep -i "OPENAI\|API_KEY\|environment" README.md else echo "README.md not found" fiLength of output: 262
Environment variable requirement confirmed
Verified that
packages/server/examples/README.mdalready includes:export OPENAI_API_KEY=your_openai_api_keyso the OpenAI API key requirement for the calculator example is documented.
Summary by CodeRabbit