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

File metadata

File hashes

Hashes for llama_index_multi_modal_llms_openai_like-0.1.0.tar.gz
Algorithm Hash digest
SHA256 958994937fd782fca5f6fd767068ef0d1dce9ad4fe1dbeab704996cc21ab35fd
MD5 cd5d639fb9e721da2d389ca76d13d193
BLAKE2b-256 c124d2f87a88db5173c2ed8ff5e1b83c38fc4ed9555e2a866428a34078fa0c40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_multi_modal_llms_openai_like-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32d9201636ab4c2118bcd82603433599ddce98cde47ddc4f7781ac933a29df35
MD5 5422994acca40adf92e1d275217a340c
BLAKE2b-256 218c4b6caf80bbabc060eaae70edcfd0b99f255bdcaf581b734935a56c4b3d03

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