Skip to content

chore(wren-ai-service): minor updates#1380

Merged
paopa merged 5 commits into
mainfrom
chore/ai-service/minor-updates
Mar 10, 2025
Merged

chore(wren-ai-service): minor updates#1380
paopa merged 5 commits into
mainfrom
chore/ai-service/minor-updates

Conversation

@cyyeh
Copy link
Copy Markdown
Member

@cyyeh cyyeh commented Mar 10, 2025

  • fix sql breakdown issue
  • remove LLM_OPENAI_API_KEY and EMBEDDER_OPENAI_API_KEY

Summary by CodeRabbit

  • Chores

    • Consolidated multiple API key settings into a single unified variable (OPENAI_API_KEY), simplifying configuration, deployment, and environment setup.
    • Removed redundant API key fields and configuration entries across examples, workflows, and deployment manifests.
  • Documentation

    • Updated contributor and deployment guides to instruct usage of the unified OPENAI_API_KEY, streamlining setup instructions for users.
    • Revised README files to reflect changes in environment variable requirements and configurations.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 10, 2025

Walkthrough

This pull request consolidates API key configuration across multiple files by removing several vendor-specific variables and replacing them with a single OPENAI_API_KEY. In addition, it removes the api_key_name fields from various model configuration entries and updates references, comments, and aliases to align with the new naming convention. A control flow adjustment in a SQL post-processing module (inverting an error check) is also included along with minor formatting improvements.

Changes

Files Change Summary
docker/.env.example, wren-ai-service/tools/config/.env.dev.example, .github/workflows/ai-service-test.yaml, CONTRIBUTING.md, wren-ui/README.md, deployment/kustomizations/base/deploy-wren-ai-service.yaml, deployment/kustomizations/examples/secret-wren_example.yaml, deployment/kustomizations/README.md Removed multiple API key variables (e.g., LLM_OPENAI_API_KEY, EMBEDDER_OPENAI_API_KEY, etc.) and replaced them with a unified OPENAI_API_KEY.
docker/config.example.yaml, wren-ai-service/tools/config/config.example.yaml, wren-ai-service/tools/config/config.full.yaml, deployment/kustomizations/base/cm.yaml Removed the api_key_name field from model configurations.
wren-ai-service/src/pipelines/generation/utils/sql.py, wren-launcher/utils/docker.go, wren-ai-service/eval/__init__.py, wren-ai-service/src/providers/llm/litellm.py, wren-ai-service/eval/evaluation.py Updated code logic and comments: inverted a conditional check, updated API key aliasing and parameter documentation, and adjusted environment variable replacement logic.
wren-ai-service/eval/dspy_modules/prompt_optimizer.py Applied formatting improvements and minor readability adjustments without functional changes.

Possibly related PRs

Suggested reviewers

  • paopa

Poem

Oh, I'm a hopping rabbit full of cheer,
Streamlining keys, making changes clear.
Out with the old, the clutter now is gone, 🎉
One simple key helps our code roll on.
With leaps of joy, I sing this little rhyme,
Celebrating clean code, one hop at a time!
🐇🌟


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 45b693a and 76b9916.

📒 Files selected for processing (1)
  • wren-ui/README.md (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • wren-ui/README.md
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: pytest
  • GitHub Check: Analyze (go)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cyyeh cyyeh requested a review from paopa March 10, 2025 09:00
@cyyeh cyyeh added module/ai-service ai-service related ci/ai-service ai-service related labels Mar 10, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
wren-ai-service/tools/config/.env.dev.example (1)

1-3: Consolidation of Vendor API Keys

The vendor keys section now uses a single OPENAI_API_KEY variable instead of multiple vendor-specific keys. This aligns with the PR objectives by simplifying key management and reducing redundancy. Please ensure that all service components referencing the old keys have been updated to use OPENAI_API_KEY.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f0f7a6 and e39c806.

📒 Files selected for processing (8)
  • docker/.env.example (1 hunks)
  • docker/config.example.yaml (0 hunks)
  • wren-ai-service/src/pipelines/generation/utils/sql.py (1 hunks)
  • wren-ai-service/tools/config/.env.dev.example (1 hunks)
  • wren-ai-service/tools/config/config.example.yaml (0 hunks)
  • wren-ai-service/tools/config/config.full.yaml (0 hunks)
  • wren-ai-service/tools/dev/.env (1 hunks)
  • wren-launcher/utils/docker.go (1 hunks)
💤 Files with no reviewable changes (3)
  • wren-ai-service/tools/config/config.example.yaml
  • wren-ai-service/tools/config/config.full.yaml
  • docker/config.example.yaml
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: pytest
  • GitHub Check: pytest
🔇 Additional comments (5)
wren-ai-service/tools/dev/.env (1)

16-16: Good version pin for stability.

Pinning the UI version to a specific release (0.20.1) rather than using the 'latest' tag improves deployment stability and reproducibility.

wren-launcher/utils/docker.go (1)

48-50: API key consolidation looks good.

This change simplifies configuration by using a single OPENAI_API_KEY instead of separate keys for different services. This aligns with the PR objectives and makes the API key management more straightforward.

docker/.env.example (1)

19-19: API key consolidation simplifies configuration.

Consolidating multiple vendor-specific API keys into a single OPENAI_API_KEY simplifies the environment setup, improving developer experience and reducing configuration errors.

wren-ai-service/src/pipelines/generation/utils/sql.py (1)

50-50: Fixed SQL breakdown error handling.

The condition was inverted to correctly handle error cases by returning early when an error is detected. This improves the flow control and addresses the SQL breakdown issue mentioned in the PR objectives.

wren-ai-service/tools/config/.env.dev.example (1)

4-10: Validation of Langfuse and Evaluation Configuration

The configuration entries for LANGFUSE_SECRET_KEY, LANGFUSE_PUBLIC_KEY, and LANGFUSE_PROJECT_ID remain unchanged as expected. Confirm that these keys continue to be properly utilized in your application, and that no dependencies were inadvertently affected by the API key consolidation elsewhere.

Copy link
Copy Markdown
Contributor

@paopa paopa left a comment

Choose a reason for hiding this comment

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

lgtm!

@paopa
Copy link
Copy Markdown
Contributor

paopa commented Mar 10, 2025

Overall, LGTM!, but it seems having test cases failed. Can you check the failed cases? Thanks a lot!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
deployment/kustomizations/examples/secret-wren_example.yaml (1)

8-9: Consolidate API Key Management & Verify Placeholder Use

The update correctly removes the two legacy API keys and introduces a single OPENAI_API_KEY along with an updated comment. Please ensure that the provided base64-encoded value is a placeholder (or dummy) value and not a real API key, so that sensitive credentials are not inadvertently exposed in version control. If this is for production, consider loading the secret from a secured external source instead.

🧰 Tools
🪛 Gitleaks (8.21.2)

9-9: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e39c806 and 45b693a.

📒 Files selected for processing (11)
  • .github/workflows/ai-service-test.yaml (1 hunks)
  • CONTRIBUTING.md (1 hunks)
  • deployment/kustomizations/README.md (1 hunks)
  • deployment/kustomizations/base/cm.yaml (0 hunks)
  • deployment/kustomizations/base/deploy-wren-ai-service.yaml (1 hunks)
  • deployment/kustomizations/examples/secret-wren_example.yaml (1 hunks)
  • wren-ai-service/eval/__init__.py (1 hunks)
  • wren-ai-service/eval/dspy_modules/prompt_optimizer.py (5 hunks)
  • wren-ai-service/eval/evaluation.py (1 hunks)
  • wren-ai-service/src/providers/llm/litellm.py (1 hunks)
  • wren-ui/README.md (1 hunks)
💤 Files with no reviewable changes (1)
  • deployment/kustomizations/base/cm.yaml
✅ Files skipped from review due to trivial changes (3)
  • wren-ai-service/eval/evaluation.py
  • wren-ai-service/eval/dspy_modules/prompt_optimizer.py
  • wren-ai-service/src/providers/llm/litellm.py
🧰 Additional context used
🪛 Gitleaks (8.21.2)
deployment/kustomizations/examples/secret-wren_example.yaml

9-9: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: pytest
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (6)
wren-ui/README.md (1)

85-85: API key variable has been updated to use unified convention.

The change from requiring both LLM_OPENAI_API_KEY and EMBEDDER_OPENAI_API_KEY to a single OPENAI_API_KEY simplifies the setup process. This is consistent with the PR's objective to consolidate API keys.

wren-ai-service/eval/__init__.py (1)

12-12: Field alias updated to use the consolidated API key variable.

The change from LLM_OPENAI_API_KEY to OPENAI_API_KEY as the alias for the openai_api_key field ensures consistent API key usage throughout the application.

This change aligns with the PR's goal of removing specific API keys in favor of a unified approach.

.github/workflows/ai-service-test.yaml (1)

57-57: CI workflow updated to use the consolidated API key.

The workflow has been updated to use a single OPENAI_API_KEY environment variable instead of the previous separate keys (LLM_OPENAI_API_KEY and EMBEDDER_OPENAI_API_KEY).

This change ensures that the CI workflow remains functional after the API key consolidation.

CONTRIBUTING.md (1)

61-61: Contributing docs updated to reflect API key changes.

The documentation has been updated to instruct contributors to fill in only OPENAI_API_KEY instead of both LLM_OPENAI_API_KEY and EMBEDDER_OPENAI_API_KEY, maintaining consistency with the implementation changes.

deployment/kustomizations/README.md (1)

32-33: Update Documentation to Reflect API Key Changes

The documentation now correctly indicates that only the OPENAI_API_KEY is required for the wren-ai-service-deployment pod, improving clarity and aligning with the consolidated key management strategy.

deployment/kustomizations/base/deploy-wren-ai-service.yaml (1)

27-31: Consolidate Deployment Environment Variables

The deployment manifest now sources OPENAI_API_KEY from the wrenai-secrets secret, replacing the previously used LLM_OPENAI_API_KEY and EMBEDDER_OPENAI_API_KEY. This not only simplifies API key management, but it also ensures consistency across the deployment configurations.

@paopa paopa merged commit 92d6aa5 into main Mar 10, 2025
@paopa paopa deleted the chore/ai-service/minor-updates branch March 10, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/ai-service ai-service related module/ai-service ai-service related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants