pypi.org
About Llama Index Llms Openai
LlamaIndex Llms Integration: Openai Installation To install the required package, run: Setup 1. Set your OpenAI API key as an environment variable. You can replace "sk-..." with your actual API key: Basic Usage Generate Completions To generate a completion for a prompt, use the complete method: Chat Responses To send a chat message and receive a response, create a list of ChatMessage instances and use the chat method: Streaming Responses Stream Complete To stream responses for a prompt, use the stream_complete method: Stream Chat To stream chat responses, use the stream_chat method: Configure Model You can specify a particular model when creating the OpenAI instance: Asynchronous Usage You can also use asynchronous methods for completion: Set API Key at a Per-Instance Level If desired, you can have separate LLM instances use different API keys: LLM Implementation example https://docs.llamaindex.ai/en/stable/examples/llm/openai/
Description summarised by AI from the sources listed below.
Key features
- completion generation
- generate completions
- chat responses
- streaming responses
- stream responses
Use cases
- completion generation
- chat responses
Pricing
Pricing model: Unknown — we have not been able to confirm pricing from the official website, so nothing is stated here.
Pricing summarised by AI from the sources listed below.
