Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Linville <[email protected]>
  • Loading branch information
g-linville committed Jan 16, 2025
1 parent cdd1514 commit 78621cc
Show file tree
Hide file tree
Showing 20 changed files with 45 additions and 93 deletions.
2 changes: 1 addition & 1 deletion anthropic-bedrock-model-provider/tool.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: Anthropic on AWS Bedrock
Description: Model provider for AWS Bedrock hosted Anthropic models
Metadata: envVars: OBOT_ANTHROPIC_BEDROCK_MODEL_PROVIDER_ACCESS_KEY_ID,OBOT_ANTHROPIC_BEDROCK_MODEL_PROVIDER_SECRET_ACCESS_KEY,OBOT_ANTHROPIC_BEDROCK_MODEL_PROVIDER_REGION,OBOT_ANTHROPIC_BEDROCK_MODEL_PROVIDER_SESSION_TOKEN
Model Provider: true
Credential: ../model-provider-credential as anthropic-bedrock-model-provider
Credential: ../placeholder-credential as anthropic-bedrock-model-provider


#!sys.daemon /usr/bin/env python3 ${GPTSCRIPT_TOOL_DIR}/main.py
Expand Down
2 changes: 1 addition & 1 deletion anthropic-model-provider/tool.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: Anthropic
Description: Model provider for Anthropic hosted Claude3 models
Metadata: envVars: OBOT_ANTHROPIC_MODEL_PROVIDER_API_KEY
Model Provider: true
Credential: ../model-provider-credential as anthropic-model-provider
Credential: ../placeholder-credential as anthropic-model-provider

#!sys.daemon /usr/bin/env python3 ${GPTSCRIPT_TOOL_DIR}/main.py

Expand Down
3 changes: 3 additions & 0 deletions auth-providers-common/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/obot-platform/tools/auth-providers-common

go 1.23.4
File renamed without changes.
2 changes: 1 addition & 1 deletion azure-openai-model-provider/tool.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description: Model provider for Azure OpenAI hosted models
Metadata: envVars: OBOT_AZURE_OPENAI_MODEL_PROVIDER_ENDPOINT,OBOT_AZURE_OPENAI_MODEL_PROVIDER_CLIENT_ID,OBOT_AZURE_OPENAI_MODEL_PROVIDER_CLIENT_SECRET,OBOT_AZURE_OPENAI_MODEL_PROVIDER_TENANT_ID,OBOT_AZURE_OPENAI_MODEL_PROVIDER_SUBSCRIPTION_ID,OBOT_AZURE_OPENAI_MODEL_PROVIDER_RESOURCE_GROUP
Metadata: optionalEnvVars: OBOT_AZURE_OPENAI_MODEL_PROVIDER_API_VERSION=2024-10-21
Model Provider: true
Credential: ../model-provider-credential as azure-openai-model-provider
Credential: ../placeholder-credential as azure-openai-model-provider

#!sys.daemon /usr/bin/env python3 ${GPTSCRIPT_TOOL_DIR}/main.py

Expand Down
10 changes: 8 additions & 2 deletions github-auth-provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ module github.com/obot-platform/tools/github-auth-provider

go 1.23.4

replace github.com/oauth2-proxy/oauth2-proxy/v7 => github.com/obot-platform/oauth2-proxy/v7 v7.0.0-20241008204315-265dabe17f43
replace (
github.com/oauth2-proxy/oauth2-proxy/v7 => github.com/obot-platform/oauth2-proxy/v7 v7.0.0-20241008204315-265dabe17f43
github.com/obot-platform/tools/auth-providers-common => ../auth-providers-common
)

require github.com/oauth2-proxy/oauth2-proxy/v7 v7.7.1
require (
github.com/oauth2-proxy/oauth2-proxy/v7 v7.7.1
github.com/obot-platform/tools/auth-providers-common v0.0.0-20241008222508-3c6174b443e7
)

