syntax = "proto3";

package protocols.grpc.llm;


import "protocols/grpc/common/common.proto";

message Context {
  string role = 1;
  string content = 2;
}

// LLM Brick 相關訊息
message LLMRequest {
  string model_id = 1;          // 指定模型
  string prompt = 2;
  repeated Context context = 3;      // 上下文
  string client_id = 4;
  string session_id = 5;
  string request_id = 6;
  string source_language = 7;
  float temperature = 8;
  int32 max_tokens = 9;
}

message LLMResponse {
  string text = 1;
  repeated string tokens = 2;  // 串流時可用
  bool is_final = 3;           // 是否最後一筆
  protocols.grpc.common.ErrorDetail error = 4;
}

service LLMService {
  rpc GetServiceInfo(protocols.grpc.common.ServiceInfoRequest) returns (protocols.grpc.common.ServiceInfoResponse);
  
  rpc Unary(LLMRequest) returns (LLMResponse);

  // Server Streaming 實作
  rpc OutputStreaming(LLMRequest) returns (stream LLMResponse);
}
