Skip to main content

locaith

Python SDK cho Locaith-4-flash: tìm web, suy luận, ngữ cảnh 64K, Bio-Memory (kho nhớ riêng, bật sẵn).

pip install locaith
from locaith import Locaith

client = Locaith(api_key="LocAI...")      # hoặc đặt biến môi trường LOCAITH_API_KEY

print(client.ask("Giá vàng SJC hôm nay?"))
print(client.ask("Tôi là kế toán trưởng công ty ABC."))
print(client.ask("Bạn nhớ tôi làm nghề gì?"))   # nhớ từ lần trước, kể cả sau khi tắt chương trình

Mỗi người dùng cuối một kho nhớ riêng:

client = Locaith(api_key="LocAI...", user="khach_123")

Đầy đủ:

r = client.chat.completions.create(
    messages=[{"role": "user", "content": "Giá vàng SJC hôm nay?"}],
)
print(r.choices[0].message.content, [s.url for s in r.sources], r.reasoning)

for text in client.chat.completions.create(messages="Viết bài về AI", stream=True).text():
    print(text, end="", flush=True)

client.chat.completions.create(messages="Câu hỏi riêng tư", memory=False)   # tắt nhớ cho một câu

client.memory.list()
client.memory.add("Quy ước báo cáo", "Đơn vị triệu đồng.", type="feedback")
client.memory.export("ky-uc.zip")

Async:

from locaith import AsyncLocaith

async with AsyncLocaith() as client:
    print(await client.ask("Xin chào"))

Tương thích OpenAI: base_url="https://memory-api.locaith.com/v1".

Trả lời nhanh (tắt suy luận, tự đặt truy vấn tìm web):

client.ask("Giá vàng SJC hôm nay?", reasoning_effort="none", search_query="giá vàng SJC hôm nay")

Tạo file Word / Excel / PowerPoint / PDF / biểu đồ:

r = client.chat.completions.create(messages="Xuất file Word hợp đồng dịch vụ tư vấn giữa Công ty ABC và Công ty Locaith, 120 triệu đồng")
print(r.text)
for f in r.files:
    client.files.download(f, "./tai-ve/")      # f.name, f.kind, f.size, f.url (hiệu lực 24 giờ)

Metadata

Release files for locaith 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for locaith 1.2.0
File Size Uploaded Provenance
locaith-1.2.0.tar.gz 10.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for locaith 1.2.0
File Interpreter ABI Platform
locaith-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.4 kB

Release files / locaith-1.2.0.tar.gz

Download URL locaith-1.2.0.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
64bc799cab85d61c620c48cf60d79581f2404430bb47fc9ec713a4fd8c96ae51
BLAKE2b-256 checksum
How to use checksums
e5f77b738ba96d2c3df539570df6513c3ecda08577a04ed8e56097a043bf3161
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / locaith-1.2.0-py3-none-any.whl

Download URL locaith-1.2.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f992f32fb80f11887e1987cdf092efb2a8f9a5809e9b9d75a10a701dabbff4bf
BLAKE2b-256 checksum
How to use checksums
9c0d8f0fe379935debf2f2d295742f57cec5d3fbbcc9789bbe2b325918cca38f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for locaith 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page