Skip to main content

llama-index llms opea integration

Project description

LlamaIndex Llms Integration: OPEA LLM

OPEA (Open Platform for Enterprise AI) is a platform for building, deploying, and scaling AI applications. As part of this platform, many core gen-ai components are available for deployment as microservices, including LLMs.

Visit https://opea.dev for more information, and their GitHub for the source code of the OPEA components.

Installation

  1. Install the required Python packages:
%pip install llama-index-llms-opea

Usage

from llama_index.core.llms import ChatMessage
from llama_index.llms.opea import OPEA

llm = OPEA(
    model="meta-llama/Meta-Llama-3.1-8B-Instruct",
    api_base="http://localhost:8080/v1",
    temperature=0.7,
    max_tokens=256,
    additional_kwargs={"top_p": 0.95},
)

# Complete a prompt
response = llm.complete("What is the capital of France?")
print(response)

# Stream a chat response
response = llm.stream_chat(
    [ChatMessage(role="user", content="What is the capital of France?")]
)
for chunk in response:
    print(chunk.delta, end="", flush=True)

All available methods include:

  • complete()
  • stream_complete()
  • chat()
  • stream_chat()

as well as async versions of the methods with the a prefix.

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_opea-0.1.2.tar.gz (3.8 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_opea-0.1.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_llms_opea-0.1.2.tar.gz.

File metadata

File hashes

Hashes for llama_index_llms_opea-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2a658abf3c4618b3bb7ec46e57d929954c6c45b63828bd3ef0bbfdc2a3695eaf
MD5 7e9c6f1496ebe72978a5d14018baccef
BLAKE2b-256 3ed95cf21f18fb3af312b89e64521e15cde936da7b0433ca5a2bca65461f41a1

See more details on using hashes here.

File details

Details for the file llama_index_llms_opea-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_llms_opea-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c3d2762c1a306486f24f57a2debc26ac2dd291d1aa201ab338bc9faf33dae956
MD5 241d884cfe76ec5e23a50640137f6fca
BLAKE2b-256 17387e2fa1e37b4c2785c5ef60ee20393d4b708d86d21b66f0c174de98606b28

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