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
or using pip:
pip install llama-index-llms-gigachat
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_llms_gigachat_ru-0.3.0.tar.gz.
File metadata
- Download URL: llama_index_llms_gigachat_ru-0.3.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13e8dade099d3f1581fb3344f585b323b2a70c830f3f8819fd8ec9a6e21dcc7b
|
|
| MD5 |
acfcf2d3129493979dbc25455458d750
|
|
| BLAKE2b-256 |
01d0e4ac23338cd228d4ecfee74055ca66e871ae508bdd158b693fa492fb3599
|
File details
Details for the file llama_index_llms_gigachat_ru-0.3.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_llms_gigachat_ru-0.3.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b922efa63ae0f3965c0012f9dc69d6f87124cb3fb4e90d6c8936297f44dea79
|
|
| MD5 |
6c1d43e4680cf12eb273977690770ca2
|
|
| BLAKE2b-256 |
2db5f4a1623c5a0526868f0cd7c05d2b5ce9aec0c5d68ac1bd568c0bfd8fd3f2
|