internal/grpc — gRPC server skeleton (design note)
This package is a skeleton. eyrie does not currently depend on
google.golang.org/grpc (verify with go.mod), and per repo policy we do
not add that dependency speculatively. So this package ships:
grpc.go — a dependency-free ChatService interface plus a no-op default
implementation. This always compiles and lets the rest of the codebase
reference the service contract today.
server_grpc.go — the real gRPC wiring, guarded by the grpc build tag so
it is excluded from normal builds until the dependency and generated code
exist. It is currently a documented stub (no grpc imports) describing exactly
what to generate and wire.
What to generate when gRPC is adopted
Add the dependencies:
go get google.golang.org/grpc google.golang.org/protobuf
Implement the generated ChatServiceServer by adapting the existing
conversation.Engine (see internal/api/server.gohandlePrompt for the
HTTP equivalent), then register it on a grpc.Server inside
server_grpc.go (drop the stub body, remove the documentation comment).
Build/run with the tag: go build -tags grpc ./....
Until then, importing this package yields the no-op ChatService in
grpc.go, which keeps everything compiling with zero new dependencies.
Package grpc holds a dependency-free skeleton for an eyrie gRPC API.
eyrie does not currently import google.golang.org/grpc, and per repo policy
that dependency is not added speculatively. This file therefore defines only
the service contract and a no-op default implementation so the rest of the
codebase can reference the gRPC surface today. The real server wiring lives
in server_grpc.go behind the "grpc" build tag. See README.md for the design
note and codegen steps.
ErrUnimplemented is returned by the default ChatService until a real
gRPC-backed implementation is provided.
When google.golang.org/grpc and the generated protobuf stubs are added
(see README.md), replace noopChatService with an engine-backed adapter
and register it via server_grpc.go (build tag "grpc").
type ChatRequest struct {
Model string SystemPrompt string Message string MaxTokens int}
ChatRequest is the unary Chat request payload. It mirrors the HTTP
/prompt request fields so a gRPC implementation can reuse the conversation
engine without translation.
NewChatService returns the default (no-op) ChatService. It exists so callers
have a stable constructor; once a real backend exists this will return the
engine-backed implementation instead.