This repository has been archived by the owner on Oct 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use GPTScript Gateway instead of OpenAI directly
Signed-off-by: Donnie Adams <donnie@acorn.io> Add dataset toolgpt (#79) change: use default blueprint for gateway version Don't use dataset id context (#81)
- Loading branch information
1 parent
94200bd
commit 79a90ab
Showing
3 changed files
with
18 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
acmd "github.com/acorn-io/cmd" | ||
"github.com/gptscript-ai/knowledge/pkg/cmd" | ||
) | ||
|
||
func main() { | ||
if err := os.Setenv("OPENAI_API_KEY", os.Getenv("GPTSCRIPT_GATEWAY_API_KEY")); err != nil { | ||
panic(fmt.Errorf("failed to set OPENAI_API_KEY: %w", err)) | ||
} | ||
|
||
gatewayURL := os.Getenv("GPTSCRIPT_GATEWAY_URL") | ||
if gatewayURL == "" { | ||
gatewayURL = "https://gateway-api.gptscript.ai" | ||
} | ||
if err := os.Setenv("OPENAI_BASE_URL", gatewayURL+"/llm"); err != nil { | ||
panic(fmt.Errorf("failed to set OPENAI_BASE_URL: %w", err)) | ||
} | ||
|
||
acmd.Main(cmd.New()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters