grpc

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 1 Imported by: 0

README

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

  1. Add the dependencies:

    go get google.golang.org/grpc google.golang.org/protobuf
    
  2. Define the service in proto/eyrie/v1/chat.proto:

    syntax = "proto3";
    package eyrie.v1;
    option go_package = "github.com/GrayCodeAI/eyrie/internal/grpc/eyriev1";
    
    service ChatService {
      // Unary chat: one request, one response.
      rpc Chat(ChatRequest) returns (ChatResponse);
    }
    
    message ChatRequest {
      string model = 1;
      string system_prompt = 2;
      string message = 3;
      int32  max_tokens = 4;
    }
    
    message ChatResponse {
      string content = 1;
      string node_id = 2;
      string finish_reason = 3;
    }
    
  3. Generate stubs with protoc (or buf):

    protoc --go_out=. --go-grpc_out=. proto/eyrie/v1/chat.proto
    
  4. Implement the generated ChatServiceServer by adapting the existing conversation.Engine (see internal/api/server.go handlePrompt for the HTTP equivalent), then register it on a grpc.Server inside server_grpc.go (drop the stub body, remove the documentation comment).

  5. 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.

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnimplemented = errUnimplemented{}

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").

Functions

This section is empty.

Types

type ChatRequest

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.

type ChatResponse

type ChatResponse struct {
	Content      string
	NodeID       string
	FinishReason string
}

ChatResponse is the unary Chat response payload.

type ChatService

type ChatService interface {
	Chat(ctx context.Context, req *ChatRequest) (*ChatResponse, error)
}

ChatService is the eyrie gRPC service contract: a single unary Chat RPC. A concrete implementation will adapt conversation.Engine; see README.md.

func NewChatService

func NewChatService() ChatService

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL