From 7fd1591498c657c5826a6c1bcb438e7e0c431a61 Mon Sep 17 00:00:00 2001 From: Jeremy Lewi Date: Wed, 15 May 2024 06:20:33 -0700 Subject: [PATCH] Define AI GRPC service to support using AI to generate cells (#573) We'd like to use AI to generate cells. In particular, we'd like to support using [Foyle](foyle.io) to add AI capabilities. The initial plan is to use a gRPC service to allow RunMe to communicate with Foyle (or potentially other AI services). This proto needs to define that gRPC service. --- .../gen/proto/go/runme/ai/v1alpha1/ai.pb.go | 230 ++++++++++++++++++ .../proto/go/runme/ai/v1alpha1/ai_grpc.pb.go | 111 +++++++++ .../ts/runme/ai/v1alpha1/ai_pb.client.d.ts | 42 ++++ .../ts/runme/ai/v1alpha1/ai_pb.client.js | 29 +++ .../gen/proto/ts/runme/ai/v1alpha1/ai_pb.d.ts | 45 ++++ .../gen/proto/ts/runme/ai/v1alpha1/ai_pb.js | 44 ++++ pkg/api/proto/runme/ai/README.md | 5 + pkg/api/proto/runme/ai/v1alpha1/ai.proto | 20 ++ 8 files changed, 526 insertions(+) create mode 100644 pkg/api/gen/proto/go/runme/ai/v1alpha1/ai.pb.go create mode 100644 pkg/api/gen/proto/go/runme/ai/v1alpha1/ai_grpc.pb.go create mode 100644 pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.client.d.ts create mode 100644 pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.client.js create mode 100644 pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.d.ts create mode 100644 pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.js create mode 100644 pkg/api/proto/runme/ai/README.md create mode 100644 pkg/api/proto/runme/ai/v1alpha1/ai.proto diff --git a/pkg/api/gen/proto/go/runme/ai/v1alpha1/ai.pb.go b/pkg/api/gen/proto/go/runme/ai/v1alpha1/ai.pb.go new file mode 100644 index 000000000..bdef8416c --- /dev/null +++ b/pkg/api/gen/proto/go/runme/ai/v1alpha1/ai.pb.go @@ -0,0 +1,230 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc (unknown) +// source: runme/ai/v1alpha1/ai.proto + +package aiv1alpha1 + +import ( + v1 "github.com/stateful/runme/v3/pkg/api/gen/proto/go/runme/parser/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GenerateCellsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Notebook *v1.Notebook `protobuf:"bytes,1,opt,name=notebook,proto3" json:"notebook,omitempty"` +} + +func (x *GenerateCellsRequest) Reset() { + *x = GenerateCellsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_runme_ai_v1alpha1_ai_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateCellsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateCellsRequest) ProtoMessage() {} + +func (x *GenerateCellsRequest) ProtoReflect() protoreflect.Message { + mi := &file_runme_ai_v1alpha1_ai_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GenerateCellsRequest.ProtoReflect.Descriptor instead. +func (*GenerateCellsRequest) Descriptor() ([]byte, []int) { + return file_runme_ai_v1alpha1_ai_proto_rawDescGZIP(), []int{0} +} + +func (x *GenerateCellsRequest) GetNotebook() *v1.Notebook { + if x != nil { + return x.Notebook + } + return nil +} + +type GenerateCellsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Cells []*v1.Cell `protobuf:"bytes,1,rep,name=cells,proto3" json:"cells,omitempty"` +} + +func (x *GenerateCellsResponse) Reset() { + *x = GenerateCellsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_runme_ai_v1alpha1_ai_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateCellsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateCellsResponse) ProtoMessage() {} + +func (x *GenerateCellsResponse) ProtoReflect() protoreflect.Message { + mi := &file_runme_ai_v1alpha1_ai_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GenerateCellsResponse.ProtoReflect.Descriptor instead. +func (*GenerateCellsResponse) Descriptor() ([]byte, []int) { + return file_runme_ai_v1alpha1_ai_proto_rawDescGZIP(), []int{1} +} + +func (x *GenerateCellsResponse) GetCells() []*v1.Cell { + if x != nil { + return x.Cells + } + return nil +} + +var File_runme_ai_v1alpha1_ai_proto protoreflect.FileDescriptor + +var file_runme_ai_v1alpha1_ai_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2f, 0x61, 0x69, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x61, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x72, 0x75, + 0x6e, 0x6d, 0x65, 0x2e, 0x61, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, + 0x1c, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, + 0x2f, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4d, 0x0a, + 0x14, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x65, 0x6c, 0x6c, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x65, 0x62, 0x6f, 0x6f, + 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2e, + 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x6f, 0x74, 0x65, 0x62, 0x6f, + 0x6f, 0x6b, 0x52, 0x08, 0x6e, 0x6f, 0x74, 0x65, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x44, 0x0a, 0x15, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x65, 0x6c, 0x6c, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x63, 0x65, 0x6c, 0x6c, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2e, 0x70, 0x61, 0x72, + 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x65, 0x6c, 0x6c, 0x52, 0x05, 0x63, 0x65, 0x6c, + 0x6c, 0x73, 0x32, 0x71, 0x0a, 0x09, 0x41, 0x49, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x64, 0x0a, 0x0d, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x65, 0x6c, 0x6c, 0x73, + 0x12, 0x27, 0x2e, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2e, 0x61, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x65, 0x6c, + 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x72, 0x75, 0x6e, 0x6d, + 0x65, 0x2e, 0x61, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x65, 0x6c, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x66, 0x75, 0x6c, 0x2f, 0x72, 0x75, 0x6e, + 0x6d, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2f, 0x61, 0x69, + 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x61, 0x69, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_runme_ai_v1alpha1_ai_proto_rawDescOnce sync.Once + file_runme_ai_v1alpha1_ai_proto_rawDescData = file_runme_ai_v1alpha1_ai_proto_rawDesc +) + +func file_runme_ai_v1alpha1_ai_proto_rawDescGZIP() []byte { + file_runme_ai_v1alpha1_ai_proto_rawDescOnce.Do(func() { + file_runme_ai_v1alpha1_ai_proto_rawDescData = protoimpl.X.CompressGZIP(file_runme_ai_v1alpha1_ai_proto_rawDescData) + }) + return file_runme_ai_v1alpha1_ai_proto_rawDescData +} + +var file_runme_ai_v1alpha1_ai_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_runme_ai_v1alpha1_ai_proto_goTypes = []interface{}{ + (*GenerateCellsRequest)(nil), // 0: runme.ai.v1alpha1.GenerateCellsRequest + (*GenerateCellsResponse)(nil), // 1: runme.ai.v1alpha1.GenerateCellsResponse + (*v1.Notebook)(nil), // 2: runme.parser.v1.Notebook + (*v1.Cell)(nil), // 3: runme.parser.v1.Cell +} +var file_runme_ai_v1alpha1_ai_proto_depIdxs = []int32{ + 2, // 0: runme.ai.v1alpha1.GenerateCellsRequest.notebook:type_name -> runme.parser.v1.Notebook + 3, // 1: runme.ai.v1alpha1.GenerateCellsResponse.cells:type_name -> runme.parser.v1.Cell + 0, // 2: runme.ai.v1alpha1.AIService.GenerateCells:input_type -> runme.ai.v1alpha1.GenerateCellsRequest + 1, // 3: runme.ai.v1alpha1.AIService.GenerateCells:output_type -> runme.ai.v1alpha1.GenerateCellsResponse + 3, // [3:4] is the sub-list for method output_type + 2, // [2:3] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_runme_ai_v1alpha1_ai_proto_init() } +func file_runme_ai_v1alpha1_ai_proto_init() { + if File_runme_ai_v1alpha1_ai_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_runme_ai_v1alpha1_ai_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateCellsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_runme_ai_v1alpha1_ai_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateCellsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_runme_ai_v1alpha1_ai_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_runme_ai_v1alpha1_ai_proto_goTypes, + DependencyIndexes: file_runme_ai_v1alpha1_ai_proto_depIdxs, + MessageInfos: file_runme_ai_v1alpha1_ai_proto_msgTypes, + }.Build() + File_runme_ai_v1alpha1_ai_proto = out.File + file_runme_ai_v1alpha1_ai_proto_rawDesc = nil + file_runme_ai_v1alpha1_ai_proto_goTypes = nil + file_runme_ai_v1alpha1_ai_proto_depIdxs = nil +} diff --git a/pkg/api/gen/proto/go/runme/ai/v1alpha1/ai_grpc.pb.go b/pkg/api/gen/proto/go/runme/ai/v1alpha1/ai_grpc.pb.go new file mode 100644 index 000000000..45980268f --- /dev/null +++ b/pkg/api/gen/proto/go/runme/ai/v1alpha1/ai_grpc.pb.go @@ -0,0 +1,111 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: runme/ai/v1alpha1/ai.proto + +package aiv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + AIService_GenerateCells_FullMethodName = "/runme.ai.v1alpha1.AIService/GenerateCells" +) + +// AIServiceClient is the client API for AIService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AIServiceClient interface { + // GenerateCells uses the AI to generate cells to insert into the notebook. + GenerateCells(ctx context.Context, in *GenerateCellsRequest, opts ...grpc.CallOption) (*GenerateCellsResponse, error) +} + +type aIServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAIServiceClient(cc grpc.ClientConnInterface) AIServiceClient { + return &aIServiceClient{cc} +} + +func (c *aIServiceClient) GenerateCells(ctx context.Context, in *GenerateCellsRequest, opts ...grpc.CallOption) (*GenerateCellsResponse, error) { + out := new(GenerateCellsResponse) + err := c.cc.Invoke(ctx, AIService_GenerateCells_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AIServiceServer is the server API for AIService service. +// All implementations must embed UnimplementedAIServiceServer +// for forward compatibility +type AIServiceServer interface { + // GenerateCells uses the AI to generate cells to insert into the notebook. + GenerateCells(context.Context, *GenerateCellsRequest) (*GenerateCellsResponse, error) + mustEmbedUnimplementedAIServiceServer() +} + +// UnimplementedAIServiceServer must be embedded to have forward compatible implementations. +type UnimplementedAIServiceServer struct { +} + +func (UnimplementedAIServiceServer) GenerateCells(context.Context, *GenerateCellsRequest) (*GenerateCellsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GenerateCells not implemented") +} +func (UnimplementedAIServiceServer) mustEmbedUnimplementedAIServiceServer() {} + +// UnsafeAIServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AIServiceServer will +// result in compilation errors. +type UnsafeAIServiceServer interface { + mustEmbedUnimplementedAIServiceServer() +} + +func RegisterAIServiceServer(s grpc.ServiceRegistrar, srv AIServiceServer) { + s.RegisterService(&AIService_ServiceDesc, srv) +} + +func _AIService_GenerateCells_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateCellsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AIServiceServer).GenerateCells(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AIService_GenerateCells_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AIServiceServer).GenerateCells(ctx, req.(*GenerateCellsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AIService_ServiceDesc is the grpc.ServiceDesc for AIService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AIService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "runme.ai.v1alpha1.AIService", + HandlerType: (*AIServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GenerateCells", + Handler: _AIService_GenerateCells_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "runme/ai/v1alpha1/ai.proto", +} diff --git a/pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.client.d.ts b/pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.client.d.ts new file mode 100644 index 000000000..d6f415ee1 --- /dev/null +++ b/pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.client.d.ts @@ -0,0 +1,42 @@ +/* eslint-disable */ +// @generated by protobuf-ts 2.9.4 with parameter output_javascript,optimize_code_size,long_type_string,add_pb_suffix,ts_nocheck,eslint_disable +// @generated from protobuf file "runme/ai/v1alpha1/ai.proto" (package "runme.ai.v1alpha1", syntax proto3) +// tslint:disable +// @ts-nocheck +import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; +import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; +import type { GenerateCellsResponse } from "./ai_pb"; +import type { GenerateCellsRequest } from "./ai_pb"; +import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; +import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; +/** + * The AIService service is used to provide assistant capabilities to Runme. + * + * @generated from protobuf service runme.ai.v1alpha1.AIService + */ +export interface IAIServiceClient { + /** + * GenerateCells uses the AI to generate cells to insert into the notebook. + * + * @generated from protobuf rpc: GenerateCells(runme.ai.v1alpha1.GenerateCellsRequest) returns (runme.ai.v1alpha1.GenerateCellsResponse); + */ + generateCells(input: GenerateCellsRequest, options?: RpcOptions): UnaryCall; +} +/** + * The AIService service is used to provide assistant capabilities to Runme. + * + * @generated from protobuf service runme.ai.v1alpha1.AIService + */ +export declare class AIServiceClient implements IAIServiceClient, ServiceInfo { + private readonly _transport; + typeName: any; + methods: any; + options: any; + constructor(_transport: RpcTransport); + /** + * GenerateCells uses the AI to generate cells to insert into the notebook. + * + * @generated from protobuf rpc: GenerateCells(runme.ai.v1alpha1.GenerateCellsRequest) returns (runme.ai.v1alpha1.GenerateCellsResponse); + */ + generateCells(input: GenerateCellsRequest, options?: RpcOptions): UnaryCall; +} diff --git a/pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.client.js b/pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.client.js new file mode 100644 index 000000000..b543d6826 --- /dev/null +++ b/pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.client.js @@ -0,0 +1,29 @@ +/* eslint-disable */ +// @generated by protobuf-ts 2.9.4 with parameter output_javascript,optimize_code_size,long_type_string,add_pb_suffix,ts_nocheck,eslint_disable +// @generated from protobuf file "runme/ai/v1alpha1/ai.proto" (package "runme.ai.v1alpha1", syntax proto3) +// tslint:disable +// @ts-nocheck +import { AIService } from "./ai_pb"; +import { stackIntercept } from "@protobuf-ts/runtime-rpc"; +/** + * The AIService service is used to provide assistant capabilities to Runme. + * + * @generated from protobuf service runme.ai.v1alpha1.AIService + */ +export class AIServiceClient { + constructor(_transport) { + this._transport = _transport; + this.typeName = AIService.typeName; + this.methods = AIService.methods; + this.options = AIService.options; + } + /** + * GenerateCells uses the AI to generate cells to insert into the notebook. + * + * @generated from protobuf rpc: GenerateCells(runme.ai.v1alpha1.GenerateCellsRequest) returns (runme.ai.v1alpha1.GenerateCellsResponse); + */ + generateCells(input, options) { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} diff --git a/pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.d.ts b/pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.d.ts new file mode 100644 index 000000000..eeb8ca28d --- /dev/null +++ b/pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.d.ts @@ -0,0 +1,45 @@ +/* eslint-disable */ +// @generated by protobuf-ts 2.9.4 with parameter output_javascript,optimize_code_size,long_type_string,add_pb_suffix,ts_nocheck,eslint_disable +// @generated from protobuf file "runme/ai/v1alpha1/ai.proto" (package "runme.ai.v1alpha1", syntax proto3) +// tslint:disable +// @ts-nocheck +import { MessageType } from "@protobuf-ts/runtime"; +import { Cell } from "../../parser/v1/parser_pb"; +import { Notebook } from "../../parser/v1/parser_pb"; +/** + * @generated from protobuf message runme.ai.v1alpha1.GenerateCellsRequest + */ +export interface GenerateCellsRequest { + /** + * @generated from protobuf field: runme.parser.v1.Notebook notebook = 1; + */ + notebook?: Notebook; +} +/** + * @generated from protobuf message runme.ai.v1alpha1.GenerateCellsResponse + */ +export interface GenerateCellsResponse { + /** + * @generated from protobuf field: repeated runme.parser.v1.Cell cells = 1; + */ + cells: Cell[]; +} +declare class GenerateCellsRequest$Type extends MessageType { + constructor(); +} +/** + * @generated MessageType for protobuf message runme.ai.v1alpha1.GenerateCellsRequest + */ +export declare const GenerateCellsRequest: GenerateCellsRequest$Type; +declare class GenerateCellsResponse$Type extends MessageType { + constructor(); +} +/** + * @generated MessageType for protobuf message runme.ai.v1alpha1.GenerateCellsResponse + */ +export declare const GenerateCellsResponse: GenerateCellsResponse$Type; +/** + * @generated ServiceType for protobuf service runme.ai.v1alpha1.AIService + */ +export declare const AIService: any; +export {}; diff --git a/pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.js b/pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.js new file mode 100644 index 000000000..11721cf86 --- /dev/null +++ b/pkg/api/gen/proto/ts/runme/ai/v1alpha1/ai_pb.js @@ -0,0 +1,44 @@ +/* eslint-disable */ +// @generated by protobuf-ts 2.9.4 with parameter output_javascript,optimize_code_size,long_type_string,add_pb_suffix,ts_nocheck,eslint_disable +// @generated from protobuf file "runme/ai/v1alpha1/ai.proto" (package "runme.ai.v1alpha1", syntax proto3) +// tslint:disable +// @ts-nocheck +/* eslint-disable */ +// @generated by protobuf-ts 2.9.4 with parameter output_javascript,optimize_code_size,long_type_string,add_pb_suffix,ts_nocheck,eslint_disable +// @generated from protobuf file "runme/ai/v1alpha1/ai.proto" (package "runme.ai.v1alpha1", syntax proto3) +// tslint:disable +// @ts-nocheck +import { ServiceType } from "@protobuf-ts/runtime-rpc"; +import { MessageType } from "@protobuf-ts/runtime"; +import { Cell } from "../../parser/v1/parser_pb"; +import { Notebook } from "../../parser/v1/parser_pb"; +// @generated message type with reflection information, may provide speed optimized methods +class GenerateCellsRequest$Type extends MessageType { + constructor() { + super("runme.ai.v1alpha1.GenerateCellsRequest", [ + { no: 1, name: "notebook", kind: "message", T: () => Notebook } + ]); + } +} +/** + * @generated MessageType for protobuf message runme.ai.v1alpha1.GenerateCellsRequest + */ +export const GenerateCellsRequest = new GenerateCellsRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class GenerateCellsResponse$Type extends MessageType { + constructor() { + super("runme.ai.v1alpha1.GenerateCellsResponse", [ + { no: 1, name: "cells", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Cell } + ]); + } +} +/** + * @generated MessageType for protobuf message runme.ai.v1alpha1.GenerateCellsResponse + */ +export const GenerateCellsResponse = new GenerateCellsResponse$Type(); +/** + * @generated ServiceType for protobuf service runme.ai.v1alpha1.AIService + */ +export const AIService = new ServiceType("runme.ai.v1alpha1.AIService", [ + { name: "GenerateCells", options: {}, I: GenerateCellsRequest, O: GenerateCellsResponse } +]); diff --git a/pkg/api/proto/runme/ai/README.md b/pkg/api/proto/runme/ai/README.md new file mode 100644 index 000000000..49e72460f --- /dev/null +++ b/pkg/api/proto/runme/ai/README.md @@ -0,0 +1,5 @@ +# AI Services + +This directory contains the protos to define the services used to interact with +the AI modules. This service is used to call [Foyle AI](https://foyle.io) to +generate cells for the notebook. diff --git a/pkg/api/proto/runme/ai/v1alpha1/ai.proto b/pkg/api/proto/runme/ai/v1alpha1/ai.proto new file mode 100644 index 000000000..df47a882a --- /dev/null +++ b/pkg/api/proto/runme/ai/v1alpha1/ai.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package runme.ai.v1alpha1; + +import "runme/parser/v1/parser.proto"; +option go_package = "github.com/stateful/runme/pkg/api/gen/proto/go/runme/ai/v1alpha1;aiv1alpha1"; + +message GenerateCellsRequest { + runme.parser.v1.Notebook notebook = 1; +} + +message GenerateCellsResponse { + repeated runme.parser.v1.Cell cells = 1; +} + +// The AIService service is used to provide assistant capabilities to Runme. +service AIService { + // GenerateCells uses the AI to generate cells to insert into the notebook. + rpc GenerateCells (GenerateCellsRequest) returns (GenerateCellsResponse) {} +}