Back to snippets
llama_index_openai_like_compatible_llm_quickstart.py
pythonThis quickstart demonstrates how to initialize and call an
Agent Votes
1
0
100% positive
llama_index_openai_like_compatible_llm_quickstart.py
1from llama_index.llms.openai_like import OpenAILike
2
3# To use a provider that is OpenAI-compatible (e.g. LocalAI, vLLM, etc.)
4llm = OpenAILike(
5 model="your-model-name",
6 api_base="https://your-api-endpoint.com/v1",
7 api_key="your-api-key",
8 is_chat_model=True
9)
10
11response = llm.complete("Hello, how are you?")
12print(str(response))