Skip to content

Commit

Permalink
Rename -protocol to -api
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyll committed Sep 9, 2024
1 parent 76798bf commit 4597ace
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ $ curl http://127.0.0.1:5555/v1/embeddings \
$ docker run \
-p 5555:5555 \
-e GEMINI_API_KEY=$GEMINI_API_KEY \
googlegemini/proxy-to-gemini -protocol=ollama
googlegemini/proxy-to-gemini -api=ollama
2024/07/20 19:35:21 Starting server on :5555
```
Once server starts, you can access Gemini models through the proxy server
Expand Down
8 changes: 4 additions & 4 deletions cmd/proxy-to-gemini/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ import (
var (
apikey string
hostport string
protocol string
api string
)

func main() {
ctx := context.Background()

flag.StringVar(&hostport, "listen", ":5555", "host and port to listen on")
flag.StringVar(&protocol, "protocol", "openai", "API proxocol; openai or ollama")
flag.StringVar(&api, "api", "openai", "API proxocol; openai or ollama")
flag.Parse()

apikey = os.Getenv("GEMINI_API_KEY")
Expand All @@ -54,7 +54,7 @@ func main() {

r := mux.NewRouter()
r.HandleFunc("/", indexHandler)
switch protocol {
switch api {
case "openai":
openai.RegisterHandlers(r, client)
case "ollama":
Expand All @@ -68,5 +68,5 @@ func main() {
}

func indexHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "You are running proxy-to-gemini at %q; protocol = %q", hostport, protocol)
fmt.Fprintf(w, "You are running proxy-to-gemini at %q; api = %q", hostport, api)
}

0 comments on commit 4597ace

Please sign in to comment.