Skip to content

dmatrix/genai-cookbook

Repository files navigation

GenAI Cookbook

github-stars twitter

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, or Anyscale Endpoints, etc.

You'll find examples code and/or guides for common tasks using the OpenAI API, Anthropic, 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:

Current Blogs on this cookbook

Environment files

Since I use 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.

Contributing

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