Skip to content
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

Supporting Zhipu AI API #462

Merged
merged 2 commits into from
Dec 13, 2024
Merged

Supporting Zhipu AI API #462

merged 2 commits into from
Dec 13, 2024

Conversation

JasonGuoo
Copy link
Contributor

Added Zhipu AI Support with Example

This PR adds support for Zhipu AI's API and includes a demo example:

Key Changes

Zhipu API Integration:

  • Implemented zhipu_complete and zhipu_embedding functions for chat completions and embeddings
  • Added proper handling of keyword extraction with JSON format responses
  • Implemented robust error handling and response parsing
  • Set default model to "glm-4-flashx" for optimal cost/performance balance

Example Usage:

  • Added lightrag_zhipu_demo.py demonstrating:
  • Basic chat completion

The implementation has been tested with:

  • Indexing the book from the main readme.
  • Answering questions with 4 query types.

Usage

To use Zhipu AI with LightRAG:

Set ZHIPUAI_API_KEY environment variable
Import and use the provided functions directly or through LightRAG's model interface
Refer to examples/lightrag_zhipu_demo.py for detailed usage examples

@LarFii LarFii merged commit 9cac3b0 into HKUDS:main Dec 13, 2024
1 check failed
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.

2 participants