Skip to content

grpc-assistant is a demo code to explore how to handle grpc requests, and forward it to OpenAI API

License

Notifications You must be signed in to change notification settings

rodrigodelmonte/grpc-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grpc-assistant

grpc-assistant is a demo code to explore how to handle grpc requests, and forward it to OpenAI API

Running

export OPENAI_API_KEY="sk-00000"
export OPENAI_MODEL_NAME="gpt-3.5-turbo"
go run main.go

How to make questions

Install grpcurl

❯ grpcurl -d '{"request": "Who has more Football World Cups?"}' -plaintext -proto assistant.proto 0.0.0.0:8080 Assistant.Handle
{
  "result": "The country with the most Football World Cups is Brazil, with a total of 5 championships (1958, 1962, 1970, 1994, and 2002)."
}

Updating proto files

protoc \
--go_out=pkg/assistant \
--go_opt=paths=source_relative \
--go-grpc_out=pkg/assistant \
--go-grpc_opt=paths=source_relative \
assistant.proto

About

grpc-assistant is a demo code to explore how to handle grpc requests, and forward it to OpenAI API

Topics

Resources

License

Stars

Watchers

Forks