require (
cloud.google.com/go/auth v0.9.4 // indirect
Expand Down
11 changes: 4 additions & 7 deletions github-auth-provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"encoding/json"
"errors"
"fmt"
"net/http"
"os"
Expand All @@ -11,7 +12,7 @@ import (
oauth2proxy "github.com/oauth2-proxy/oauth2-proxy/v7"
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/validation"
"github.com/obot-platform/tools/github-auth-provider/pkg/env"
"github.com/obot-platform/tools/auth-providers-common/pkg/env"
"github.com/obot-platform/tools/github-auth-provider/pkg/profile"
)

Expand Down Expand Up @@ -111,7 +112,7 @@ func main() {
mux.HandleFunc("/", oauthProxy.ServeHTTP)

fmt.Printf("listening on 127.0.0.1:%s\n", port)
if err := http.ListenAndServe("127.0.0.1:"+port, mux); err != nil {
if err := http.ListenAndServe("127.0.0.1:"+port, mux); !errors.Is(err, http.ErrServerClosed) {
fmt.Printf("failed to listen and serve: %v\n", err)
os.Exit(1)
}
Expand Down Expand Up @@ -145,9 +146,7 @@ func obotGetState(p *oauth2proxy.OAuthProxy) http.HandlerFunc {
return
}

for k, v := range sr.Header {
reqObj.Header[k] = v
}
reqObj.Header = sr.Header

state, err := p.LoadCookiedSession(reqObj)
if err != nil {
Expand Down Expand Up @@ -202,6 +201,4 @@ func obotGetIconURL(w http.ResponseWriter, r *http.Request) {
http.Error(w, fmt.Sprintf("failed to encode response: %v", err), http.StatusInternalServerError)
return
}

w.WriteHeader(http.StatusOK)
}
2 changes: 1 addition & 1 deletion github-auth-provider/tool.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: GitHub
Description: Auth provider for GitHub
Metadata: envVars: OBOT_GITHUB_AUTH_PROVIDER_CLIENT_ID,OBOT_GITHUB_AUTH_PROVIDER_CLIENT_SECRET,OBOT_AUTH_PROVIDER_COOKIE_SECRET,OBOT_AUTH_PROVIDER_EMAIL_DOMAINS
Metadata: optionalEnvVars: OBOT_GITHUB_AUTH_PROVIDER_TEAMS,OBOT_GITHUB_AUTH_PROVIDER_ORG,OBOT_GITHUB_AUTH_PROVIDER_REPO,OBOT_GITHUB_AUTH_PROVIDER_TOKEN,OBOT_GITHUB_AUTH_PROVIDER_ALLOW_USERS
Credential: ../model-provider-credential as github-auth-provider
Credential: ../placeholder-credential as github-auth-provider

#!sys.daemon ${GPTSCRIPT_TOOL_DIR}/bin/gptscript-go-tool

Expand Down
10 changes: 8 additions & 2 deletions google-auth-provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ module github.com/obot-platform/tools/google-auth-provider

go 1.23.4

replace github.com/oauth2-proxy/oauth2-proxy/v7 => github.com/obot-platform/oauth2-proxy/v7 v7.0.0-20241008204315-265dabe17f43
replace (
github.com/oauth2-proxy/oauth2-proxy/v7 => github.com/obot-platform/oauth2-proxy/v7 v7.0.0-20241008204315-265dabe17f43
github.com/obot-platform/tools/auth-providers-common => ../auth-providers-common
)

require github.com/oauth2-proxy/oauth2-proxy/v7 v7.7.1
require (
github.com/oauth2-proxy/oauth2-proxy/v7 v7.7.1
github.com/obot-platform/tools/auth-providers-common v0.0.0-20241008222508-3c6174b443e7
)

require (
cloud.google.com/go/auth v0.9.4 // indirect
Expand Down
11 changes: 4 additions & 7 deletions google-auth-provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"encoding/json"
"errors"
"fmt"
"net/http"
"os"
Expand All @@ -11,7 +12,7 @@ import (
oauth2proxy "github.com/oauth2-proxy/oauth2-proxy/v7"
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/validation"
"github.com/obot-platform/tools/google-auth-provider/pkg/env"
"github.com/obot-platform/tools/auth-providers-common/pkg/env"
"github.com/obot-platform/tools/google-auth-provider/pkg/profile"
)

Expand Down Expand Up @@ -89,7 +90,7 @@ func main() {
mux.HandleFunc("/", oauthProxy.ServeHTTP)

fmt.Printf("listening on 127.0.0.1:%s\n", port)
if err := http.ListenAndServe("127.0.0.1:"+port, mux); err != nil {
if err := http.ListenAndServe("127.0.0.1:"+port, mux); !errors.Is(err, http.ErrServerClosed) {
fmt.Printf("failed to listen and serve: %v\n", err)
os.Exit(1)
}
Expand Down Expand Up @@ -123,9 +124,7 @@ func obotGetState(p *oauth2proxy.OAuthProxy) http.HandlerFunc {
return
}

for k, v := range sr.Header {
reqObj.Header[k] = v
}
reqObj.Header = sr.Header

state, err := p.LoadCookiedSession(reqObj)
if err != nil {
Expand Down Expand Up @@ -180,6 +179,4 @@ func obotGetIconURL(w http.ResponseWriter, r *http.Request) {
http.Error(w, fmt.Sprintf("failed to encode response: %v", err), http.StatusInternalServerError)
return
}

w.WriteHeader(http.StatusOK)
}
57 changes: 0 additions & 57 deletions google-auth-provider/pkg/env/env.go

This file was deleted.

2 changes: 1 addition & 1 deletion google-auth-provider/tool.gpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: Google
Description: Auth provider for Google
Metadata: envVars: OBOT_GOOGLE_AUTH_PROVIDER_CLIENT_ID,OBOT_GOOGLE_AUTH_PROVIDER_CLIENT_SECRET,OBOT_AUTH_PROVIDER_COOKIE_SECRET,OBOT_AUTH_PROVIDER_EMAIL_DOMAINS
Credential: ../model-provider-credential as google-auth-provider
Credential: ../placeholder-credential as google-auth-provider

#!sys.daemon ${GPTSCRIPT_TOOL_DIR}/bin/gptscript-go-tool

Expand Down
2 changes: 1 addition & 1 deletion groq-model-provider/tool.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: Groq
Description: Model provider for models running on Groq
Metadata: envVars: OBOT_GROQ_MODEL_PROVIDER_API_KEY
Model Provider: true
Credential: ../model-provider-credential as groq-model-provider
Credential: ../placeholder-credential as groq-model-provider

#!sys.daemon /usr/bin/env python3 ${GPTSCRIPT_TOOL_DIR}/main.py

Expand Down
7 changes: 0 additions & 7 deletions model-provider-credential/tool.gpt

This file was deleted.

2 changes: 1 addition & 1 deletion ollama-model-provider/tool.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: Ollama
Description: Model provider for models running on Ollama
Metadata: envVars: OBOT_OLLAMA_MODEL_PROVIDER_HOST
Model Provider: true
Credential: ../model-provider-credential as ollama-model-provider
Credential: ../placeholder-credential as ollama-model-provider

#!sys.daemon /usr/bin/env python3 ${GPTSCRIPT_TOOL_DIR}/main.py

Expand Down
2 changes: 1 addition & 1 deletion openai-model-provider/tool.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: OpenAI
Description: Model Provider for OpenAI
Metadata: envVars: OBOT_OPENAI_MODEL_PROVIDER_API_KEY
Model Provider: true
Credential: ../model-provider-credential as openai-model-provider
Credential: ../placeholder-credential as openai-model-provider

#!sys.daemon ${GPTSCRIPT_TOOL_DIR}/bin/gptscript-go-tool

Expand Down
7 changes: 7 additions & 0 deletions placeholder-credential/tool.gpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Name: Placeholder credential
Description: This is a fake credential tool for the model and auth providers. These credentials are handled in Obot and this tool should never be called.

#!/bin/bash

echo "The credential has not been properly configured"
exit 1
2 changes: 1 addition & 1 deletion vllm-model-provider/tool.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: vLLM
Description: Model Provider for vLLM
Metadata: envVars: OBOT_VLLM_MODEL_PROVIDER_ENDPOINT,OBOT_VLLM_MODEL_PROVIDER_API_KEY
Model Provider: true
Credential: ../model-provider-credential as vllm-model-provider
Credential: ../placeholder-credential as vllm-model-provider

#!sys.daemon ${GPTSCRIPT_TOOL_DIR}/bin/gptscript-go-tool

Expand Down
2 changes: 1 addition & 1 deletion voyage-model-provider/tool.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: Voyage
Description: Model provider for Voyage Embeddings
Metadata: envVars: OBOT_VOYAGE_MODEL_PROVIDER_API_KEY
Model Provider: true
Credential: ../model-provider-credential as voyage-model-provider
Credential: ../placeholder-credential as voyage-model-provider

#!sys.daemon /usr/bin/env python3 ${GPTSCRIPT_TOOL_DIR}/main.py

Expand Down
2 changes: 1 addition & 1 deletion xai-model-provider/tool.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: xAI
Description: Model Provider for xAI
Metadata: envVars: OBOT_XAI_MODEL_PROVIDER_API_KEY
Model Provider: true
Credential: ../model-provider-credential as xai-model-provider
Credential: ../placeholder-credential as xai-model-provider

#!sys.daemon ${GPTSCRIPT_TOOL_DIR}/bin/gptscript-go-tool

Expand Down

0 comments on commit 78621cc

Please sign in to comment.