Skip to content

feat(llm): add ZhipuAIProvider with logging support - #469

Merged
baleen37 merged 10 commits into
mainfrom
ralph/second-feature
Feb 10, 2026
Merged

feat(llm): add ZhipuAIProvider with logging support#469
baleen37 merged 10 commits into
mainfrom
ralph/second-feature

Conversation

@baleen37

@baleen37 baleen37 commented Feb 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add ZhipuAIProvider implementation using zhipuai-sdk-nodejs-v4 SDK
  • Add comprehensive logging to ZhipuAIProvider.complete() method
  • Add comprehensive logging to batch-extract-prompt.extractObservationsFromBatch()
  • Add Zhipu AI setup documentation (docs/zhipu-ai-setup.md)
  • Require provider field in LLMConfig configuration

Changes

  • ZhipuAIProvider: New LLM provider supporting GLM-4.x models (glm-4.7 default)
  • Logging: Added structured logging with duration tracking for both providers and batch extraction
  • Documentation: Complete setup guide for Zhipu AI API key and configuration
  • Config: Updated LLMConfig to require explicit provider field

Test Plan

  • All LLM unit tests pass (79 tests)
  • batch-extract-prompt tests pass (16 tests)
  • TypeScript typecheck passes for modified files
  • Documentation verified and markdownlint validated

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for Zhipu AI as a conversation summarization provider alongside Gemini
    • Configuration schema now supports multiple providers with provider-agnostic setup
  • Documentation

    • Added comprehensive setup guides and configuration examples for Zhipu AI integration
    • Updated provider configuration documentation to reflect multi-provider support
  • Tests

    • Added test coverage for Zhipu AI provider functionality
    • Updated existing tests for async provider initialization

Test User and others added 10 commits February 10, 2026 08:42
- Add LLMProviderType type with 'gemini' and 'zhipu-ai' options
- Update LLMConfig interface to require provider field
- Add DEFAULT_MODELS constant for provider-specific default models
- Update loadConfig() to validate provider field
- Update createProvider() to be async and support both providers
- Add tests for zhipu-ai provider config validation
- Add tests for missing/invalid provider field validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Debug log now only logs messagesCount instead of full messages array and maxTokens
- Error handler re-throws original error instead of wrapping it

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@baleen37
baleen37 enabled auto-merge February 10, 2026 00:46
@coderabbitai

coderabbitai Bot commented Feb 10, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The pull request adds multi-provider LLM support to the conversation-memory plugin by introducing Zhipu AI as an alternative to Gemini. The createProvider function converts to async with dynamic provider selection, a new ZhipuAIProvider class is implemented, comprehensive setup documentation and configuration examples are added, and the zhipuai-sdk-nodejs-v4 dependency is included.

Changes

Cohort / File(s) Summary
Documentation and Setup
README.md, docs/zhipu-ai-setup.md, skills/configure/SKILL.md
Updated README to support multiple providers with provider-agnostic schema; added comprehensive Zhipu AI setup guide covering API key acquisition, configuration, debugging, and troubleshooting; added SKILL.md documenting configure skill with multi-provider configuration and environment variables.
Configuration Examples
skills/configure/examples/gemini-config.json, skills/configure/examples/minimal-config.json, skills/configure/examples/zhipu-ai-config.json, skills/configure/examples/exclude.txt
Added example configuration files for Gemini and Zhipu AI providers with placeholder API keys and models; added exclude.txt template for project filtering.
Package Dependencies
package.json
Added zhipuai-sdk-nodejs-v4 (^0.1.12) runtime dependency to support Zhipu AI provider integration.
LLM Core Infrastructure
src/core/llm/config.ts, src/core/llm/config.test.ts
Introduced LLMProviderType type supporting 'gemini' and 'zhipu-ai'; converted createProvider from synchronous to async with dynamic imports; added provider-specific default models; enhanced validation for provider values and required fields; updated tests to verify async behavior and provider-aware configurations.
Provider Implementations
src/core/llm/gemini-provider.ts, src/core/llm/gemini-provider.test.ts, src/core/llm/zhipu-provider.ts, src/core/llm/zhipu-provider.test.ts
Added ZhipuAIProvider class with completion, logging, and token usage tracking; added comprehensive unit tests for Zhipu provider with mocked API; simplified Gemini provider tests to remove internal mock assertions; enhanced Gemini provider with structured logging and timing.
LLM Index Exports
src/core/llm/index.ts, src/core/llm/index.test.ts
Exported new ZhipuAIProvider class; updated LLMConfig type to use flat apiKey field instead of nested gemini-specific config; updated tests to reflect new config shape.
Integration and Batch Processing
src/core/llm/batch-extract-prompt.ts, src/core/summarizer.ts, test-integration.ts, test-roundrobin.ts
Enhanced batch extraction with structured logging (start/end timing, event counts, prompt length, token usage); converted provider creation to async with await; updated integration tests to accept both 'gemini' and 'zhipu-ai' providers and use generic config fields; updated test-roundrobin to remove unused imports and await provider creation.
Test File
test.txt
Added minimal test placeholder file.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A hop through providers so fine,
Gemini's great, but Zhipu will shine!
Async awaits the LLM's call,
Multi-provider support for all—
Logs and configs in perfect line,
This plugin's future? Oh, quite divine!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ralph/second-feature

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@baleen37
baleen37 merged commit 4830853 into main Feb 10, 2026
4 of 5 checks passed
@baleen37
baleen37 deleted the ralph/second-feature branch February 10, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant