gh-models

command module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 3 Imported by: 0

README

GitHub Models extension

Use the GitHub Models service from the CLI!

Using

Prerequisites

The extension requires the gh CLI to be installed and in the PATH. The extension also requires the user have authenticated via gh auth.

Installing

After installing the gh CLI, from a command-line run:

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

Examples

Listing models
gh models list

Example output:

Name                          Friendly Name                 Publisher
AI21-Jamba-Instruct           AI21-Jamba-Instruct           AI21 Labs
gpt-4o                        OpenAI GPT-4o                 Azure OpenAI Service
gpt-4o-mini                   OpenAI GPT-4o mini            Azure OpenAI Service
Cohere-command-r              Cohere Command R              cohere
Cohere-command-r-plus         Cohere Command R+             cohere

Use the value in the "Name" column when specifying the model on the command-line.

Running inference
REPL mode

Run the extension in REPL mode. This will prompt you for which model to use.

gh models run

In REPL mode, use /help to list available commands. Otherwise just type your prompt and hit ENTER to send to the model.

Single-shot mode

Run the extension in single-shot mode. This will print the model output and exit.

gh models run gpt-4o-mini "why is the sky blue?"

Run the extension with output from a command. This uses single-shot mode.

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

Developing

Building

Run script/build. Now you can run the binary locally, e.g. ./gh-models list

Releasing

gh extension upgrade github/gh-models or gh extension install github/gh-models will pull the latest release, not the latest commit, so all changes require cutting a new release:

git tag v0.0.x main
git push origin tag v0.0.x

This will trigger the release action that runs the actual production build.

Documentation

Overview

Package main provides the entry point for the gh-models extension.

Directories

Path Synopsis
cmd
Package cmd represents the base command when called without any subcommands.
Package cmd represents the base command when called without any subcommands.
list
Package list provides a gh command to list available models.
Package list provides a gh command to list available models.
run
Package run provides a gh command to run a GitHub model.
Package run provides a gh command to run a GitHub model.
view
Package view provides a `gh models view` command to view details about a model.
Package view provides a `gh models view` command to view details about a model.
internal
azuremodels
Package azuremodels provides a client for interacting with the Azure models API.
Package azuremodels provides a client for interacting with the Azure models API.
sse
Package sse provides a reader for Server-Sent Events (SSE) streams.
Package sse provides a reader for Server-Sent Events (SSE) streams.
ux
Package ux provides utility functions around presentation and user experience.
Package ux provides utility functions around presentation and user experience.
pkg
util
Package util provides utility functions for the gh-models extension.
Package util provides utility functions for the gh-models extension.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL