plugin

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Colors
	RESET = "\033[0m"
	BOLD  = "\033[1m"

	// Foreground colors
	GREEN  = "\033[32m"
	YELLOW = "\033[33m"
	BLUE   = "\033[34m"
)
View Source
const (
	SUB_MENU_KEY_PROFILE    subMenuKey = "profile"
	SUB_MENU_KEY_LANGUAGE   subMenuKey = "language"
	SUB_MENU_KEY_CATEGORY   subMenuKey = "category"
	SUB_MENU_KEY_PERMISSION subMenuKey = "permission"
)
View Source
const (
	SUB_MENU_EVENT_NEXT subMenuEvent = "next"
	SUB_MENU_EVENT_PREV subMenuEvent = "prev"
	SUB_MENU_EVENT_NONE subMenuEvent = "none"
)
View Source
const AGENT_MODULE_TEMPLATE = `` /* 314-byte string literal not displayed */
View Source
const ENDPOINT_MODULE_TEMPLATE = `
========== Endpoints ==========
Path: {{.Path}}
Method: {{.Method}}
`
View Source
const MODEL_MODULE_TEMPLATE = `` /* 489-byte string literal not displayed */
View Source
const PLUGIN_GUIDE = `But before starting, you need some basic knowledge about the Plugin types, Plugin supports to extend the following abilities in Dify:
` + "\n" + BOLD + `- Tool` + RESET + `: ` + GREEN + `Tool Providers like Google Search, Stable Diffusion, etc. it can be used to perform a specific task.` + RESET + `
` + BOLD + `- Model` + RESET + `: ` + GREEN + `Model Providers like OpenAI, Anthropic, etc. you can use their models to enhance the AI capabilities.` + RESET + `
` + BOLD + `- Endpoint` + RESET + `: ` + GREEN + `Like Service API in Dify and Ingress in Kubernetes, you can extend a http service as an endpoint and control its logics using your own code.` + RESET + `
` + BOLD + `- Agent Strategy` + RESET + `: ` + GREEN + `You can implement your own agent strategy like Function Calling, ReAct, ToT, Cot, etc. anyway you want.` + RESET + `

Based on the ability you want to extend, we have divided the Plugin into four types: ` + BOLD + `Tool` + RESET + `, ` + BOLD + `Model` + RESET + `, ` + BOLD + `Extension` + RESET + `, and ` + BOLD + `Agent Strategy` + RESET + `.

` + BOLD + `- Tool` + RESET + `: ` + YELLOW + `It's a tool provider, but not only limited to tools, you can implement an endpoint there, for example, you need both ` + BLUE + `Sending Message` + RESET + YELLOW + ` and ` + BLUE + `Receiving Message` + RESET + YELLOW + ` if you are building a Discord Bot, ` + BOLD + `Tool` + RESET + YELLOW + ` and ` + BOLD + `Endpoint` + RESET + YELLOW + ` are both required.` + RESET + `
` + BOLD + `- Model` + RESET + `: ` + YELLOW + `Just a model provider, extending others is not allowed.` + RESET + `
` + BOLD + `- Extension` + RESET + `: ` + YELLOW + `Other times, you may only need a simple http service to extend the functionalities, ` + BOLD + `Extension` + RESET + YELLOW + ` is the right choice for you.` + RESET + `
` + BOLD + `- Agent Strategy` + RESET + `: ` + YELLOW + `Implement your own logics here, just by focusing on Agent itself` + RESET + `

What's more, we have provided the template for you, you can choose one of them below:
`
View Source
const PLUGIN_MODULE_TEMPLATE = `` /* 1250-byte string literal not displayed */
View Source
const TOOL_MODULE_TEMPLATE = `` /* 513-byte string literal not displayed */

Variables

View Source
var ENV_EXAMPLE []byte
View Source
var (
	MaxPluginPackageSize = int64(52428800) // 50MB
)
View Source
var PRIVACY []byte
View Source
var PYTHON_AGENT_PROVIDER_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_AGENT_STRATEGY_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_AGENT_STRATEGY_TEMPLATE []byte
View Source
var PYTHON_DIFYIGNORE []byte
View Source
var PYTHON_ENDPOINT_GROUP_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_ENDPOINT_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_ENDPOINT_TEMPLATE []byte
View Source
var PYTHON_ENTRYPOINT_TEMPLATE []byte
View Source
var PYTHON_GITIGNORE []byte
View Source
var PYTHON_GUIDE []byte
View Source
var PYTHON_LLM_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_LLM_TEMPLATE []byte
View Source
var PYTHON_MODEL_PROVIDER_PY_TEMPLATE []byte
View Source
var PYTHON_MODEL_PROVIDER_TEMPLATE []byte
View Source
var PYTHON_MODERATION_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_MODERATION_TEMPLATE []byte
View Source
var PYTHON_REQUIREMENTS_TEMPLATE []byte
View Source
var PYTHON_RERANK_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_RERANK_TEMPLATE []byte
View Source
var PYTHON_SPEECH2TEXT_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_SPEECH2TEXT_TEMPLATE []byte
View Source
var PYTHON_TEXT_EMBEDDING_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_TEXT_EMBEDDING_TEMPLATE []byte
View Source
var PYTHON_TOOL_PROVIDER_PY_TEMPLATE []byte
View Source
var PYTHON_TOOL_PROVIDER_TEMPLATE []byte
View Source
var PYTHON_TOOL_PY_TEMPLATE []byte
View Source
var PYTHON_TOOL_TEMPLATE []byte
View Source
var PYTHON_TTS_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_TTS_TEMPLATE []byte
View Source
var README []byte

Functions

func CalculateChecksum

func CalculateChecksum(pluginPath string)

func EditPermission

func EditPermission(pluginPath string)

func InitPlugin

func InitPlugin()

func ModuleAppendEndpoints

func ModuleAppendEndpoints(pluginPath string)

func ModuleAppendTools

func ModuleAppendTools(pluginPath string)

func ModuleList

func ModuleList(pluginPath string)

func PackagePlugin

func PackagePlugin(inputPath string, outputPath string)

func TestPlugin

func TestPlugin(pluginPath string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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