genkitvolcengine

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

GenKit Plugin for VolcEngine

A Go plugin for Firebase GenKit that provides seamless integration with VolcEngine's models. This plugin enables developers to leverage advanced AI capabilities including text generation, streaming responses, tool calling, and multimodal support.

✨ Features

  • 🚀 Text Generation: Support for various Doubao and DeepSeek models
  • 📡 Streaming Support: Real-time response streaming for better user experience
  • 🛠️ Tool Calling: Function calling capabilities for complex AI workflows
  • 🎯 Multimodal Support: Handle text, images, audio, and video inputs
  • ⚡ High Performance: Optimized for production workloads
  • 🔧 Easy Configuration: Multiple initialization methods for different use cases

📦 Installation

Prerequisites
Install the Plugin
go get github.com/ipfans/genkit-plugin-volcengine
Import in Your Project
import (
    "github.com/firebase/genkit/go/genkit"
    volcengine "github.com/ipfans/genkit-plugin-volcengine"
)

🚀 Quick Start

Basic Setup
    // Initialize GenKit with VolcEngine plugin
    genkit.Init(
        ctx,
        genkit.WithPlugins(
            volcengine.VolcEngineWithAPIKey(
                os.Getenv("VOLCENGINE_API_KEY"),
            ),
        ),
    )
Environment Configuration

Set your VolcEngine API key:

export VOLCENGINE_API_KEY="your_volcengine_api_key_here"

Or create a .env file:

echo "VOLCENGINE_API_KEY=your_volcengine_api_key_here" > .env

📊 Supported Models

Model Type Capabilities Latest Version
doubao-seed-1-6 Multimodal Text, Images, Audio, Video, Tools doubao-seed-1-6-250615
doubao-seed-1-6-vision Multimodal Text, Images, Audio, Video, Tools doubao-seed-1-6-vision-250815
doubao-seed-1-6-flash Multimodal Text, Images, Audio, Video, Tools doubao-seed-1-6-flash-250828
deepseek-r1 Text Text Generation, Tools deepseek-r1-250120
deepseek-v3 Text Text Generation, Tools deepseek-v3-250324
deepseek-v3-1 Text Text Generation, Tools deepseek-v3-1-250821
Model Features
  • ✅ Multiturn Conversations: All models support conversation history
  • ✅ Tool Calling: Function calling for external integrations
  • ✅ System Messages: Custom system prompts for behavior control
  • ✅ Streaming: Real-time response generation
  • ✅ Multimodal: Image, audio, and video support (Doubao models only)

⚙️ Configuration Options

Plugin Initialization
With API Key
volcengine.VolcEngineWithAPIKey("your_api_key")
With Custom Client
volcengine.VolcEngineWithClient(client)

🛠️ Development

Building the Project
# Clone the repository
git clone https://github.com/ipfans/genkit-plugin-volcengine.git
cd genkit-plugin-volcengine

# Build the module
go build

# Run tests
go test ./...

# Update dependencies
go mod tidy
Code Quality
# Format code
go fmt ./...

# Vet code
go vet ./...

# Static analysis
golangci-lint run
Example Project

Check out the example directory for a complete working example that demonstrates:

  • Basic setup and configuration
  • Model selection and usage
  • Development server setup
  • Task automation with Taskfile

🔧 Troubleshooting

Common Issues

API Key Not Set

Error: VOLCENGINE_API_KEY environment variable is not set
Solution: Set the environment variable or pass the key during initialization

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Workflow
  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request
Reporting Issues

Please use the GitHub Issues page to report bugs or request features.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

Documentation

Index

Constants

View Source
const (
	// PluginName is the name of this plugin.
	PluginName = "volcengine"
)

Variables

View Source
var (
	BasicText = &ai.ModelSupports{
		Multiturn:   true,
		Tools:       true,
		ToolChoice:  true,
		SystemRole:  true,
		Media:       false,
		Constrained: ai.ConstrainedSupportAll,
	}

	Multimodal = &ai.ModelSupports{
		Multiturn:   true,
		Tools:       true,
		ToolChoice:  true,
		SystemRole:  true,
		Media:       true,
		Constrained: ai.ConstrainedSupportNoTools,
	}
)

Functions

This section is empty.

Types

type ModelGenerator

type ModelGenerator struct {
	// contains filtered or unexported fields
}

ModelGenerator handles VolcEngine generation requests

func NewModelGenerator

func NewModelGenerator(client *arkruntime.Client, modelName string) *ModelGenerator

NewModelGenerator creates a new ModelGenerator instance

func (*ModelGenerator) Generate

func (g *ModelGenerator) Generate(ctx context.Context, handleChunk func(context.Context, *ai.ModelResponseChunk) error) (*ai.ModelResponse, error)

Generate executes the generation request

func (*ModelGenerator) WithConfig

func (g *ModelGenerator) WithConfig(config any) *ModelGenerator

WithConfig adds configuration parameters from the model request see https://www.volcengine.com/docs/82379/1494384 for more details on openai's request fields

func (*ModelGenerator) WithMessages

func (g *ModelGenerator) WithMessages(messages []*ai.Message) *ModelGenerator

func (*ModelGenerator) WithTools

func (g *ModelGenerator) WithTools(tools []*ai.ToolDefinition) *ModelGenerator

WithTools adds tools to the request

type VolcEngine

type VolcEngine struct {
	// contains filtered or unexported fields
}

VolcEngine is the Genkit go plugin for VolcEngine.

func VolcEngineWithAPIKey

func VolcEngineWithAPIKey(apiKey string) *VolcEngine

func VolcEngineWithClient

func VolcEngineWithClient(client *arkruntime.Client) *VolcEngine

func (*VolcEngine) DefineModel

func (v *VolcEngine) DefineModel(id string, opts *ai.ModelOptions) ai.Model

func (*VolcEngine) Init

func (v *VolcEngine) Init(ctx context.Context) []api.Action

func (*VolcEngine) Name

func (v *VolcEngine) Name() string

Jump to

Keyboard shortcuts

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