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

File metadata

File hashes

Hashes for llama_index_multi_modal_llms_openai_like-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7dd0dbf3f81b98b412dfecb100ff26389ea3fe25c8f9419cb1f257bc18666ca0
MD5 b0b78dab186cd823f074bf625b9042f9
BLAKE2b-256 2aaccdb0b6ae81f39a68f41a8a4a99904b0fdce5290ee7be2b26b0e0b0fc86ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_multi_modal_llms_openai_like-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5fdb9fe03485ed635fb3239e68ca185d54d3c5d0370545ded31d8846fa9ad2c1
MD5 332ca0df1ac7aba7a3a095bd2408df02
BLAKE2b-256 77bb464c549feb94f93635228634cfb50887578ac9ba73b2a7fff07986d2c125

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