examples/

directory
v0.0.0-...-a08e435 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: MIT

README

TabbyAPI Go Client Examples

This directory contains examples demonstrating how to use the Go client library for TabbyAPI.

Overview

These examples showcase various features of the TabbyAPI Go client:

  • Completions: Text generation examples
  • Chat: Conversational AI examples
  • Embeddings: Vector embedding generation
  • Models: Model management and monitoring

Prerequisites

Before running these examples, make sure you have:

  1. A running TabbyAPI server (locally or remote)
  2. Appropriate environment variables set:
    • TABBY_API_ENDPOINT (defaults to http://localhost:8080)
    • TABBY_API_KEY (if your server requires API key authentication)
    • TABBY_ADMIN_KEY (for examples that require administrative access)
    • TABBY_MODEL_NAME (for model loading examples)

Running the Examples

Navigate to the specific example directory and run the Go program. For example:

cd completions/basic
go run main.go

Example Categories

Completions
  • Basic: Simple text completion with a single prompt
  • Streaming: Real-time streaming of generated text
  • JSON Schema: Structured completions using JSON schema validation
Chat
  • Basic: Multi-turn conversation with the model
  • Streaming: Real-time streaming of chat responses
  • JSON Schema: Structured chat responses using JSON schema validation
Embeddings
  • Basic: Generate vector embeddings from text inputs
Models
  • List: List available models and currently loaded model
  • Streaming: Stream model loading progress in real-time

Additional Resources

For more information about the TabbyAPI Go client, see the main repository documentation.

Directories

Path Synopsis
chat
basic
Package main provides a basic example of using the TabbyAPI client for chat completions.
Package main provides a basic example of using the TabbyAPI client for chat completions.
json_schema
Package main provides an example of using JSON schema with TabbyAPI for structured chat completions.
Package main provides an example of using JSON schema with TabbyAPI for structured chat completions.
streaming
Package main provides an example of using the TabbyAPI client for streaming chat completions.
Package main provides an example of using the TabbyAPI client for streaming chat completions.
completions
basic
Package main provides a basic example of using the TabbyAPI client for text completions.
Package main provides a basic example of using the TabbyAPI client for text completions.
json_schema
Package main provides an example of using JSON schema with TabbyAPI for structured completions.
Package main provides an example of using JSON schema with TabbyAPI for structured completions.
streaming
Package main provides an example of using the TabbyAPI client for streaming text completions.
Package main provides an example of using the TabbyAPI client for streaming text completions.
embeddings
basic
Package main provides an example of using the TabbyAPI client for generating embeddings.
Package main provides an example of using the TabbyAPI client for generating embeddings.
models
list
Package main provides an example of using the TabbyAPI client for model management.
Package main provides an example of using the TabbyAPI client for model management.
streaming
Package main provides an example of using the TabbyAPI client to stream model loading progress.
Package main provides an example of using the TabbyAPI client to stream model loading progress.

Jump to

Keyboard shortcuts

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