Skip to main content

llama-index multi-modal-llms openai-like integration

Project description

LlamaIndex Llms Integration: Openai Like

Overview

This package is a thin wrapper around the OpenAI API. It is designed to be used with the OpenAI API, but can be used with any OpenAI-compatible API into multimodal language models of the LlamaIndex framework.

Installation

pip install llama-index-multi-modal-llms-openai-like

Usage

Initialization

from llama_index.multi_modal_llms.openai_like import OpenAILikeMultiModal

llm = OpenAILikeMultiModal(
    model="Qwen/Qwen2-VL-72B-Instruct-base",
    api_base="http://localhost:1234/v1",
)

Without environmental variables

from llama_index.multi_modal_llms.openai_like import OpenAILikeMultiModal

llm = OpenAILikeMultiModal(
    api_key="your_api_key",
    model="Qwen/Qwen2-VL-72B-Instruct-base",
    api_base="http://localhost:1234/v1",
)

Launching

Load images

from llama_index.core.multi_modal_llms.generic_utils import load_image_urls

image_urls = [
    "https://res.cloudinary.com/hello-tickets/image/upload/c_limit,f_auto,q_auto,w_1920/v1640835927/o3pfl41q7m5bj8jardk0.jpg",
]
image_documents = load_image_urls(image_urls)

Call complete with a prompt

complete_response = mm_llm.complete(
    prompt="Describe the images as an alternative text",
    image_documents=image_documents,
)

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

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

File details

Details for the file llama_index_multi_modal_llms_openai_like-0.2.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_multi_modal_llms_openai_like-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0bc7b697f3aa6711ce5323ea03ae565db17bf24fc7d9e473ca32897c5f444e2b
MD5 c10c9abc9678ab843040503dcd56db6f
BLAKE2b-256 e3eed68c2f85eba98adba302c79fbbc6f28947ae116206de9d930dd1761c7e12

See more details on using hashes here.

File details

Details for the file llama_index_multi_modal_llms_openai_like-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_multi_modal_llms_openai_like-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8d1e13571d1a9d232250d635100a80bb2e55b34644e1a968f3d9ce188eb3d7eb
MD5 6ec44b7bc1ddefa9330755882b041352
BLAKE2b-256 c4552671a1e32f0a1fe224c53186e3e3ddbc2d3e0b5f1fce337ad4d9758ff225

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