GitHub Models: Integrating AI Models into Development Workflows

GitHub Models: Integrating AI Models into Development Workflows

Part 2: AI-Powered Techniques for Increasing Efficiency in workflows

Welcome to the GitHub Models series! This series will guide you through using GitHub Models to enhance development workflows by integrating AI into projects. We'll explore key features, learn to prototype AI models, integrate them into workflows, and cover best practices. By the end, you’ll be ready to leverage GitHub Models effectively!


In Part 1: An Overview of AI Prototyping, we explored the basics of GitHub Models and how to get started with prototyping. Now, in Part 2, we’ll look at how to integrate these AI models directly into your development workflows. For this example, we’ll walk through building a simple FAQ bot using GitHub Models, showing you how to streamline tasks, automate responses, and save time.

Workflow Integration with GitHub Models

GitHub Models allows you to integrate AI capabilities into various aspects of your workflow with 2 methods.

Method 1: Using AI Models in Copilot Chat

If you have a GitHub Copilot subscription, you can integrate AI models in Copilot Chat in 2 ways:

  1. Using the GitHub Models Copilot Extension: The GitHub Models Copilot Extension enables you to ask for model recommendations based on criteria and chat with specific models. For instance, you can ask the extension to recommend a low-cost OpenAI model that supports function calling.

  1. Using Multi-Model Support in Copilot Chat: Multi-model Copilot Chat allows you to choose a specific model to use for a conversation. This feature enables you to select a model based on the task you're working on and prompt Copilot Chat as usual, without switching contexts.

Method 2: Using the GitHub Models CLI Extension

If you do not have a Copilot subscription, you can also use AI models from the command line with the GitHub Models CLI extension. The extension allows you to prompt AI models directly from your terminal and even pass the output of commands as context.

To get started, install GitHub CLI if you haven't already.

Then, install the GitHub Models extension with the following command:

gh extension install https://github.com/github/gh-models

You can now use several commands:

  • To ask a model multiple questions using a chat experience, run:

      gh models run
    
  • To ask a model a single question, run:

      gh models run MODEL-NAME "What's the capital of Australia?"
    
  • To provide context using the output of a command, you can pipe the command to the model call. For example:

      cat README.md | gh models run gpt-4o "summarize this text"
    

This functionality allows you to leverage AI for tasks such as summarizing files or answering questions based on dynamic outputs.

Example Use Case

Here’s an example of how to create a simple FAQ bot using the GitHub Models CLI Extension:

Step 1: Install GitHub CLI and the Models Extension

If you haven't already, install GitHub CLI and login:

gh auth login

Then, install the GitHub Models extension:

gh extension install https://github.com/github/gh-models

Step 2: Choose Your Model

For a simple FAQ bot, we’ll use a model such as gpt-4o to respond to user queries.

Step 3: Create the FAQ Bot Command

You can create a simple loop in your terminal to ask questions and get responses. Run the following command to ask a question directly:

gh models run gpt-4o "How do I reset my password?"

For multiple questions, use:

gh models run

This allows you to ask several questions in one session. You can also pipe in the content from a file for additional context:

cat FAQ.txt | gh models run gpt-4o "What are the support hours?"

This setup will provide responses to frequently asked questions, allowing for quick automation of standard queries.

Benefits of Integrating AI Models in Workflows

  1. Automation of Repetitive Tasks: Models can answer common questions, reducing the time support teams spend on FAQs.

  2. Enhanced Productivity: Developers can use models to generate code snippets, suggest functions, or even write documentation drafts.

  3. Scalability: As your project grows, you can scale AI-powered tools like this FAQ bot to accommodate more complex queries.

Conclusion

With GitHub Models, integrating AI-powered tools into your workflow is simple and effective. You can automate repetitive tasks, handle large volumes of user queries, and keep your team focused on higher-value work. Thanks for reading!

In the next article, we’ll discuss best practices for responsible AI use to ensure ethical and efficient AI deployment in your projects. Stay tuned! Cheers!

Let's Connect!


Reference: GitHub Documentation

Did you find this article valuable?

Support Articles by Victoria Lo by becoming a sponsor. Any amount is appreciated!