LlamaIndex
Use LlamaIndex with Cortecs through Chat Completions
1. Install the adapter
pip install llama-index-llms-openai-like2. Connect to Cortecs
import os
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
model=os.environ["CORTECS_MODEL"],
api_base="https://api.cortecs.ai/v1",
api_key=os.environ["CORTECS_API_KEY"],
is_chat_model=True,
is_function_calling_model=True,
)
response = llm.complete("Explain semantic search in two sentences.")
print(response)Last updated