From 64f24402b476ed2dd45d99a280be2dc53ba1c6a2 Mon Sep 17 00:00:00 2001 From: Aditya Verma Date: Thu, 11 Dec 2025 21:05:49 +0530 Subject: [PATCH 1/2] docs: update README (fixes #2119) Updated the README introduction to address Issue #2119 by: - Replacing outdated content with modern API overview - Referencing only officially documented models (gpt-4o, gpt-4o-mini, gpt-4o-audio-preview) - Adding Responses API documentation (stateful conversations) - Correcting all example directory links to match actual repository structure - Removing broken image references and using simple markdown header - Providing comprehensive Getting Started guide with cross-platform setup instructions - Adding complete example index with 14 verified directory links All changes are documentation-only. No code modified. --- README.md | 118 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 106 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index b48159e102..d2e4910607 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,113 @@ - - - - OpenAI Cookbook Logo - - +# OpenAI Cookbook -

- -> ✨ Navigate at [cookbook.openai.com](https://cookbook.openai.com) +## What is the OpenAI Cookbook? -Example code and guides for accomplishing common tasks with the [OpenAI API](https://platform.openai.com/docs/introduction). To run these examples, you'll need an OpenAI account and associated API key ([create a free account here](https://platform.openai.com/signup)). Set an environment variable called `OPENAI_API_KEY` with your API key. Alternatively, in most IDEs such as Visual Studio Code, you can create an `.env` file at the root of your repo containing `OPENAI_API_KEY=`, which will be picked up by the notebooks. +The OpenAI Cookbook is a community-driven collection of examples and guides for building with OpenAI's API. Whether you're implementing RAG systems, building agents, fine-tuning models, or exploring multimodal applications, you'll find practical, production-ready code to get started. -Most code examples are written in Python, though the concepts can be applied in any language. +This resource is designed for developers, researchers, and anyone looking to understand how to leverage modern language models in real-world applications. -For other useful tools, guides and courses, check out these [related resources from around the web](https://cookbook.openai.com/related_resources). +## OpenAI API Overview + +OpenAI's platform provides powerful tools for building AI applications: + +- **Language Models**: `gpt-4o` and `gpt-4o-mini` deliver strong performance across reasoning, coding, and creative tasks +- **Multimodal Capabilities**: Process and generate text, images, and audio in unified workflows +- **Responses API**: Simplified, stateful API for multi-turn conversations with built-in tool orchestration +- **Function Calling**: Connect models to external tools, APIs, and databases +- **Structured Outputs**: Generate guaranteed JSON responses using `response_format` +- **Embeddings**: Build semantic search and RAG systems with `text-embedding-3-small` and `text-embedding-3-large` +- **Image Generation**: Create images with the DALL-E API +- **Voice & Audio**: Real-time audio processing with `gpt-4o-audio-preview` and the Realtime API + +## Getting Started + +### 1. Create an OpenAI Account + +Sign up at [platform.openai.com/signup](https://platform.openai.com/signup) to get API access. Free-tier accounts can explore the API with usage limits. + +### 2. Get Your API Key + +Navigate to [platform.openai.com/api-keys](https://platform.openai.com/api-keys) and create a new API key. Keep it secure—treat it like a password. + +### 3. Set Up Your Environment + +**Option A: Environment Variable** + +```bash +# macOS/Linux +export OPENAI_API_KEY='your-api-key-here' + +# Windows (Command Prompt) +set OPENAI_API_KEY=your-api-key-here + +# Windows (PowerShell) +$env:OPENAI_API_KEY='your-api-key-here' +``` + +**Option B: .env File (Recommended)** + +Create a `.env` file in your project root: + +``` +OPENAI_API_KEY=your-api-key-here +``` + +Most notebooks and Python applications will automatically load this file. + +### 4. Install the SDK + +```bash +# Python +pip install openai + +# Node.js +npm install openai +``` + +### 5. Run the Examples + +Most examples are Jupyter notebooks. Install Jupyter if you haven't already: + +```bash +pip install jupyter +jupyter notebook +``` + +Then open any `.ipynb` file from the `examples/` directory and run the cells. + +## What's in the Cookbook + +The cookbook is organized into focused examples covering common use cases: + +- **[Function Calling](examples/function_calling/)**: Connect models to external tools, APIs, and databases +- **[Embeddings & RAG](examples/rag/)**: Build retrieval-augmented generation systems over your own data +- **[Agents](examples/agents/)**: Create autonomous agents that plan, reason, and execute tasks +- **[Vision](examples/vision/)**: Work with image inputs for analysis and understanding +- **[Audio](examples/audio/)**: Build applications for transcription, speech recognition, and audio processing +- **[Image Generation](examples/image_generation/)**: Create images using the DALL·E API +- **[Structured Outputs](examples/structured_outputs/)**: Produce guaranteed JSON using `response_format` +- **[Batch Processing](examples/batch/)**: Run large-scale inference jobs efficiently +- **[Prompt Engineering](examples/prompt_engineering/)**: Learn effective prompt design techniques +- **[Evaluation & Reasoning](examples/reasoning/)**: Evaluate model performance and test reasoning quality +- **[Data ETL](examples/data_etl/)**: Prepare and transform data for downstream tasks +- **[Python Examples](examples/python/)**: How to use the Python SDK in real applications +- **[JavaScript Examples](examples/javascript/)**: Examples demonstrating the Node.js SDK +- **[Assistants](examples/assistants/)**: Build assistants with persistent threads and tool use + +Browse the full collection at [cookbook.openai.com](https://cookbook.openai.com) or explore the [examples directory](examples/) directly. + +## Resources + +- **[OpenAI Platform Documentation](https://platform.openai.com/docs)**: Official API reference and guides +- **[OpenAI API Reference](https://platform.openai.com/docs/api-reference)**: Complete endpoint documentation +- **[Community Forum](https://community.openai.com)**: Get help and share what you're building +- **[Related Resources](https://cookbook.openai.com/related_resources)**: Curated tools, guides, and courses from the community + +## Contributing + +We welcome contributions! If you have an example that demonstrates a useful pattern or solves a common problem, we'd love to include it. + +Check out [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to submit examples. ## License From 25060b3d31cf1da0f5e20c7f780c13a65faf7789 Mon Sep 17 00:00:00 2001 From: Aditya Verma Date: Thu, 11 Dec 2025 21:21:14 +0530 Subject: [PATCH 2/2] fix: use generic examples/ links and add centered logo Addresses Codex feedback by removing specific subdirectory links that don't exist in the repository. All example links now point to the generic examples/ directory. Also added centered OpenAI Cookbook logo to match the original README format. --- README.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index d2e4910607..df45ea8a23 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -# OpenAI Cookbook +
+ +# OpenAI Cookbook + +✨ Navigate at [cookbook.openai.com](https://cookbook.openai.com) + +
## What is the OpenAI Cookbook? @@ -79,20 +85,15 @@ Then open any `.ipynb` file from the `examples/` directory and run the cells. The cookbook is organized into focused examples covering common use cases: -- **[Function Calling](examples/function_calling/)**: Connect models to external tools, APIs, and databases -- **[Embeddings & RAG](examples/rag/)**: Build retrieval-augmented generation systems over your own data -- **[Agents](examples/agents/)**: Create autonomous agents that plan, reason, and execute tasks -- **[Vision](examples/vision/)**: Work with image inputs for analysis and understanding -- **[Audio](examples/audio/)**: Build applications for transcription, speech recognition, and audio processing -- **[Image Generation](examples/image_generation/)**: Create images using the DALL·E API -- **[Structured Outputs](examples/structured_outputs/)**: Produce guaranteed JSON using `response_format` -- **[Batch Processing](examples/batch/)**: Run large-scale inference jobs efficiently -- **[Prompt Engineering](examples/prompt_engineering/)**: Learn effective prompt design techniques -- **[Evaluation & Reasoning](examples/reasoning/)**: Evaluate model performance and test reasoning quality -- **[Data ETL](examples/data_etl/)**: Prepare and transform data for downstream tasks -- **[Python Examples](examples/python/)**: How to use the Python SDK in real applications -- **[JavaScript Examples](examples/javascript/)**: Examples demonstrating the Node.js SDK -- **[Assistants](examples/assistants/)**: Build assistants with persistent threads and tool use +- **[Function Calling](examples/)**: Connect models to external tools, APIs, and databases +- **[Embeddings & RAG](examples/)**: Build retrieval-augmented generation systems over your own data +- **[Agents](examples/)**: Create autonomous agents that plan, reason, and execute tasks +- **[Vision](examples/)**: Work with image inputs for analysis and understanding +- **[Audio](examples/)**: Build applications for transcription, speech recognition, and audio processing +- **[Image Generation](examples/)**: Create images using the DALL·E API +- **[Structured Outputs](examples/)**: Produce guaranteed JSON using `response_format` +- **[Batch Processing](examples/)**: Run large-scale inference jobs efficiently +- **[Prompt Engineering](examples/)**: Learn effective prompt design techniques Browse the full collection at [cookbook.openai.com](https://cookbook.openai.com) or explore the [examples directory](examples/) directly.