Skip to content

Openllm

OpenLLM #

Bases: OpenAILike

OpenLLM LLM.

A thin wrapper around OpenAI interface to help users interact with OpenLLM's running server.

Examples:

pip install llama-index-llms-openllm

from llama_index.llms.openllm import OpenLLM

llm = OpenLLM(api_base="https://hostname.com/v1", api_key="na", model="meta-llama/Meta-Llama-3-8B-Instruct")

result = llm.complete("Hi, write a short story\n")

print(result)
Source code in llama-index-integrations/llms/llama-index-llms-openllm/llama_index/llms/openllm/base.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class OpenLLM(OpenAILike):
    r"""
    OpenLLM LLM.

    A thin wrapper around OpenAI interface to help users interact with OpenLLM's running server.


    Examples:
        `pip install llama-index-llms-openllm`

        ```python
        from llama_index.llms.openllm import OpenLLM

        llm = OpenLLM(api_base="https://hostname.com/v1", api_key="na", model="meta-llama/Meta-Llama-3-8B-Instruct")

        result = llm.complete("Hi, write a short story\n")

        print(result)

        ```
    """

    @classmethod
    def class_name(cls) -> str:
        return "OpenLLM"