Skip to main content

llama-index llms gigachat integration

Project description

LlamaIndex Llms Integration: Gigachat

This package provides a Gigachat integration as LLM Module.

Installation

using poetry:

poetry add llama-index-llms-gigachat-ru

or using pip:

pip install llama-index-llms-gigachat-ru

Basic Usage

To initialize the Gigachat integration, you need to provide the credentials and optionally set verify_ssl_certs to False if you want to disable SSL certificate verification.

Then you will be able to use the complete method to get the completion.

from llama_index.llms.gigachat import GigaChatLLM

llm = GigaChatLLM(
    credentials="NjI0M2M4MzctNmEwMi00ZjhmLWIzYmEtMTBlMzdhZjI4NzNhOjgzYjM3YzFkLWQ3MTEtNGVhYi04Y2Q0LTkwODM5ZjI4MDg1Zg==",
    verify_ssl_certs=False,
)
resp = llm.complete("What is the capital of France?")
print(resp)

Also, you can use it asynchronously:

import asyncio
from llama_index.llms.gigachat import GigaChatLLM

llm = GigaChatLLM(
    credentials="NjI0M2M4MzctNmEwMi00ZjhmLWIzYmEtMTBlMzdhZjI4NzNhOjgzYjM3YzFkLWQ3MTEtNGVhYi04Y2Q0LTkwODM5ZjI4MDg1Zg==",
    verify_ssl_certs=False,
)


async def main():
    resp = await llm.acomplete("What is the capital of France?")
    print(resp)


asyncio.run(main())

And as a chat module:

import asyncio

from llama_index.core.chat_engine import SimpleChatEngine
from llama_index.llms.gigachat import GigaChatLLM

llm = GigaChatLLM(
    credentials="NjI0M2M4MzctNmEwMi00ZjhmLWIzYmEtMTBlMzdhZjI4NzNhOjgzYjM3YzFkLWQ3MTEtNGVhYi04Y2Q0LTkwODM5ZjI4MDg1Zg==",
    verify_ssl_certs=False,
)

chat = SimpleChatEngine.from_defaults(
    llm=llm,
)


async def main():
    resp = await chat.achat("What is the capital of France?")
    print(resp)


asyncio.run(main())

And as streaming completion:

import asyncio

from llama_index.llms.gigachat import GigaChatLLM

llm = GigaChatLLM(
    credentials="NjI0M2M4MzctNmEwMi00ZjhmLWIzYmEtMTBlMzdhZjI4NzNhOjgzYjM3YzFkLWQ3MTEtNGVhYi04Y2Q0LTkwODM5ZjI4MDg1Zg==",
    verify_ssl_certs=False,
)


async def main():
    async for resp in await llm.astream_complete(
        "What is the capital of France?"
    ):
        print(resp)


asyncio.run(main())

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_gigachat_ru-0.5.0.tar.gz (5.0 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_gigachat_ru-0.5.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_llms_gigachat_ru-0.5.0.tar.gz.

File metadata

  • Download URL: llama_index_llms_gigachat_ru-0.5.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_llms_gigachat_ru-0.5.0.tar.gz
Algorithm Hash digest
SHA256 a8104271a23a24aec2f98683a80164804c7bb374d36b37a8cdc17aab8989381a
MD5 fe06ea84d42fd423582cb47887b290aa
BLAKE2b-256 59a3153860f01b8fd397db1fe65306cce7247a44d0882efc30044dbaffe5485d

See more details on using hashes here.

File details

Details for the file llama_index_llms_gigachat_ru-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_llms_gigachat_ru-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_llms_gigachat_ru-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65381551d2ceb65e2288304c72e8f264e624aaf48e86c109a4c1d2a2cea5662d
MD5 633eb5d0d67bfd674bb1c5c720fc7050
BLAKE2b-256 178bf3a6cdb7617a4fcf6daf72f6e8506d97ef59e175cbb390eea0aaf45a1427

See more details on using hashes here.

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