spark-ai-python  by iflytek

Python SDK for iFlytek Spark AI models

created 2 years ago
307 stars

Top 88.4% on sourcepulse

GitHubView on GitHub
Project Summary

This Python SDK provides a streamlined interface for interacting with iFlytek's Spark large language models, targeting developers building AI applications. It simplifies API calls, supports streaming, function calling, and integrates with popular frameworks like Langchain, AutoGen, and LlamaIndex, enabling faster development and deployment of AI solutions.

How It Works

The SDK leverages a client-server architecture, abstracting the complexities of direct API communication. It supports both standard and OpenAI-compatible API endpoints, allowing for flexible integration. Key features include streaming responses via callbacks or direct generator iteration, function calling for structured output, and multimodal capabilities, including image understanding. The design prioritizes ease of use and compatibility with existing AI development ecosystems.

Quick Start & Requirements

  • Install: pip install spark_ai_python (or use Tsinghua mirror: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple spark_ai_python)
  • Prerequisites: Python 3.8+, iFlytek account for app_id, api_key, and api_secret.
  • Setup: Requires environment variables or a .env file for API credentials.
  • Docs: https://github.com/iflytek/spark-ai-python

Highlighted Details

  • Supports OpenAI-style API endpoints for seamless integration with existing tools.
  • Offers native integration with AutoGen, LlamaIndex, and experimental support for AutoGPT, MetaGPT, and PromptFlow.
  • Includes a local proxy to expose Spark API as an OpenAI-compatible endpoint.
  • Provides support for multimodal inputs, including image understanding.

Maintenance & Community

The project is actively developed by iFlytek, with contributions acknowledged from the Langchain community. A WeChat group is available for community discussion.

Licensing & Compatibility

The SDK is released under an unspecified license. Its compatibility with commercial or closed-source applications depends on the underlying iFlytek service terms.

Limitations & Caveats

The project is noted to be in development, with some redundant code and potential for improvement in client instantiation for multi-threaded use (each thread requires a separate client). Streaming interfaces currently lack per-frame token count statistics.

Health Check
Last commit

7 months ago

Responsiveness

1 week

Pull Requests (30d)
1
Issues (30d)
0
Star History
11 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.