### OpenAI Plugin Configuration Options Reference Source: https://github.com/elizaos-plugins/plugin-openai/blob/1.x/README.md Details the comprehensive list of environment variables and their descriptions used to configure the ElizaOS OpenAI plugin. This includes settings for API keys, base URLs, specific model overrides for various tasks, and parameters for embedding and image description functionalities. ```APIDOC OPENAI_API_KEY (required): Your OpenAI API credentials OPENAI_BASE_URL: Custom API endpoint (default: https://api.openai.com/v1) OPENAI_SMALL_MODEL: Defaults to GPT-4o Mini ("gpt-4o-mini") OPENAI_LARGE_MODEL: Defaults to GPT-4o ("gpt-4o") OPENAI_EMBEDDING_MODEL: Defaults to text-embedding-3-small ("text-embedding-3-small") OPENAI_EMBEDDING_API_KEY: Custom embedding api key (defaults to OPENAI_API_KEY) OPENAI_EMBEDDING_URL: Custom embedding endpoint (defaults to OPENAI_BASE_URL) OPENAI_EMBEDDING_DIMENSIONS: Defaults to 1536 (1536) OPENAI_IMAGE_DESCRIPTION_MODEL: Model used for image description (default: "gpt-4o-mini") OPENAI_IMAGE_DESCRIPTION_MAX_TOKENS: Maximum tokens for image descriptions (default: 8192) ``` -------------------------------- ### Generate Images with ElizaOS OpenAI Plugin Source: https://github.com/elizaos-plugins/plugin-openai/blob/1.x/README.md Demonstrates how to use the ElizaOS runtime to generate images via the OpenAI plugin. This snippet shows how to specify a text prompt, the number of images to generate, and the desired image resolution. ```js await runtime.useModel(ModelType.IMAGE, { prompt: 'A sunset over mountains', n: 1, // number of images size: '1024x1024' // image resolution }); ``` -------------------------------- ### Analyze Images with ElizaOS OpenAI Plugin Source: https://github.com/elizaos-plugins/plugin-openai/blob/1.x/README.md Illustrates how to use the ElizaOS runtime for image analysis through the OpenAI plugin. By providing an image URL, the `ModelType.IMAGE_DESCRIPTION` can extract structured information such as a title and description of the image content. ```js const { title, description } = await runtime.useModel( ModelType.IMAGE_DESCRIPTION, 'https://example.com/image.jpg' ); ``` -------------------------------- ### Transcribe Audio with ElizaOS OpenAI Plugin Source: https://github.com/elizaos-plugins/plugin-openai/blob/1.x/README.md Shows how to perform audio transcription using the ElizaOS runtime and the OpenAI plugin. The `ModelType.TRANSCRIPTION` is used, and an audio buffer is passed as input to receive the transcribed text. ```js const transcription = await runtime.useModel(ModelType.TRANSCRIPTION, audioBuffer); ``` -------------------------------- ### ElizaOS OpenAI Plugin Model Classes Reference Source: https://github.com/elizaos-plugins/plugin-openai/blob/1.x/README.md Lists the various model classes exposed by the ElizaOS OpenAI plugin, categorizing them by their intended use cases. This includes models optimized for text generation (small and large), text embeddings, DALL-E image generation, GPT-4o image analysis, Whisper audio transcription, and text tokenization. ```APIDOC TEXT_SMALL: Optimized for fast, cost-effective responses TEXT_LARGE: For complex tasks requiring deeper reasoning TEXT_EMBEDDING: Text embedding model (text-embedding-3-small by default) IMAGE: DALL-E image generation IMAGE_DESCRIPTION: GPT-4o image analysis TRANSCRIPTION: Whisper audio transcription TEXT_TOKENIZER_ENCODE: Text tokenization TEXT_TOKENIZER_DECODE: Token decoding ``` -------------------------------- ### Configure OpenAI Plugin Environment Variables Source: https://github.com/elizaos-plugins/plugin-openai/blob/1.x/README.md Shows how to set OpenAI plugin configuration options using environment variables, typically defined in a `.env` file. This method provides a flexible way to manage API keys, model selections, and custom endpoints outside of the main application code. ```plaintext OPENAI_API_KEY=your_openai_api_key # Optional overrides: OPENAI_BASE_URL=optional_custom_endpoint OPENAI_SMALL_MODEL=gpt-4o-mini OPENAI_LARGE_MODEL=gpt-4o OPENAI_EMBEDDING_MODEL=text-embedding-3-small OPENAI_EMBEDDING_API_KEY=your_openai_api_key_for_embedding OPENAI_EMBEDDING_URL=optional_custom_endpoint OPENAI_EMBEDDING_DIMENSIONS=1536 OPENAI_IMAGE_DESCRIPTION_MODEL=gpt-4o-mini OPENAI_IMAGE_DESCRIPTION_MAX_TOKENS=8192 ``` -------------------------------- ### Configure ElizaOS Plugin Usage Source: https://github.com/elizaos-plugins/plugin-openai/blob/1.x/README.md Demonstrates how to add the OpenAI plugin to an ElizaOS character configuration. This involves specifying the plugin's package name within the 'plugins' array in your character's JSON settings. ```json "plugins": ["@elizaos-plugins/plugin-openai"] ``` -------------------------------- ### Configure OpenAI Plugin Settings in ElizaOS Character JSON Source: https://github.com/elizaos-plugins/plugin-openai/blob/1.x/README.md Illustrates how to define OpenAI plugin settings directly within the ElizaOS character configuration's 'settings' object. This includes essential parameters like API keys, custom base URLs, and specific model overrides for different functionalities. ```json "settings": { "OPENAI_API_KEY": "your_openai_api_key", "OPENAI_BASE_URL": "optional_custom_endpoint", "OPENAI_SMALL_MODEL": "gpt-4o-mini", "OPENAI_LARGE_MODEL": "gpt-4o", "OPENAI_EMBEDDING_MODEL": "text-embedding-3-small", "OPENAI_EMBEDDING_API_KEY": "your_openai_api_key_for_embedding", "OPENAI_EMBEDDING_URL": "optional_custom_endpoint", "OPENAI_EMBEDDING_DIMENSIONS": "1536", "OPENAI_IMAGE_DESCRIPTION_MODEL": "gpt-4o-mini", "OPENAI_IMAGE_DESCRIPTION_MAX_TOKENS": "8192" } ``` -------------------------------- ### Generate Text Embeddings with ElizaOS OpenAI Plugin Source: https://github.com/elizaos-plugins/plugin-openai/blob/1.x/README.md Explains how to obtain text embeddings using the ElizaOS runtime and the OpenAI plugin. The `ModelType.TEXT_EMBEDDING` is utilized to convert a given string into its corresponding vector representation. ```js const embedding = await runtime.useModel(ModelType.TEXT_EMBEDDING, 'text to embed'); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.