Welcome to a mixture of Gen AI cookbook how-to recipes for Gen AI applications. These simple guides span across get-started examples on LLM prompting strategies, DSPy, building simple chatbots, retrieval generation augmentation (RAGs), LLM-based applications on OpenAI, Anthropic, Gemini, or Anyscale Endpoints, etc.
You'll find examples code and/or guides for common tasks using the OpenAI API, Anthropic, Google Gemini, Pinecone, Anyscale Endpoints and Ray framework.
To try these examples, you'll need an OpenAI account and an associated API key, Anthropic, Pinecone, or an Anyscale Endpoint account and an associated key. Even better, install OLlama on your laptop.
All examples are in Python, yet the concepts can be adapted to any programming language, so long as you can make REST API calls in the target language or use target language's SDK.
The examples in this cook are inspired (some modified, expanded or copied) from these resources, including:
- OpenAI Cookbook
- OpenAI Prompt Engineering Guide
- Prompt Engineering Guide and Prompt Engineering course by Elvis Saravia
- How I Won Singapore's GPT-4 Prompt Engineering Competition by Sheila Teo
- Ray Documentation and Anyscale blogs
- Anyscale Endpoints Documentation
- Anthropic Developer and User Guide
- ChatGPT Prompt Engineering for Developers
- LangChain for LLM Application Development
- Building Systems with the ChatGPT API
- DSPy: Programming framework for Language Models
- Various blog posts on medium.
- Best Prompt Techniques for Best LLM Responses
- LLM Beyond its Core Capabilities as AI Assistants or Agents
- Crafting Intelligent User Experiences: A Deep Dive into OpenAI Assistants API
- An Intuitive 101 Guide to Vector Embeddings
- An Exploratory Tour of Retrieval Augmented Generation (RAG) Paradigm
- An Exploratory Tour of DSPy: A Framework for Programing Language Models, not Prompting
Since I use either OpenAI, Anthropic, or Anyscale Endpoints, I provide three environment template files: env_anyscale_template, env_anthropic_template, and env_openai_template. Add your keys and model name to either of the files and copy the file to .env to the top-level directory. To migrate any OpenAI code to Anyscale Endpoints, use this simple guide. For the most part, the migration is seamless.
Also, you'll require some Python libraries. Use pip install -r requirements.txt
to install them.
Note: Don't share your environment files with API keys publicly.
I welcome contributions. Let's make this a Generative AI developer community-driven resource. Your contributions can include additions or expansions of these how-to guides.
Check existing issues and pull requests before contributing to avoid duplication. If you have suggestions for examples or guides, share them on the issues page.
Have GenAI fun! 🥳️
Jules