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.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_multi_modal_llms_openai_like-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f527aca66c0068b1a4d164f9dbfdbd7542596ad214cd113a8760904e1572a21d
MD5 0b512c34ffb623a825c88be8f335bb3f
BLAKE2b-256 7662a7112cd091c3f1d5a4e4e5f3a9338ff84ece324e7f1cddd0ca8a6a1811ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_multi_modal_llms_openai_like-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 199fc98e6577f944b79f9b254fd552ba8c59014776f1442c399cb696bc3ec33e
MD5 073112af2476934fb578850300f9fc04
BLAKE2b-256 2225d2f3fe1fda83460a65802a460fadd740c9abfeacb4d77fa0fcc9c56689d9

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