huoshan

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

README

火山引擎AI能力

配置 Access Key ID & Secret Access Key

在火山引擎的控制台中,获取Access Key ID & Secret Access Key(建议使用子账号)

将 AK 和 SK 以逗号分隔的形式填入 ai.yml 或 env.yml 中

ai:
  huoshan:
    apiKey: AK,SK

建议将 AK&SK 加密,使用工具sskey

sskey -e 'AK,SK'

复制url base64编码后的字符串填入 ai.yml 或 env.yml 中

火山方舟大模型

控制台的在线推理中创建接入点,使用接入点ID(ep-开头)作为模型名称配置到chat中并赋予一个名称

ai:
  huoshan:
    chat:
      fastAsk:
        model: ep-20241030164919-wql26

调用时的代码为:

import co from 'apigo.cc/gojs/console'
import ai from 'apigo.cc/ai'

return ai.huoshan.fastAsk('用一句话介绍一下你的主人', co.info, {
    systemPrompt: '你的主人叫张三,是个程序员'
})

图片生成

import co from 'apigo.cc/gojs/console'
import ai from 'apigo.cc/ai'

return ai.huoshan.makeImage({
    prompt: '在山顶,一位美丽的主人,头戴精致帽子,优雅地坐在藤椅上,手中端着一杯香浓的咖啡,身旁是云雾缭绕的美景,阳光洒在她身上,仿佛一幅宁静而美好的画面'
})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chat added in v0.0.5

func Chat(aiConf *ai.AIConfig, messages []ai.ChatMessage, callback func(string), conf ai.ChatConfig) (ai.ChatResult, error)

func Edit added in v0.0.6

func Edit(aiConf *ai.AIConfig, from string, conf map[string]any) (ai.StringResult, error)

func Embedding added in v0.0.5

func Embedding(aiConf *ai.AIConfig, text string, embeddingConf ai.EmbeddingConfig) (ai.EmbeddingResult, error)

func MakeImage added in v0.0.5

func MakeImage(aiConf *ai.AIConfig, conf ai.ImageConfig) (ai.ImageResult, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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