OpenRouter Vendor

This commit is contained in:
Rudi Bruchez 2024-09-03 18:19:33 +02:00
parent 1ef492449d
commit 824e2eb190
4 changed files with 22 additions and 2 deletions

View File

@ -17,6 +17,9 @@ import (
"github.com/danielmiessler/fabric/vendors/groc"
"github.com/danielmiessler/fabric/vendors/ollama"
"github.com/danielmiessler/fabric/vendors/openai"
"github.com/danielmiessler/fabric/vendors/openrouter"
// "github.com/danielmiessler/fabric/vendors/openrouter"
"github.com/danielmiessler/fabric/youtube"
"github.com/pkg/errors"
)
@ -59,7 +62,7 @@ func NewFabricBase(db *db.Db) (ret *Fabric) {
"Enter the index the name of your default model")
ret.VendorsAll.AddVendors(openai.NewClient(), azure.NewClient(), ollama.NewClient(), groc.NewClient(),
gemini.NewClient(), anthropic.NewClient())
gemini.NewClient(), anthropic.NewClient(), openrouter.NewClient())
return
}

View File

@ -3,8 +3,9 @@ package core
import (
"context"
"fmt"
"github.com/danielmiessler/fabric/vendors"
"sync"
"github.com/danielmiessler/fabric/vendors"
)
func NewVendorsManager() *VendorsManager {

BIN
fabric.exe Normal file

Binary file not shown.

16
vendors/openrouter/openrouter.go vendored Normal file
View File

@ -0,0 +1,16 @@
package openrouter
import (
"github.com/danielmiessler/fabric/vendors/openai"
)
func NewClient() (ret *Client) {
ret = &Client{}
ret.Client = openai.NewClientCompatible("OpenRouter", "https://openrouter.ai/api/v1", nil)
return
}
type Client struct {
*openai.Client
}