Skip to main content

llama-index llms iflytek spark integration

Project description

LlamaIndex Llms Integration: iFlytek Spark

iFlytek Spark exposes an OpenAI-compatible chat-completions API, so this integration builds on OpenAILike.

Installation

pip install llama-index-llms-iflytek

Usage

Get an API password from the iFlytek open platform console and pass it as api_key (or set the IFLYTEK_API_KEY environment variable). Pick a model such as generalv3.5, 4.0Ultra or lite.

from llama_index.llms.iflytek import IFlytek

llm = IFlytek(model="4.0Ultra", api_key="your-api-password")

response = llm.complete("用一句话介绍你自己")
print(response)

Chat and streaming work the same way as any other OpenAILike model:

from llama_index.core.llms import ChatMessage

messages = [ChatMessage(role="user", content="Hello")]
for chunk in llm.stream_chat(messages):
    print(chunk.delta, end="")

The default API base is https://spark-api-open.xf-yun.com/v1; override it with the IFLYTEK_API_BASE environment variable or the api_base argument if needed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_llms_iflytek-0.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_llms_iflytek-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_llms_iflytek-0.1.0.tar.gz.

File metadata

  • Download URL: llama_index_llms_iflytek-0.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llama_index_llms_iflytek-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ba125c1a21d27d5daf6bba1679c8e371aec0b5f8ab107a960ee64a4914c9e66f
MD5 123ef2884ca91cea4cd01ca46145eff8
BLAKE2b-256 a4d6105c223947af5f956ee3513c77f2c597444387bd6a2e3a6a5746f4950faf

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_llms_iflytek-0.1.0.tar.gz:

Publisher: publish.yml on FenjuFu/llama-index-llms-iflytek

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llama_index_llms_iflytek-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_llms_iflytek-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20a5543acd7174c4a4acd9663c9266d89ed0e7a559f3517b03110ff8c52c4d50
MD5 879610c57fc591c9490abbfc80529a57
BLAKE2b-256 9835bc0daa5f5388e5b3be4a73bdb54ae01326f31abdfc7fa4c5d7a93aa83c07

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_llms_iflytek-0.1.0-py3-none-any.whl:

Publisher: publish.yml on FenjuFu/llama-index-llms-iflytek

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page