From 1166dd82970fac7ccdeb183183cc0dbd4db71664 Mon Sep 17 00:00:00 2001 From: lemonprogis Date: Fri, 13 Sep 2024 11:49:59 -0600 Subject: [PATCH] changing best_of to a string in completions --- src/leapfrogai_sdk/audio/audio_pb2.py | 44 +++--- src/leapfrogai_sdk/audio/audio_pb2.pyi | 61 +------- src/leapfrogai_sdk/audio/audio_pb2_grpc.py | 121 +++++++--------- src/leapfrogai_sdk/chat/chat_pb2.py | 56 ++++---- src/leapfrogai_sdk/chat/chat_pb2.pyi | 87 ++---------- src/leapfrogai_sdk/chat/chat_pb2_grpc.py | 126 +++++++---------- .../completion/completion_pb2.py | 54 ++++---- .../completion/completion_pb2.pyi | 86 ++---------- .../completion/completion_pb2_grpc.py | 130 +++++++----------- .../embeddings/embeddings_pb2.py | 34 ++--- .../embeddings/embeddings_pb2.pyi | 12 +- .../embeddings/embeddings_pb2_grpc.py | 67 ++++----- src/leapfrogai_sdk/name/name_pb2.py | 22 ++- src/leapfrogai_sdk/name/name_pb2_grpc.py | 63 ++++----- .../completion/completion.proto | 2 +- 15 files changed, 317 insertions(+), 648 deletions(-) diff --git a/src/leapfrogai_sdk/audio/audio_pb2.py b/src/leapfrogai_sdk/audio/audio_pb2.py index f698fec89..153ac2cbf 100644 --- a/src/leapfrogai_sdk/audio/audio_pb2.py +++ b/src/leapfrogai_sdk/audio/audio_pb2.py @@ -12,32 +12,28 @@ _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n leapfrogai_sdk/audio/audio.proto\x12\x05\x61udio"\xc4\x01\n\rAudioMetadata\x12\x0e\n\x06prompt\x18\x01 \x01(\t\x12\x13\n\x0btemperature\x18\x02 \x01(\x02\x12\x15\n\rinputlanguage\x18\x03 \x01(\t\x12\x30\n\x06\x66ormat\x18\x04 \x01(\x0e\x32 .audio.AudioMetadata.AudioFormat"E\n\x0b\x41udioFormat\x12\x08\n\x04JSON\x10\x00\x12\x08\n\x04TEXT\x10\x01\x12\x07\n\x03SRT\x10\x02\x12\x10\n\x0cVERBOSE_JSON\x10\x03\x12\x07\n\x03VTT\x10\x04"Y\n\x0c\x41udioRequest\x12(\n\x08metadata\x18\x01 \x01(\x0b\x32\x14.audio.AudioMetadataH\x00\x12\x14\n\nchunk_data\x18\x02 \x01(\x0cH\x00\x42\t\n\x07request"\xe1\x02\n\rAudioResponse\x12\x1e\n\x04task\x18\x01 \x01(\x0e\x32\x10.audio.AudioTask\x12\x10\n\x08language\x18\x02 \x01(\t\x12\x10\n\x08\x64uration\x18\x03 \x01(\x01\x12.\n\x08segments\x18\x04 \x03(\x0b\x32\x1c.audio.AudioResponse.Segment\x12\x0c\n\x04text\x18\x05 \x01(\t\x1a\xcd\x01\n\x07Segment\x12\n\n\x02id\x18\x01 \x01(\x05\x12\x0c\n\x04seek\x18\x02 \x01(\x05\x12\r\n\x05start\x18\x03 \x01(\x01\x12\x0b\n\x03\x65nd\x18\x04 \x01(\x01\x12\x0c\n\x04text\x18\x05 \x01(\t\x12\x0e\n\x06tokens\x18\x06 \x03(\x05\x12\x13\n\x0btemperature\x18\x07 \x01(\x01\x12\x13\n\x0b\x61vg_logprob\x18\x08 \x01(\x01\x12\x19\n\x11\x63ompression_ratio\x18\t \x01(\x01\x12\x16\n\x0eno_speech_prob\x18\n \x01(\x01\x12\x11\n\ttransient\x18\x0b \x01(\x08**\n\tAudioTask\x12\x0e\n\nTRANSCRIBE\x10\x00\x12\r\n\tTRANSLATE\x10\x01\x32|\n\x05\x41udio\x12\x38\n\tTranslate\x12\x13.audio.AudioRequest\x1a\x14.audio.AudioResponse(\x01\x12\x39\n\nTranscribe\x12\x13.audio.AudioRequest\x1a\x14.audio.AudioResponse(\x01\x42\x38Z6github.com/defenseunicorns/leapfrogai/pkg/client/audiob\x06proto3' -) + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n leapfrogai_sdk/audio/audio.proto\x12\x05\x61udio\"\xc4\x01\n\rAudioMetadata\x12\x0e\n\x06prompt\x18\x01 \x01(\t\x12\x13\n\x0btemperature\x18\x02 \x01(\x02\x12\x15\n\rinputlanguage\x18\x03 \x01(\t\x12\x30\n\x06\x66ormat\x18\x04 \x01(\x0e\x32 .audio.AudioMetadata.AudioFormat\"E\n\x0b\x41udioFormat\x12\x08\n\x04JSON\x10\x00\x12\x08\n\x04TEXT\x10\x01\x12\x07\n\x03SRT\x10\x02\x12\x10\n\x0cVERBOSE_JSON\x10\x03\x12\x07\n\x03VTT\x10\x04\"Y\n\x0c\x41udioRequest\x12(\n\x08metadata\x18\x01 \x01(\x0b\x32\x14.audio.AudioMetadataH\x00\x12\x14\n\nchunk_data\x18\x02 \x01(\x0cH\x00\x42\t\n\x07request\"\xe1\x02\n\rAudioResponse\x12\x1e\n\x04task\x18\x01 \x01(\x0e\x32\x10.audio.AudioTask\x12\x10\n\x08language\x18\x02 \x01(\t\x12\x10\n\x08\x64uration\x18\x03 \x01(\x01\x12.\n\x08segments\x18\x04 \x03(\x0b\x32\x1c.audio.AudioResponse.Segment\x12\x0c\n\x04text\x18\x05 \x01(\t\x1a\xcd\x01\n\x07Segment\x12\n\n\x02id\x18\x01 \x01(\x05\x12\x0c\n\x04seek\x18\x02 \x01(\x05\x12\r\n\x05start\x18\x03 \x01(\x01\x12\x0b\n\x03\x65nd\x18\x04 \x01(\x01\x12\x0c\n\x04text\x18\x05 \x01(\t\x12\x0e\n\x06tokens\x18\x06 \x03(\x05\x12\x13\n\x0btemperature\x18\x07 \x01(\x01\x12\x13\n\x0b\x61vg_logprob\x18\x08 \x01(\x01\x12\x19\n\x11\x63ompression_ratio\x18\t \x01(\x01\x12\x16\n\x0eno_speech_prob\x18\n \x01(\x01\x12\x11\n\ttransient\x18\x0b \x01(\x08**\n\tAudioTask\x12\x0e\n\nTRANSCRIBE\x10\x00\x12\r\n\tTRANSLATE\x10\x01\x32|\n\x05\x41udio\x12\x38\n\tTranslate\x12\x13.audio.AudioRequest\x1a\x14.audio.AudioResponse(\x01\x12\x39\n\nTranscribe\x12\x13.audio.AudioRequest\x1a\x14.audio.AudioResponse(\x01\x42\x38Z6github.com/defenseunicorns/leapfrogai/pkg/client/audiob\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages( - DESCRIPTOR, "leapfrogai_sdk.audio.audio_pb2", _globals -) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'leapfrogai_sdk.audio.audio_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: - _globals["DESCRIPTOR"]._options = None - _globals[ - "DESCRIPTOR" - ]._serialized_options = b"Z6github.com/defenseunicorns/leapfrogai/pkg/client/audio" - _globals["_AUDIOTASK"]._serialized_start = 689 - _globals["_AUDIOTASK"]._serialized_end = 731 - _globals["_AUDIOMETADATA"]._serialized_start = 44 - _globals["_AUDIOMETADATA"]._serialized_end = 240 - _globals["_AUDIOMETADATA_AUDIOFORMAT"]._serialized_start = 171 - _globals["_AUDIOMETADATA_AUDIOFORMAT"]._serialized_end = 240 - _globals["_AUDIOREQUEST"]._serialized_start = 242 - _globals["_AUDIOREQUEST"]._serialized_end = 331 - _globals["_AUDIORESPONSE"]._serialized_start = 334 - _globals["_AUDIORESPONSE"]._serialized_end = 687 - _globals["_AUDIORESPONSE_SEGMENT"]._serialized_start = 482 - _globals["_AUDIORESPONSE_SEGMENT"]._serialized_end = 687 - _globals["_AUDIO"]._serialized_start = 733 - _globals["_AUDIO"]._serialized_end = 857 + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'Z6github.com/defenseunicorns/leapfrogai/pkg/client/audio' + _globals['_AUDIOTASK']._serialized_start=689 + _globals['_AUDIOTASK']._serialized_end=731 + _globals['_AUDIOMETADATA']._serialized_start=44 + _globals['_AUDIOMETADATA']._serialized_end=240 + _globals['_AUDIOMETADATA_AUDIOFORMAT']._serialized_start=171 + _globals['_AUDIOMETADATA_AUDIOFORMAT']._serialized_end=240 + _globals['_AUDIOREQUEST']._serialized_start=242 + _globals['_AUDIOREQUEST']._serialized_end=331 + _globals['_AUDIORESPONSE']._serialized_start=334 + _globals['_AUDIORESPONSE']._serialized_end=687 + _globals['_AUDIORESPONSE_SEGMENT']._serialized_start=482 + _globals['_AUDIORESPONSE_SEGMENT']._serialized_end=687 + _globals['_AUDIO']._serialized_start=733 + _globals['_AUDIO']._serialized_end=857 # @@protoc_insertion_point(module_scope) diff --git a/src/leapfrogai_sdk/audio/audio_pb2.pyi b/src/leapfrogai_sdk/audio/audio_pb2.pyi index 58926ed2f..e2e6d2796 100644 --- a/src/leapfrogai_sdk/audio/audio_pb2.pyi +++ b/src/leapfrogai_sdk/audio/audio_pb2.pyi @@ -2,13 +2,7 @@ from google.protobuf.internal import containers as _containers from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message -from typing import ( - ClassVar as _ClassVar, - Iterable as _Iterable, - Mapping as _Mapping, - Optional as _Optional, - Union as _Union, -) +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union DESCRIPTOR: _descriptor.FileDescriptor @@ -16,7 +10,6 @@ class AudioTask(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): __slots__ = () TRANSCRIBE: _ClassVar[AudioTask] TRANSLATE: _ClassVar[AudioTask] - TRANSCRIBE: AudioTask TRANSLATE: AudioTask @@ -42,13 +35,7 @@ class AudioMetadata(_message.Message): temperature: float inputlanguage: str format: AudioMetadata.AudioFormat - def __init__( - self, - prompt: _Optional[str] = ..., - temperature: _Optional[float] = ..., - inputlanguage: _Optional[str] = ..., - format: _Optional[_Union[AudioMetadata.AudioFormat, str]] = ..., - ) -> None: ... + def __init__(self, prompt: _Optional[str] = ..., temperature: _Optional[float] = ..., inputlanguage: _Optional[str] = ..., format: _Optional[_Union[AudioMetadata.AudioFormat, str]] = ...) -> None: ... class AudioRequest(_message.Message): __slots__ = ("metadata", "chunk_data") @@ -56,28 +43,12 @@ class AudioRequest(_message.Message): CHUNK_DATA_FIELD_NUMBER: _ClassVar[int] metadata: AudioMetadata chunk_data: bytes - def __init__( - self, - metadata: _Optional[_Union[AudioMetadata, _Mapping]] = ..., - chunk_data: _Optional[bytes] = ..., - ) -> None: ... + def __init__(self, metadata: _Optional[_Union[AudioMetadata, _Mapping]] = ..., chunk_data: _Optional[bytes] = ...) -> None: ... class AudioResponse(_message.Message): __slots__ = ("task", "language", "duration", "segments", "text") class Segment(_message.Message): - __slots__ = ( - "id", - "seek", - "start", - "end", - "text", - "tokens", - "temperature", - "avg_logprob", - "compression_ratio", - "no_speech_prob", - "transient", - ) + __slots__ = ("id", "seek", "start", "end", "text", "tokens", "temperature", "avg_logprob", "compression_ratio", "no_speech_prob", "transient") ID_FIELD_NUMBER: _ClassVar[int] SEEK_FIELD_NUMBER: _ClassVar[int] START_FIELD_NUMBER: _ClassVar[int] @@ -100,20 +71,7 @@ class AudioResponse(_message.Message): compression_ratio: float no_speech_prob: float transient: bool - def __init__( - self, - id: _Optional[int] = ..., - seek: _Optional[int] = ..., - start: _Optional[float] = ..., - end: _Optional[float] = ..., - text: _Optional[str] = ..., - tokens: _Optional[_Iterable[int]] = ..., - temperature: _Optional[float] = ..., - avg_logprob: _Optional[float] = ..., - compression_ratio: _Optional[float] = ..., - no_speech_prob: _Optional[float] = ..., - transient: bool = ..., - ) -> None: ... + def __init__(self, id: _Optional[int] = ..., seek: _Optional[int] = ..., start: _Optional[float] = ..., end: _Optional[float] = ..., text: _Optional[str] = ..., tokens: _Optional[_Iterable[int]] = ..., temperature: _Optional[float] = ..., avg_logprob: _Optional[float] = ..., compression_ratio: _Optional[float] = ..., no_speech_prob: _Optional[float] = ..., transient: bool = ...) -> None: ... TASK_FIELD_NUMBER: _ClassVar[int] LANGUAGE_FIELD_NUMBER: _ClassVar[int] DURATION_FIELD_NUMBER: _ClassVar[int] @@ -124,11 +82,4 @@ class AudioResponse(_message.Message): duration: float segments: _containers.RepeatedCompositeFieldContainer[AudioResponse.Segment] text: str - def __init__( - self, - task: _Optional[_Union[AudioTask, str]] = ..., - language: _Optional[str] = ..., - duration: _Optional[float] = ..., - segments: _Optional[_Iterable[_Union[AudioResponse.Segment, _Mapping]]] = ..., - text: _Optional[str] = ..., - ) -> None: ... + def __init__(self, task: _Optional[_Union[AudioTask, str]] = ..., language: _Optional[str] = ..., duration: _Optional[float] = ..., segments: _Optional[_Iterable[_Union[AudioResponse.Segment, _Mapping]]] = ..., text: _Optional[str] = ...) -> None: ... diff --git a/src/leapfrogai_sdk/audio/audio_pb2_grpc.py b/src/leapfrogai_sdk/audio/audio_pb2_grpc.py index c9fd33cf8..b26a6b8d6 100644 --- a/src/leapfrogai_sdk/audio/audio_pb2_grpc.py +++ b/src/leapfrogai_sdk/audio/audio_pb2_grpc.py @@ -15,15 +15,15 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.Translate = channel.stream_unary( - "/audio.Audio/Translate", - request_serializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioRequest.SerializeToString, - response_deserializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioResponse.FromString, - ) + '/audio.Audio/Translate', + request_serializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioRequest.SerializeToString, + response_deserializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioResponse.FromString, + ) self.Transcribe = channel.stream_unary( - "/audio.Audio/Transcribe", - request_serializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioRequest.SerializeToString, - response_deserializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioResponse.FromString, - ) + '/audio.Audio/Transcribe', + request_serializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioRequest.SerializeToString, + response_deserializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioResponse.FromString, + ) class AudioServicer(object): @@ -32,93 +32,68 @@ class AudioServicer(object): def Translate(self, request_iterator, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def Transcribe(self, request_iterator, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def add_AudioServicer_to_server(servicer, server): rpc_method_handlers = { - "Translate": grpc.stream_unary_rpc_method_handler( - servicer.Translate, - request_deserializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioRequest.FromString, - response_serializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioResponse.SerializeToString, - ), - "Transcribe": grpc.stream_unary_rpc_method_handler( - servicer.Transcribe, - request_deserializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioRequest.FromString, - response_serializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioResponse.SerializeToString, - ), + 'Translate': grpc.stream_unary_rpc_method_handler( + servicer.Translate, + request_deserializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioRequest.FromString, + response_serializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioResponse.SerializeToString, + ), + 'Transcribe': grpc.stream_unary_rpc_method_handler( + servicer.Transcribe, + request_deserializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioRequest.FromString, + response_serializer=leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( - "audio.Audio", rpc_method_handlers - ) + 'audio.Audio', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) -# This class is part of an EXPERIMENTAL API. + # This class is part of an EXPERIMENTAL API. class Audio(object): """Missing associated documentation comment in .proto file.""" @staticmethod - def Translate( - request_iterator, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.stream_unary( - request_iterator, + def Translate(request_iterator, target, - "/audio.Audio/Translate", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.stream_unary(request_iterator, target, '/audio.Audio/Translate', leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioRequest.SerializeToString, leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod - def Transcribe( - request_iterator, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.stream_unary( - request_iterator, + def Transcribe(request_iterator, target, - "/audio.Audio/Transcribe", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.stream_unary(request_iterator, target, '/audio.Audio/Transcribe', leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioRequest.SerializeToString, leapfrogai__sdk_dot_audio_dot_audio__pb2.AudioResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/src/leapfrogai_sdk/chat/chat_pb2.py b/src/leapfrogai_sdk/chat/chat_pb2.py index 784472e23..614b05616 100644 --- a/src/leapfrogai_sdk/chat/chat_pb2.py +++ b/src/leapfrogai_sdk/chat/chat_pb2.py @@ -12,38 +12,34 @@ _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1eleapfrogai_sdk/chat/chat.proto\x12\x04\x63hat"9\n\x08\x43hatItem\x12\x1c\n\x04role\x18\x01 \x01(\x0e\x32\x0e.chat.ChatRole\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\t"\x95\x06\n\x15\x43hatCompletionRequest\x12"\n\nchat_items\x18\x01 \x03(\x0b\x32\x0e.chat.ChatItem\x12\x16\n\x0emax_new_tokens\x18\x02 \x01(\x05\x12\x18\n\x0btemperature\x18\x03 \x01(\x02H\x00\x88\x01\x01\x12\x12\n\x05top_k\x18\x04 \x01(\x02H\x01\x88\x01\x01\x12\x12\n\x05top_p\x18\x05 \x01(\x02H\x02\x88\x01\x01\x12\x16\n\tdo_sample\x18\x06 \x01(\x08H\x03\x88\x01\x01\x12\x0e\n\x01n\x18\x07 \x01(\x05H\x04\x88\x01\x01\x12\x0c\n\x04stop\x18\x08 \x03(\t\x12\x1f\n\x12repetition_penalty\x18\t \x01(\x02H\x05\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\n \x01(\x02H\x06\x88\x01\x01\x12\x1e\n\x11\x66requency_penalty\x18\x0b \x01(\x02H\x07\x88\x01\x01\x12\x14\n\x07\x62\x65st_of\x18\x0c \x01(\tH\x08\x88\x01\x01\x12>\n\nlogit_bias\x18\r \x03(\x0b\x32*.chat.ChatCompletionRequest.LogitBiasEntry\x12\x1d\n\x10return_full_text\x18\x0e \x01(\x08H\t\x88\x01\x01\x12\x15\n\x08truncate\x18\x0f \x01(\x05H\n\x88\x01\x01\x12\x16\n\ttypical_p\x18\x10 \x01(\x02H\x0b\x88\x01\x01\x12\x16\n\twatermark\x18\x11 \x01(\x08H\x0c\x88\x01\x01\x12\x11\n\x04seed\x18\x12 \x01(\x05H\r\x88\x01\x01\x12\x11\n\x04user\x18\x13 \x01(\tH\x0e\x88\x01\x01\x1a\x30\n\x0eLogitBiasEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x42\x0e\n\x0c_temperatureB\x08\n\x06_top_kB\x08\n\x06_top_pB\x0c\n\n_do_sampleB\x04\n\x02_nB\x15\n\x13_repetition_penaltyB\x13\n\x11_presence_penaltyB\x14\n\x12_frequency_penaltyB\n\n\x08_best_ofB\x13\n\x11_return_full_textB\x0b\n\t_truncateB\x0c\n\n_typical_pB\x0c\n\n_watermarkB\x07\n\x05_seedB\x07\n\x05_user"_\n\x14\x43hatCompletionChoice\x12\r\n\x05index\x18\x01 \x01(\x05\x12!\n\tchat_item\x18\x02 \x01(\x0b\x32\x0e.chat.ChatItem\x12\x15\n\rfinish_reason\x18\x03 \x01(\t"O\n\x05Usage\x12\x15\n\rprompt_tokens\x18\x01 \x01(\x05\x12\x19\n\x11\x63ompletion_tokens\x18\x02 \x01(\x05\x12\x14\n\x0ctotal_tokens\x18\x03 \x01(\x05"\x8e\x01\n\x16\x43hatCompletionResponse\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0e\n\x06object\x18\x02 \x01(\t\x12\x0f\n\x07\x63reated\x18\x03 \x01(\x03\x12+\n\x07\x63hoices\x18\x04 \x03(\x0b\x32\x1a.chat.ChatCompletionChoice\x12\x1a\n\x05usage\x18\x05 \x01(\x0b\x32\x0b.chat.Usage*=\n\x08\x43hatRole\x12\x08\n\x04USER\x10\x00\x12\n\n\x06SYSTEM\x10\x01\x12\x0c\n\x08\x46UNCTION\x10\x02\x12\r\n\tASSISTANT\x10\x03\x32\x62\n\x15\x43hatCompletionService\x12I\n\x0c\x43hatComplete\x12\x1b.chat.ChatCompletionRequest\x1a\x1c.chat.ChatCompletionResponse2p\n\x1b\x43hatCompletionStreamService\x12Q\n\x12\x43hatCompleteStream\x12\x1b.chat.ChatCompletionRequest\x1a\x1c.chat.ChatCompletionResponse0\x01\x42\x37Z5github.com/defenseunicorns/leapfrogai/pkg/client/chatb\x06proto3' -) + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1eleapfrogai_sdk/chat/chat.proto\x12\x04\x63hat\"9\n\x08\x43hatItem\x12\x1c\n\x04role\x18\x01 \x01(\x0e\x32\x0e.chat.ChatRole\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\t\"\x95\x06\n\x15\x43hatCompletionRequest\x12\"\n\nchat_items\x18\x01 \x03(\x0b\x32\x0e.chat.ChatItem\x12\x16\n\x0emax_new_tokens\x18\x02 \x01(\x05\x12\x18\n\x0btemperature\x18\x03 \x01(\x02H\x00\x88\x01\x01\x12\x12\n\x05top_k\x18\x04 \x01(\x02H\x01\x88\x01\x01\x12\x12\n\x05top_p\x18\x05 \x01(\x02H\x02\x88\x01\x01\x12\x16\n\tdo_sample\x18\x06 \x01(\x08H\x03\x88\x01\x01\x12\x0e\n\x01n\x18\x07 \x01(\x05H\x04\x88\x01\x01\x12\x0c\n\x04stop\x18\x08 \x03(\t\x12\x1f\n\x12repetition_penalty\x18\t \x01(\x02H\x05\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\n \x01(\x02H\x06\x88\x01\x01\x12\x1e\n\x11\x66requency_penalty\x18\x0b \x01(\x02H\x07\x88\x01\x01\x12\x14\n\x07\x62\x65st_of\x18\x0c \x01(\tH\x08\x88\x01\x01\x12>\n\nlogit_bias\x18\r \x03(\x0b\x32*.chat.ChatCompletionRequest.LogitBiasEntry\x12\x1d\n\x10return_full_text\x18\x0e \x01(\x08H\t\x88\x01\x01\x12\x15\n\x08truncate\x18\x0f \x01(\x05H\n\x88\x01\x01\x12\x16\n\ttypical_p\x18\x10 \x01(\x02H\x0b\x88\x01\x01\x12\x16\n\twatermark\x18\x11 \x01(\x08H\x0c\x88\x01\x01\x12\x11\n\x04seed\x18\x12 \x01(\x05H\r\x88\x01\x01\x12\x11\n\x04user\x18\x13 \x01(\tH\x0e\x88\x01\x01\x1a\x30\n\x0eLogitBiasEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x42\x0e\n\x0c_temperatureB\x08\n\x06_top_kB\x08\n\x06_top_pB\x0c\n\n_do_sampleB\x04\n\x02_nB\x15\n\x13_repetition_penaltyB\x13\n\x11_presence_penaltyB\x14\n\x12_frequency_penaltyB\n\n\x08_best_ofB\x13\n\x11_return_full_textB\x0b\n\t_truncateB\x0c\n\n_typical_pB\x0c\n\n_watermarkB\x07\n\x05_seedB\x07\n\x05_user\"_\n\x14\x43hatCompletionChoice\x12\r\n\x05index\x18\x01 \x01(\x05\x12!\n\tchat_item\x18\x02 \x01(\x0b\x32\x0e.chat.ChatItem\x12\x15\n\rfinish_reason\x18\x03 \x01(\t\"O\n\x05Usage\x12\x15\n\rprompt_tokens\x18\x01 \x01(\x05\x12\x19\n\x11\x63ompletion_tokens\x18\x02 \x01(\x05\x12\x14\n\x0ctotal_tokens\x18\x03 \x01(\x05\"\x8e\x01\n\x16\x43hatCompletionResponse\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0e\n\x06object\x18\x02 \x01(\t\x12\x0f\n\x07\x63reated\x18\x03 \x01(\x03\x12+\n\x07\x63hoices\x18\x04 \x03(\x0b\x32\x1a.chat.ChatCompletionChoice\x12\x1a\n\x05usage\x18\x05 \x01(\x0b\x32\x0b.chat.Usage*=\n\x08\x43hatRole\x12\x08\n\x04USER\x10\x00\x12\n\n\x06SYSTEM\x10\x01\x12\x0c\n\x08\x46UNCTION\x10\x02\x12\r\n\tASSISTANT\x10\x03\x32\x62\n\x15\x43hatCompletionService\x12I\n\x0c\x43hatComplete\x12\x1b.chat.ChatCompletionRequest\x1a\x1c.chat.ChatCompletionResponse2p\n\x1b\x43hatCompletionStreamService\x12Q\n\x12\x43hatCompleteStream\x12\x1b.chat.ChatCompletionRequest\x1a\x1c.chat.ChatCompletionResponse0\x01\x42\x37Z5github.com/defenseunicorns/leapfrogai/pkg/client/chatb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages( - DESCRIPTOR, "leapfrogai_sdk.chat.chat_pb2", _globals -) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'leapfrogai_sdk.chat.chat_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: - _globals["DESCRIPTOR"]._options = None - _globals[ - "DESCRIPTOR" - ]._serialized_options = b"Z5github.com/defenseunicorns/leapfrogai/pkg/client/chat" - _globals["_CHATCOMPLETIONREQUEST_LOGITBIASENTRY"]._options = None - _globals["_CHATCOMPLETIONREQUEST_LOGITBIASENTRY"]._serialized_options = b"8\001" - _globals["_CHATROLE"]._serialized_start = 1214 - _globals["_CHATROLE"]._serialized_end = 1275 - _globals["_CHATITEM"]._serialized_start = 40 - _globals["_CHATITEM"]._serialized_end = 97 - _globals["_CHATCOMPLETIONREQUEST"]._serialized_start = 100 - _globals["_CHATCOMPLETIONREQUEST"]._serialized_end = 889 - _globals["_CHATCOMPLETIONREQUEST_LOGITBIASENTRY"]._serialized_start = 627 - _globals["_CHATCOMPLETIONREQUEST_LOGITBIASENTRY"]._serialized_end = 675 - _globals["_CHATCOMPLETIONCHOICE"]._serialized_start = 891 - _globals["_CHATCOMPLETIONCHOICE"]._serialized_end = 986 - _globals["_USAGE"]._serialized_start = 988 - _globals["_USAGE"]._serialized_end = 1067 - _globals["_CHATCOMPLETIONRESPONSE"]._serialized_start = 1070 - _globals["_CHATCOMPLETIONRESPONSE"]._serialized_end = 1212 - _globals["_CHATCOMPLETIONSERVICE"]._serialized_start = 1277 - _globals["_CHATCOMPLETIONSERVICE"]._serialized_end = 1375 - _globals["_CHATCOMPLETIONSTREAMSERVICE"]._serialized_start = 1377 - _globals["_CHATCOMPLETIONSTREAMSERVICE"]._serialized_end = 1489 + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'Z5github.com/defenseunicorns/leapfrogai/pkg/client/chat' + _globals['_CHATCOMPLETIONREQUEST_LOGITBIASENTRY']._options = None + _globals['_CHATCOMPLETIONREQUEST_LOGITBIASENTRY']._serialized_options = b'8\001' + _globals['_CHATROLE']._serialized_start=1214 + _globals['_CHATROLE']._serialized_end=1275 + _globals['_CHATITEM']._serialized_start=40 + _globals['_CHATITEM']._serialized_end=97 + _globals['_CHATCOMPLETIONREQUEST']._serialized_start=100 + _globals['_CHATCOMPLETIONREQUEST']._serialized_end=889 + _globals['_CHATCOMPLETIONREQUEST_LOGITBIASENTRY']._serialized_start=627 + _globals['_CHATCOMPLETIONREQUEST_LOGITBIASENTRY']._serialized_end=675 + _globals['_CHATCOMPLETIONCHOICE']._serialized_start=891 + _globals['_CHATCOMPLETIONCHOICE']._serialized_end=986 + _globals['_USAGE']._serialized_start=988 + _globals['_USAGE']._serialized_end=1067 + _globals['_CHATCOMPLETIONRESPONSE']._serialized_start=1070 + _globals['_CHATCOMPLETIONRESPONSE']._serialized_end=1212 + _globals['_CHATCOMPLETIONSERVICE']._serialized_start=1277 + _globals['_CHATCOMPLETIONSERVICE']._serialized_end=1375 + _globals['_CHATCOMPLETIONSTREAMSERVICE']._serialized_start=1377 + _globals['_CHATCOMPLETIONSTREAMSERVICE']._serialized_end=1489 # @@protoc_insertion_point(module_scope) diff --git a/src/leapfrogai_sdk/chat/chat_pb2.pyi b/src/leapfrogai_sdk/chat/chat_pb2.pyi index c34045bd6..01efaa548 100644 --- a/src/leapfrogai_sdk/chat/chat_pb2.pyi +++ b/src/leapfrogai_sdk/chat/chat_pb2.pyi @@ -2,13 +2,7 @@ from google.protobuf.internal import containers as _containers from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message -from typing import ( - ClassVar as _ClassVar, - Iterable as _Iterable, - Mapping as _Mapping, - Optional as _Optional, - Union as _Union, -) +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union DESCRIPTOR: _descriptor.FileDescriptor @@ -18,7 +12,6 @@ class ChatRole(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): SYSTEM: _ClassVar[ChatRole] FUNCTION: _ClassVar[ChatRole] ASSISTANT: _ClassVar[ChatRole] - USER: ChatRole SYSTEM: ChatRole FUNCTION: ChatRole @@ -30,43 +23,17 @@ class ChatItem(_message.Message): CONTENT_FIELD_NUMBER: _ClassVar[int] role: ChatRole content: str - def __init__( - self, - role: _Optional[_Union[ChatRole, str]] = ..., - content: _Optional[str] = ..., - ) -> None: ... + def __init__(self, role: _Optional[_Union[ChatRole, str]] = ..., content: _Optional[str] = ...) -> None: ... class ChatCompletionRequest(_message.Message): - __slots__ = ( - "chat_items", - "max_new_tokens", - "temperature", - "top_k", - "top_p", - "do_sample", - "n", - "stop", - "repetition_penalty", - "presence_penalty", - "frequency_penalty", - "best_of", - "logit_bias", - "return_full_text", - "truncate", - "typical_p", - "watermark", - "seed", - "user", - ) + __slots__ = ("chat_items", "max_new_tokens", "temperature", "top_k", "top_p", "do_sample", "n", "stop", "repetition_penalty", "presence_penalty", "frequency_penalty", "best_of", "logit_bias", "return_full_text", "truncate", "typical_p", "watermark", "seed", "user") class LogitBiasEntry(_message.Message): __slots__ = ("key", "value") KEY_FIELD_NUMBER: _ClassVar[int] VALUE_FIELD_NUMBER: _ClassVar[int] key: str value: int - def __init__( - self, key: _Optional[str] = ..., value: _Optional[int] = ... - ) -> None: ... + def __init__(self, key: _Optional[str] = ..., value: _Optional[int] = ...) -> None: ... CHAT_ITEMS_FIELD_NUMBER: _ClassVar[int] MAX_NEW_TOKENS_FIELD_NUMBER: _ClassVar[int] TEMPERATURE_FIELD_NUMBER: _ClassVar[int] @@ -105,28 +72,7 @@ class ChatCompletionRequest(_message.Message): watermark: bool seed: int user: str - def __init__( - self, - chat_items: _Optional[_Iterable[_Union[ChatItem, _Mapping]]] = ..., - max_new_tokens: _Optional[int] = ..., - temperature: _Optional[float] = ..., - top_k: _Optional[float] = ..., - top_p: _Optional[float] = ..., - do_sample: bool = ..., - n: _Optional[int] = ..., - stop: _Optional[_Iterable[str]] = ..., - repetition_penalty: _Optional[float] = ..., - presence_penalty: _Optional[float] = ..., - frequency_penalty: _Optional[float] = ..., - best_of: _Optional[str] = ..., - logit_bias: _Optional[_Mapping[str, int]] = ..., - return_full_text: bool = ..., - truncate: _Optional[int] = ..., - typical_p: _Optional[float] = ..., - watermark: bool = ..., - seed: _Optional[int] = ..., - user: _Optional[str] = ..., - ) -> None: ... + def __init__(self, chat_items: _Optional[_Iterable[_Union[ChatItem, _Mapping]]] = ..., max_new_tokens: _Optional[int] = ..., temperature: _Optional[float] = ..., top_k: _Optional[float] = ..., top_p: _Optional[float] = ..., do_sample: bool = ..., n: _Optional[int] = ..., stop: _Optional[_Iterable[str]] = ..., repetition_penalty: _Optional[float] = ..., presence_penalty: _Optional[float] = ..., frequency_penalty: _Optional[float] = ..., best_of: _Optional[str] = ..., logit_bias: _Optional[_Mapping[str, int]] = ..., return_full_text: bool = ..., truncate: _Optional[int] = ..., typical_p: _Optional[float] = ..., watermark: bool = ..., seed: _Optional[int] = ..., user: _Optional[str] = ...) -> None: ... class ChatCompletionChoice(_message.Message): __slots__ = ("index", "chat_item", "finish_reason") @@ -136,12 +82,7 @@ class ChatCompletionChoice(_message.Message): index: int chat_item: ChatItem finish_reason: str - def __init__( - self, - index: _Optional[int] = ..., - chat_item: _Optional[_Union[ChatItem, _Mapping]] = ..., - finish_reason: _Optional[str] = ..., - ) -> None: ... + def __init__(self, index: _Optional[int] = ..., chat_item: _Optional[_Union[ChatItem, _Mapping]] = ..., finish_reason: _Optional[str] = ...) -> None: ... class Usage(_message.Message): __slots__ = ("prompt_tokens", "completion_tokens", "total_tokens") @@ -151,12 +92,7 @@ class Usage(_message.Message): prompt_tokens: int completion_tokens: int total_tokens: int - def __init__( - self, - prompt_tokens: _Optional[int] = ..., - completion_tokens: _Optional[int] = ..., - total_tokens: _Optional[int] = ..., - ) -> None: ... + def __init__(self, prompt_tokens: _Optional[int] = ..., completion_tokens: _Optional[int] = ..., total_tokens: _Optional[int] = ...) -> None: ... class ChatCompletionResponse(_message.Message): __slots__ = ("id", "object", "created", "choices", "usage") @@ -170,11 +106,4 @@ class ChatCompletionResponse(_message.Message): created: int choices: _containers.RepeatedCompositeFieldContainer[ChatCompletionChoice] usage: Usage - def __init__( - self, - id: _Optional[str] = ..., - object: _Optional[str] = ..., - created: _Optional[int] = ..., - choices: _Optional[_Iterable[_Union[ChatCompletionChoice, _Mapping]]] = ..., - usage: _Optional[_Union[Usage, _Mapping]] = ..., - ) -> None: ... + def __init__(self, id: _Optional[str] = ..., object: _Optional[str] = ..., created: _Optional[int] = ..., choices: _Optional[_Iterable[_Union[ChatCompletionChoice, _Mapping]]] = ..., usage: _Optional[_Union[Usage, _Mapping]] = ...) -> None: ... diff --git a/src/leapfrogai_sdk/chat/chat_pb2_grpc.py b/src/leapfrogai_sdk/chat/chat_pb2_grpc.py index 665a70792..b9c1500bf 100644 --- a/src/leapfrogai_sdk/chat/chat_pb2_grpc.py +++ b/src/leapfrogai_sdk/chat/chat_pb2_grpc.py @@ -15,10 +15,10 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.ChatComplete = channel.unary_unary( - "/chat.ChatCompletionService/ChatComplete", - request_serializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionRequest.SerializeToString, - response_deserializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionResponse.FromString, - ) + '/chat.ChatCompletionService/ChatComplete', + request_serializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionRequest.SerializeToString, + response_deserializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionResponse.FromString, + ) class ChatCompletionServiceServicer(object): @@ -27,56 +27,43 @@ class ChatCompletionServiceServicer(object): def ChatComplete(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def add_ChatCompletionServiceServicer_to_server(servicer, server): rpc_method_handlers = { - "ChatComplete": grpc.unary_unary_rpc_method_handler( - servicer.ChatComplete, - request_deserializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionRequest.FromString, - response_serializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionResponse.SerializeToString, - ), + 'ChatComplete': grpc.unary_unary_rpc_method_handler( + servicer.ChatComplete, + request_deserializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionRequest.FromString, + response_serializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( - "chat.ChatCompletionService", rpc_method_handlers - ) + 'chat.ChatCompletionService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) -# This class is part of an EXPERIMENTAL API. + # This class is part of an EXPERIMENTAL API. class ChatCompletionService(object): """Missing associated documentation comment in .proto file.""" @staticmethod - def ChatComplete( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, + def ChatComplete(request, target, - "/chat.ChatCompletionService/ChatComplete", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/chat.ChatCompletionService/ChatComplete', leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionRequest.SerializeToString, leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) class ChatCompletionStreamServiceStub(object): @@ -89,10 +76,10 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.ChatCompleteStream = channel.unary_stream( - "/chat.ChatCompletionStreamService/ChatCompleteStream", - request_serializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionRequest.SerializeToString, - response_deserializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionResponse.FromString, - ) + '/chat.ChatCompletionStreamService/ChatCompleteStream', + request_serializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionRequest.SerializeToString, + response_deserializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionResponse.FromString, + ) class ChatCompletionStreamServiceServicer(object): @@ -101,53 +88,40 @@ class ChatCompletionStreamServiceServicer(object): def ChatCompleteStream(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def add_ChatCompletionStreamServiceServicer_to_server(servicer, server): rpc_method_handlers = { - "ChatCompleteStream": grpc.unary_stream_rpc_method_handler( - servicer.ChatCompleteStream, - request_deserializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionRequest.FromString, - response_serializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionResponse.SerializeToString, - ), + 'ChatCompleteStream': grpc.unary_stream_rpc_method_handler( + servicer.ChatCompleteStream, + request_deserializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionRequest.FromString, + response_serializer=leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( - "chat.ChatCompletionStreamService", rpc_method_handlers - ) + 'chat.ChatCompletionStreamService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) -# This class is part of an EXPERIMENTAL API. + # This class is part of an EXPERIMENTAL API. class ChatCompletionStreamService(object): """Missing associated documentation comment in .proto file.""" @staticmethod - def ChatCompleteStream( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_stream( - request, + def ChatCompleteStream(request, target, - "/chat.ChatCompletionStreamService/ChatCompleteStream", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/chat.ChatCompletionStreamService/ChatCompleteStream', leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionRequest.SerializeToString, leapfrogai__sdk_dot_chat_dot_chat__pb2.ChatCompletionResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/src/leapfrogai_sdk/completion/completion_pb2.py b/src/leapfrogai_sdk/completion/completion_pb2.py index 92f9ba52b..be013e6ca 100644 --- a/src/leapfrogai_sdk/completion/completion_pb2.py +++ b/src/leapfrogai_sdk/completion/completion_pb2.py @@ -12,38 +12,32 @@ _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n*leapfrogai_sdk/completion/completion.proto\x12\ncompletion"\xf7\x06\n\x11\x43ompletionRequest\x12\x0e\n\x06prompt\x18\x01 \x01(\t\x12\x13\n\x06suffix\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x0emax_new_tokens\x18\x03 \x01(\x05H\x01\x88\x01\x01\x12\x18\n\x0btemperature\x18\x04 \x01(\x02H\x02\x88\x01\x01\x12\x12\n\x05top_k\x18\x05 \x01(\x05H\x03\x88\x01\x01\x12\x12\n\x05top_p\x18\x06 \x01(\x02H\x04\x88\x01\x01\x12\x16\n\tdo_sample\x18\x07 \x01(\x08H\x05\x88\x01\x01\x12\x0e\n\x01n\x18\x08 \x01(\x05H\x06\x88\x01\x01\x12\x15\n\x08logprobs\x18\t \x01(\x05H\x07\x88\x01\x01\x12\x11\n\x04\x65\x63ho\x18\n \x01(\x08H\x08\x88\x01\x01\x12\x0c\n\x04stop\x18\x0b \x03(\t\x12\x1f\n\x12repetition_penalty\x18\x0c \x01(\x02H\t\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\r \x01(\x02H\n\x88\x01\x01\x12\x1e\n\x11\x66requence_penalty\x18\x0e \x01(\x02H\x0b\x88\x01\x01\x12\x14\n\x07\x62\x65st_of\x18\x0f \x01(\x05H\x0c\x88\x01\x01\x12@\n\nlogit_bias\x18\x10 \x03(\x0b\x32,.completion.CompletionRequest.LogitBiasEntry\x12\x1d\n\x10return_full_text\x18\x11 \x01(\x08H\r\x88\x01\x01\x12\x15\n\x08truncate\x18\x12 \x01(\x05H\x0e\x88\x01\x01\x12\x16\n\ttypical_p\x18\x13 \x01(\x02H\x0f\x88\x01\x01\x12\x16\n\twatermark\x18\x14 \x01(\x08H\x10\x88\x01\x01\x12\x11\n\x04seed\x18\x15 \x01(\x05H\x11\x88\x01\x01\x12\x11\n\x04user\x18\x16 \x01(\tH\x12\x88\x01\x01\x1a\x30\n\x0eLogitBiasEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x42\t\n\x07_suffixB\x11\n\x0f_max_new_tokensB\x0e\n\x0c_temperatureB\x08\n\x06_top_kB\x08\n\x06_top_pB\x0c\n\n_do_sampleB\x04\n\x02_nB\x0b\n\t_logprobsB\x07\n\x05_echoB\x15\n\x13_repetition_penaltyB\x13\n\x11_presence_penaltyB\x14\n\x12_frequence_penaltyB\n\n\x08_best_ofB\x13\n\x11_return_full_textB\x0b\n\t_truncateB\x0c\n\n_typical_pB\x0c\n\n_watermarkB\x07\n\x05_seedB\x07\n\x05_user"j\n\x10\x43ompletionChoice\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\r\n\x05index\x18\x02 \x01(\x05\x12\x39\n\rfinish_reason\x18\x03 \x01(\x0e\x32".completion.CompletionFinishReason"Y\n\x0f\x43ompletionUsage\x12\x15\n\rprompt_tokens\x18\x01 \x01(\x05\x12\x19\n\x11\x63ompletion_tokens\x18\x02 \x01(\x05\x12\x14\n\x0ctotal_tokens\x18\x03 \x01(\x05"~\n\x12\x43ompletionResponse\x12-\n\x07\x63hoices\x18\x01 \x03(\x0b\x32\x1c.completion.CompletionChoice\x12/\n\x05usage\x18\x02 \x01(\x0b\x32\x1b.completion.CompletionUsageH\x00\x88\x01\x01\x42\x08\n\x06_usage*.\n\x16\x43ompletionFinishReason\x12\x08\n\x04STOP\x10\x00\x12\n\n\x06LENGTH\x10\x01\x32^\n\x11\x43ompletionService\x12I\n\x08\x43omplete\x12\x1d.completion.CompletionRequest\x1a\x1e.completion.CompletionResponse2l\n\x17\x43ompletionStreamService\x12Q\n\x0e\x43ompleteStream\x12\x1d.completion.CompletionRequest\x1a\x1e.completion.CompletionResponse0\x01\x42=Z;github.com/defenseunicorns/leapfrogai/pkg/client/completionb\x06proto3' -) + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n*leapfrogai_sdk/completion/completion.proto\x12\ncompletion\"\xf7\x06\n\x11\x43ompletionRequest\x12\x0e\n\x06prompt\x18\x01 \x01(\t\x12\x13\n\x06suffix\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x0emax_new_tokens\x18\x03 \x01(\x05H\x01\x88\x01\x01\x12\x18\n\x0btemperature\x18\x04 \x01(\x02H\x02\x88\x01\x01\x12\x12\n\x05top_k\x18\x05 \x01(\x05H\x03\x88\x01\x01\x12\x12\n\x05top_p\x18\x06 \x01(\x02H\x04\x88\x01\x01\x12\x16\n\tdo_sample\x18\x07 \x01(\x08H\x05\x88\x01\x01\x12\x0e\n\x01n\x18\x08 \x01(\x05H\x06\x88\x01\x01\x12\x15\n\x08logprobs\x18\t \x01(\x05H\x07\x88\x01\x01\x12\x11\n\x04\x65\x63ho\x18\n \x01(\x08H\x08\x88\x01\x01\x12\x0c\n\x04stop\x18\x0b \x03(\t\x12\x1f\n\x12repetition_penalty\x18\x0c \x01(\x02H\t\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\r \x01(\x02H\n\x88\x01\x01\x12\x1e\n\x11\x66requence_penalty\x18\x0e \x01(\x02H\x0b\x88\x01\x01\x12\x14\n\x07\x62\x65st_of\x18\x0f \x01(\tH\x0c\x88\x01\x01\x12@\n\nlogit_bias\x18\x10 \x03(\x0b\x32,.completion.CompletionRequest.LogitBiasEntry\x12\x1d\n\x10return_full_text\x18\x11 \x01(\x08H\r\x88\x01\x01\x12\x15\n\x08truncate\x18\x12 \x01(\x05H\x0e\x88\x01\x01\x12\x16\n\ttypical_p\x18\x13 \x01(\x02H\x0f\x88\x01\x01\x12\x16\n\twatermark\x18\x14 \x01(\x08H\x10\x88\x01\x01\x12\x11\n\x04seed\x18\x15 \x01(\x05H\x11\x88\x01\x01\x12\x11\n\x04user\x18\x16 \x01(\tH\x12\x88\x01\x01\x1a\x30\n\x0eLogitBiasEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x42\t\n\x07_suffixB\x11\n\x0f_max_new_tokensB\x0e\n\x0c_temperatureB\x08\n\x06_top_kB\x08\n\x06_top_pB\x0c\n\n_do_sampleB\x04\n\x02_nB\x0b\n\t_logprobsB\x07\n\x05_echoB\x15\n\x13_repetition_penaltyB\x13\n\x11_presence_penaltyB\x14\n\x12_frequence_penaltyB\n\n\x08_best_ofB\x13\n\x11_return_full_textB\x0b\n\t_truncateB\x0c\n\n_typical_pB\x0c\n\n_watermarkB\x07\n\x05_seedB\x07\n\x05_user\"j\n\x10\x43ompletionChoice\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\r\n\x05index\x18\x02 \x01(\x05\x12\x39\n\rfinish_reason\x18\x03 \x01(\x0e\x32\".completion.CompletionFinishReason\"Y\n\x0f\x43ompletionUsage\x12\x15\n\rprompt_tokens\x18\x01 \x01(\x05\x12\x19\n\x11\x63ompletion_tokens\x18\x02 \x01(\x05\x12\x14\n\x0ctotal_tokens\x18\x03 \x01(\x05\"~\n\x12\x43ompletionResponse\x12-\n\x07\x63hoices\x18\x01 \x03(\x0b\x32\x1c.completion.CompletionChoice\x12/\n\x05usage\x18\x02 \x01(\x0b\x32\x1b.completion.CompletionUsageH\x00\x88\x01\x01\x42\x08\n\x06_usage*.\n\x16\x43ompletionFinishReason\x12\x08\n\x04STOP\x10\x00\x12\n\n\x06LENGTH\x10\x01\x32^\n\x11\x43ompletionService\x12I\n\x08\x43omplete\x12\x1d.completion.CompletionRequest\x1a\x1e.completion.CompletionResponse2l\n\x17\x43ompletionStreamService\x12Q\n\x0e\x43ompleteStream\x12\x1d.completion.CompletionRequest\x1a\x1e.completion.CompletionResponse0\x01\x42=Z;github.com/defenseunicorns/leapfrogai/pkg/client/completionb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages( - DESCRIPTOR, "leapfrogai_sdk.completion.completion_pb2", _globals -) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'leapfrogai_sdk.completion.completion_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: - _globals["DESCRIPTOR"]._options = None - _globals[ - "DESCRIPTOR" - ]._serialized_options = ( - b"Z;github.com/defenseunicorns/leapfrogai/pkg/client/completion" - ) - _globals["_COMPLETIONREQUEST_LOGITBIASENTRY"]._options = None - _globals["_COMPLETIONREQUEST_LOGITBIASENTRY"]._serialized_options = b"8\001" - _globals["_COMPLETIONFINISHREASON"]._serialized_start = 1275 - _globals["_COMPLETIONFINISHREASON"]._serialized_end = 1321 - _globals["_COMPLETIONREQUEST"]._serialized_start = 59 - _globals["_COMPLETIONREQUEST"]._serialized_end = 946 - _globals["_COMPLETIONREQUEST_LOGITBIASENTRY"]._serialized_start = 632 - _globals["_COMPLETIONREQUEST_LOGITBIASENTRY"]._serialized_end = 680 - _globals["_COMPLETIONCHOICE"]._serialized_start = 948 - _globals["_COMPLETIONCHOICE"]._serialized_end = 1054 - _globals["_COMPLETIONUSAGE"]._serialized_start = 1056 - _globals["_COMPLETIONUSAGE"]._serialized_end = 1145 - _globals["_COMPLETIONRESPONSE"]._serialized_start = 1147 - _globals["_COMPLETIONRESPONSE"]._serialized_end = 1273 - _globals["_COMPLETIONSERVICE"]._serialized_start = 1323 - _globals["_COMPLETIONSERVICE"]._serialized_end = 1417 - _globals["_COMPLETIONSTREAMSERVICE"]._serialized_start = 1419 - _globals["_COMPLETIONSTREAMSERVICE"]._serialized_end = 1527 + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'Z;github.com/defenseunicorns/leapfrogai/pkg/client/completion' + _globals['_COMPLETIONREQUEST_LOGITBIASENTRY']._options = None + _globals['_COMPLETIONREQUEST_LOGITBIASENTRY']._serialized_options = b'8\001' + _globals['_COMPLETIONFINISHREASON']._serialized_start=1275 + _globals['_COMPLETIONFINISHREASON']._serialized_end=1321 + _globals['_COMPLETIONREQUEST']._serialized_start=59 + _globals['_COMPLETIONREQUEST']._serialized_end=946 + _globals['_COMPLETIONREQUEST_LOGITBIASENTRY']._serialized_start=632 + _globals['_COMPLETIONREQUEST_LOGITBIASENTRY']._serialized_end=680 + _globals['_COMPLETIONCHOICE']._serialized_start=948 + _globals['_COMPLETIONCHOICE']._serialized_end=1054 + _globals['_COMPLETIONUSAGE']._serialized_start=1056 + _globals['_COMPLETIONUSAGE']._serialized_end=1145 + _globals['_COMPLETIONRESPONSE']._serialized_start=1147 + _globals['_COMPLETIONRESPONSE']._serialized_end=1273 + _globals['_COMPLETIONSERVICE']._serialized_start=1323 + _globals['_COMPLETIONSERVICE']._serialized_end=1417 + _globals['_COMPLETIONSTREAMSERVICE']._serialized_start=1419 + _globals['_COMPLETIONSTREAMSERVICE']._serialized_end=1527 # @@protoc_insertion_point(module_scope) diff --git a/src/leapfrogai_sdk/completion/completion_pb2.pyi b/src/leapfrogai_sdk/completion/completion_pb2.pyi index 16193d153..1a8f74799 100644 --- a/src/leapfrogai_sdk/completion/completion_pb2.pyi +++ b/src/leapfrogai_sdk/completion/completion_pb2.pyi @@ -2,13 +2,7 @@ from google.protobuf.internal import containers as _containers from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message -from typing import ( - ClassVar as _ClassVar, - Iterable as _Iterable, - Mapping as _Mapping, - Optional as _Optional, - Union as _Union, -) +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union DESCRIPTOR: _descriptor.FileDescriptor @@ -16,44 +10,18 @@ class CompletionFinishReason(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): __slots__ = () STOP: _ClassVar[CompletionFinishReason] LENGTH: _ClassVar[CompletionFinishReason] - STOP: CompletionFinishReason LENGTH: CompletionFinishReason class CompletionRequest(_message.Message): - __slots__ = ( - "prompt", - "suffix", - "max_new_tokens", - "temperature", - "top_k", - "top_p", - "do_sample", - "n", - "logprobs", - "echo", - "stop", - "repetition_penalty", - "presence_penalty", - "frequence_penalty", - "best_of", - "logit_bias", - "return_full_text", - "truncate", - "typical_p", - "watermark", - "seed", - "user", - ) + __slots__ = ("prompt", "suffix", "max_new_tokens", "temperature", "top_k", "top_p", "do_sample", "n", "logprobs", "echo", "stop", "repetition_penalty", "presence_penalty", "frequence_penalty", "best_of", "logit_bias", "return_full_text", "truncate", "typical_p", "watermark", "seed", "user") class LogitBiasEntry(_message.Message): __slots__ = ("key", "value") KEY_FIELD_NUMBER: _ClassVar[int] VALUE_FIELD_NUMBER: _ClassVar[int] key: str value: int - def __init__( - self, key: _Optional[str] = ..., value: _Optional[int] = ... - ) -> None: ... + def __init__(self, key: _Optional[str] = ..., value: _Optional[int] = ...) -> None: ... PROMPT_FIELD_NUMBER: _ClassVar[int] SUFFIX_FIELD_NUMBER: _ClassVar[int] MAX_NEW_TOKENS_FIELD_NUMBER: _ClassVar[int] @@ -90,7 +58,7 @@ class CompletionRequest(_message.Message): repetition_penalty: float presence_penalty: float frequence_penalty: float - best_of: int + best_of: str logit_bias: _containers.ScalarMap[str, int] return_full_text: bool truncate: int @@ -98,31 +66,7 @@ class CompletionRequest(_message.Message): watermark: bool seed: int user: str - def __init__( - self, - prompt: _Optional[str] = ..., - suffix: _Optional[str] = ..., - max_new_tokens: _Optional[int] = ..., - temperature: _Optional[float] = ..., - top_k: _Optional[int] = ..., - top_p: _Optional[float] = ..., - do_sample: bool = ..., - n: _Optional[int] = ..., - logprobs: _Optional[int] = ..., - echo: bool = ..., - stop: _Optional[_Iterable[str]] = ..., - repetition_penalty: _Optional[float] = ..., - presence_penalty: _Optional[float] = ..., - frequence_penalty: _Optional[float] = ..., - best_of: _Optional[int] = ..., - logit_bias: _Optional[_Mapping[str, int]] = ..., - return_full_text: bool = ..., - truncate: _Optional[int] = ..., - typical_p: _Optional[float] = ..., - watermark: bool = ..., - seed: _Optional[int] = ..., - user: _Optional[str] = ..., - ) -> None: ... + def __init__(self, prompt: _Optional[str] = ..., suffix: _Optional[str] = ..., max_new_tokens: _Optional[int] = ..., temperature: _Optional[float] = ..., top_k: _Optional[int] = ..., top_p: _Optional[float] = ..., do_sample: bool = ..., n: _Optional[int] = ..., logprobs: _Optional[int] = ..., echo: bool = ..., stop: _Optional[_Iterable[str]] = ..., repetition_penalty: _Optional[float] = ..., presence_penalty: _Optional[float] = ..., frequence_penalty: _Optional[float] = ..., best_of: _Optional[str] = ..., logit_bias: _Optional[_Mapping[str, int]] = ..., return_full_text: bool = ..., truncate: _Optional[int] = ..., typical_p: _Optional[float] = ..., watermark: bool = ..., seed: _Optional[int] = ..., user: _Optional[str] = ...) -> None: ... class CompletionChoice(_message.Message): __slots__ = ("text", "index", "finish_reason") @@ -132,12 +76,7 @@ class CompletionChoice(_message.Message): text: str index: int finish_reason: CompletionFinishReason - def __init__( - self, - text: _Optional[str] = ..., - index: _Optional[int] = ..., - finish_reason: _Optional[_Union[CompletionFinishReason, str]] = ..., - ) -> None: ... + def __init__(self, text: _Optional[str] = ..., index: _Optional[int] = ..., finish_reason: _Optional[_Union[CompletionFinishReason, str]] = ...) -> None: ... class CompletionUsage(_message.Message): __slots__ = ("prompt_tokens", "completion_tokens", "total_tokens") @@ -147,12 +86,7 @@ class CompletionUsage(_message.Message): prompt_tokens: int completion_tokens: int total_tokens: int - def __init__( - self, - prompt_tokens: _Optional[int] = ..., - completion_tokens: _Optional[int] = ..., - total_tokens: _Optional[int] = ..., - ) -> None: ... + def __init__(self, prompt_tokens: _Optional[int] = ..., completion_tokens: _Optional[int] = ..., total_tokens: _Optional[int] = ...) -> None: ... class CompletionResponse(_message.Message): __slots__ = ("choices", "usage") @@ -160,8 +94,4 @@ class CompletionResponse(_message.Message): USAGE_FIELD_NUMBER: _ClassVar[int] choices: _containers.RepeatedCompositeFieldContainer[CompletionChoice] usage: CompletionUsage - def __init__( - self, - choices: _Optional[_Iterable[_Union[CompletionChoice, _Mapping]]] = ..., - usage: _Optional[_Union[CompletionUsage, _Mapping]] = ..., - ) -> None: ... + def __init__(self, choices: _Optional[_Iterable[_Union[CompletionChoice, _Mapping]]] = ..., usage: _Optional[_Union[CompletionUsage, _Mapping]] = ...) -> None: ... diff --git a/src/leapfrogai_sdk/completion/completion_pb2_grpc.py b/src/leapfrogai_sdk/completion/completion_pb2_grpc.py index b698696a1..c4c510a26 100644 --- a/src/leapfrogai_sdk/completion/completion_pb2_grpc.py +++ b/src/leapfrogai_sdk/completion/completion_pb2_grpc.py @@ -2,9 +2,7 @@ """Client and server classes corresponding to protobuf-defined services.""" import grpc -from leapfrogai_sdk.completion import ( - completion_pb2 as leapfrogai__sdk_dot_completion_dot_completion__pb2, -) +from leapfrogai_sdk.completion import completion_pb2 as leapfrogai__sdk_dot_completion_dot_completion__pb2 class CompletionServiceStub(object): @@ -17,10 +15,10 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.Complete = channel.unary_unary( - "/completion.CompletionService/Complete", - request_serializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionRequest.SerializeToString, - response_deserializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionResponse.FromString, - ) + '/completion.CompletionService/Complete', + request_serializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionRequest.SerializeToString, + response_deserializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionResponse.FromString, + ) class CompletionServiceServicer(object): @@ -29,56 +27,43 @@ class CompletionServiceServicer(object): def Complete(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def add_CompletionServiceServicer_to_server(servicer, server): rpc_method_handlers = { - "Complete": grpc.unary_unary_rpc_method_handler( - servicer.Complete, - request_deserializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionRequest.FromString, - response_serializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionResponse.SerializeToString, - ), + 'Complete': grpc.unary_unary_rpc_method_handler( + servicer.Complete, + request_deserializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionRequest.FromString, + response_serializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( - "completion.CompletionService", rpc_method_handlers - ) + 'completion.CompletionService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) -# This class is part of an EXPERIMENTAL API. + # This class is part of an EXPERIMENTAL API. class CompletionService(object): """Missing associated documentation comment in .proto file.""" @staticmethod - def Complete( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, + def Complete(request, target, - "/completion.CompletionService/Complete", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/completion.CompletionService/Complete', leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionRequest.SerializeToString, leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) class CompletionStreamServiceStub(object): @@ -91,10 +76,10 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.CompleteStream = channel.unary_stream( - "/completion.CompletionStreamService/CompleteStream", - request_serializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionRequest.SerializeToString, - response_deserializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionResponse.FromString, - ) + '/completion.CompletionStreamService/CompleteStream', + request_serializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionRequest.SerializeToString, + response_deserializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionResponse.FromString, + ) class CompletionStreamServiceServicer(object): @@ -103,53 +88,40 @@ class CompletionStreamServiceServicer(object): def CompleteStream(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def add_CompletionStreamServiceServicer_to_server(servicer, server): rpc_method_handlers = { - "CompleteStream": grpc.unary_stream_rpc_method_handler( - servicer.CompleteStream, - request_deserializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionRequest.FromString, - response_serializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionResponse.SerializeToString, - ), + 'CompleteStream': grpc.unary_stream_rpc_method_handler( + servicer.CompleteStream, + request_deserializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionRequest.FromString, + response_serializer=leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( - "completion.CompletionStreamService", rpc_method_handlers - ) + 'completion.CompletionStreamService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) -# This class is part of an EXPERIMENTAL API. + # This class is part of an EXPERIMENTAL API. class CompletionStreamService(object): """Missing associated documentation comment in .proto file.""" @staticmethod - def CompleteStream( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_stream( - request, + def CompleteStream(request, target, - "/completion.CompletionStreamService/CompleteStream", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/completion.CompletionStreamService/CompleteStream', leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionRequest.SerializeToString, leapfrogai__sdk_dot_completion_dot_completion__pb2.CompletionResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/src/leapfrogai_sdk/embeddings/embeddings_pb2.py b/src/leapfrogai_sdk/embeddings/embeddings_pb2.py index 1aceceec2..0a4b391cd 100644 --- a/src/leapfrogai_sdk/embeddings/embeddings_pb2.py +++ b/src/leapfrogai_sdk/embeddings/embeddings_pb2.py @@ -12,28 +12,22 @@ _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n*leapfrogai_sdk/embeddings/embeddings.proto\x12\nembeddings""\n\x10\x45mbeddingRequest\x12\x0e\n\x06inputs\x18\x01 \x03(\t"\x1e\n\tEmbedding\x12\x11\n\tembedding\x18\x01 \x03(\x02">\n\x11\x45mbeddingResponse\x12)\n\nembeddings\x18\x01 \x03(\x0b\x32\x15.embeddings.Embedding2c\n\x11\x45mbeddingsService\x12N\n\x0f\x43reateEmbedding\x12\x1c.embeddings.EmbeddingRequest\x1a\x1d.embeddings.EmbeddingResponseB=Z;github.com/defenseunicorns/leapfrogai/pkg/client/embeddingsb\x06proto3' -) + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n*leapfrogai_sdk/embeddings/embeddings.proto\x12\nembeddings\"\"\n\x10\x45mbeddingRequest\x12\x0e\n\x06inputs\x18\x01 \x03(\t\"\x1e\n\tEmbedding\x12\x11\n\tembedding\x18\x01 \x03(\x02\">\n\x11\x45mbeddingResponse\x12)\n\nembeddings\x18\x01 \x03(\x0b\x32\x15.embeddings.Embedding2c\n\x11\x45mbeddingsService\x12N\n\x0f\x43reateEmbedding\x12\x1c.embeddings.EmbeddingRequest\x1a\x1d.embeddings.EmbeddingResponseB=Z;github.com/defenseunicorns/leapfrogai/pkg/client/embeddingsb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages( - DESCRIPTOR, "leapfrogai_sdk.embeddings.embeddings_pb2", _globals -) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'leapfrogai_sdk.embeddings.embeddings_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: - _globals["DESCRIPTOR"]._options = None - _globals[ - "DESCRIPTOR" - ]._serialized_options = ( - b"Z;github.com/defenseunicorns/leapfrogai/pkg/client/embeddings" - ) - _globals["_EMBEDDINGREQUEST"]._serialized_start = 58 - _globals["_EMBEDDINGREQUEST"]._serialized_end = 92 - _globals["_EMBEDDING"]._serialized_start = 94 - _globals["_EMBEDDING"]._serialized_end = 124 - _globals["_EMBEDDINGRESPONSE"]._serialized_start = 126 - _globals["_EMBEDDINGRESPONSE"]._serialized_end = 188 - _globals["_EMBEDDINGSSERVICE"]._serialized_start = 190 - _globals["_EMBEDDINGSSERVICE"]._serialized_end = 289 + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'Z;github.com/defenseunicorns/leapfrogai/pkg/client/embeddings' + _globals['_EMBEDDINGREQUEST']._serialized_start=58 + _globals['_EMBEDDINGREQUEST']._serialized_end=92 + _globals['_EMBEDDING']._serialized_start=94 + _globals['_EMBEDDING']._serialized_end=124 + _globals['_EMBEDDINGRESPONSE']._serialized_start=126 + _globals['_EMBEDDINGRESPONSE']._serialized_end=188 + _globals['_EMBEDDINGSSERVICE']._serialized_start=190 + _globals['_EMBEDDINGSSERVICE']._serialized_end=289 # @@protoc_insertion_point(module_scope) diff --git a/src/leapfrogai_sdk/embeddings/embeddings_pb2.pyi b/src/leapfrogai_sdk/embeddings/embeddings_pb2.pyi index 634f4d36f..c8edff9e6 100644 --- a/src/leapfrogai_sdk/embeddings/embeddings_pb2.pyi +++ b/src/leapfrogai_sdk/embeddings/embeddings_pb2.pyi @@ -1,13 +1,7 @@ from google.protobuf.internal import containers as _containers from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message -from typing import ( - ClassVar as _ClassVar, - Iterable as _Iterable, - Mapping as _Mapping, - Optional as _Optional, - Union as _Union, -) +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union DESCRIPTOR: _descriptor.FileDescriptor @@ -27,6 +21,4 @@ class EmbeddingResponse(_message.Message): __slots__ = ("embeddings",) EMBEDDINGS_FIELD_NUMBER: _ClassVar[int] embeddings: _containers.RepeatedCompositeFieldContainer[Embedding] - def __init__( - self, embeddings: _Optional[_Iterable[_Union[Embedding, _Mapping]]] = ... - ) -> None: ... + def __init__(self, embeddings: _Optional[_Iterable[_Union[Embedding, _Mapping]]] = ...) -> None: ... diff --git a/src/leapfrogai_sdk/embeddings/embeddings_pb2_grpc.py b/src/leapfrogai_sdk/embeddings/embeddings_pb2_grpc.py index f8b8780ca..b3c45b663 100644 --- a/src/leapfrogai_sdk/embeddings/embeddings_pb2_grpc.py +++ b/src/leapfrogai_sdk/embeddings/embeddings_pb2_grpc.py @@ -2,9 +2,7 @@ """Client and server classes corresponding to protobuf-defined services.""" import grpc -from leapfrogai_sdk.embeddings import ( - embeddings_pb2 as leapfrogai__sdk_dot_embeddings_dot_embeddings__pb2, -) +from leapfrogai_sdk.embeddings import embeddings_pb2 as leapfrogai__sdk_dot_embeddings_dot_embeddings__pb2 class EmbeddingsServiceStub(object): @@ -17,10 +15,10 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.CreateEmbedding = channel.unary_unary( - "/embeddings.EmbeddingsService/CreateEmbedding", - request_serializer=leapfrogai__sdk_dot_embeddings_dot_embeddings__pb2.EmbeddingRequest.SerializeToString, - response_deserializer=leapfrogai__sdk_dot_embeddings_dot_embeddings__pb2.EmbeddingResponse.FromString, - ) + '/embeddings.EmbeddingsService/CreateEmbedding', + request_serializer=leapfrogai__sdk_dot_embeddings_dot_embeddings__pb2.EmbeddingRequest.SerializeToString, + response_deserializer=leapfrogai__sdk_dot_embeddings_dot_embeddings__pb2.EmbeddingResponse.FromString, + ) class EmbeddingsServiceServicer(object): @@ -29,53 +27,40 @@ class EmbeddingsServiceServicer(object): def CreateEmbedding(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def add_EmbeddingsServiceServicer_to_server(servicer, server): rpc_method_handlers = { - "CreateEmbedding": grpc.unary_unary_rpc_method_handler( - servicer.CreateEmbedding, - request_deserializer=leapfrogai__sdk_dot_embeddings_dot_embeddings__pb2.EmbeddingRequest.FromString, - response_serializer=leapfrogai__sdk_dot_embeddings_dot_embeddings__pb2.EmbeddingResponse.SerializeToString, - ), + 'CreateEmbedding': grpc.unary_unary_rpc_method_handler( + servicer.CreateEmbedding, + request_deserializer=leapfrogai__sdk_dot_embeddings_dot_embeddings__pb2.EmbeddingRequest.FromString, + response_serializer=leapfrogai__sdk_dot_embeddings_dot_embeddings__pb2.EmbeddingResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( - "embeddings.EmbeddingsService", rpc_method_handlers - ) + 'embeddings.EmbeddingsService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) -# This class is part of an EXPERIMENTAL API. + # This class is part of an EXPERIMENTAL API. class EmbeddingsService(object): """Missing associated documentation comment in .proto file.""" @staticmethod - def CreateEmbedding( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, + def CreateEmbedding(request, target, - "/embeddings.EmbeddingsService/CreateEmbedding", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/embeddings.EmbeddingsService/CreateEmbedding', leapfrogai__sdk_dot_embeddings_dot_embeddings__pb2.EmbeddingRequest.SerializeToString, leapfrogai__sdk_dot_embeddings_dot_embeddings__pb2.EmbeddingResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/src/leapfrogai_sdk/name/name_pb2.py b/src/leapfrogai_sdk/name/name_pb2.py index 8f81acdbe..ba947836b 100644 --- a/src/leapfrogai_sdk/name/name_pb2.py +++ b/src/leapfrogai_sdk/name/name_pb2.py @@ -15,22 +15,16 @@ from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1eleapfrogai_sdk/name/name.proto\x12\x04name\x1a\x1bgoogle/protobuf/empty.proto"\x1c\n\x0cNameResponse\x12\x0c\n\x04name\x18\x01 \x01(\t2A\n\x0bNameService\x12\x32\n\x04Name\x12\x16.google.protobuf.Empty\x1a\x12.name.NameResponseB7Z5github.com/defenseunicorns/leapfrogai/pkg/client/nameb\x06proto3' -) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1eleapfrogai_sdk/name/name.proto\x12\x04name\x1a\x1bgoogle/protobuf/empty.proto\"\x1c\n\x0cNameResponse\x12\x0c\n\x04name\x18\x01 \x01(\t2A\n\x0bNameService\x12\x32\n\x04Name\x12\x16.google.protobuf.Empty\x1a\x12.name.NameResponseB7Z5github.com/defenseunicorns/leapfrogai/pkg/client/nameb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages( - DESCRIPTOR, "leapfrogai_sdk.name.name_pb2", _globals -) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'leapfrogai_sdk.name.name_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: - _globals["DESCRIPTOR"]._options = None - _globals[ - "DESCRIPTOR" - ]._serialized_options = b"Z5github.com/defenseunicorns/leapfrogai/pkg/client/name" - _globals["_NAMERESPONSE"]._serialized_start = 69 - _globals["_NAMERESPONSE"]._serialized_end = 97 - _globals["_NAMESERVICE"]._serialized_start = 99 - _globals["_NAMESERVICE"]._serialized_end = 164 + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'Z5github.com/defenseunicorns/leapfrogai/pkg/client/name' + _globals['_NAMERESPONSE']._serialized_start=69 + _globals['_NAMERESPONSE']._serialized_end=97 + _globals['_NAMESERVICE']._serialized_start=99 + _globals['_NAMESERVICE']._serialized_end=164 # @@protoc_insertion_point(module_scope) diff --git a/src/leapfrogai_sdk/name/name_pb2_grpc.py b/src/leapfrogai_sdk/name/name_pb2_grpc.py index 33fcdf1f2..62288fe03 100644 --- a/src/leapfrogai_sdk/name/name_pb2_grpc.py +++ b/src/leapfrogai_sdk/name/name_pb2_grpc.py @@ -16,10 +16,10 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.Name = channel.unary_unary( - "/name.NameService/Name", - request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - response_deserializer=leapfrogai__sdk_dot_name_dot_name__pb2.NameResponse.FromString, - ) + '/name.NameService/Name', + request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, + response_deserializer=leapfrogai__sdk_dot_name_dot_name__pb2.NameResponse.FromString, + ) class NameServiceServicer(object): @@ -28,53 +28,40 @@ class NameServiceServicer(object): def Name(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def add_NameServiceServicer_to_server(servicer, server): rpc_method_handlers = { - "Name": grpc.unary_unary_rpc_method_handler( - servicer.Name, - request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - response_serializer=leapfrogai__sdk_dot_name_dot_name__pb2.NameResponse.SerializeToString, - ), + 'Name': grpc.unary_unary_rpc_method_handler( + servicer.Name, + request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, + response_serializer=leapfrogai__sdk_dot_name_dot_name__pb2.NameResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( - "name.NameService", rpc_method_handlers - ) + 'name.NameService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) -# This class is part of an EXPERIMENTAL API. + # This class is part of an EXPERIMENTAL API. class NameService(object): """Missing associated documentation comment in .proto file.""" @staticmethod - def Name( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, + def Name(request, target, - "/name.NameService/Name", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/name.NameService/Name', google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, leapfrogai__sdk_dot_name_dot_name__pb2.NameResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/src/leapfrogai_sdk/proto/leapfrogai_sdk/completion/completion.proto b/src/leapfrogai_sdk/proto/leapfrogai_sdk/completion/completion.proto index 2430a367e..2e1920e13 100644 --- a/src/leapfrogai_sdk/proto/leapfrogai_sdk/completion/completion.proto +++ b/src/leapfrogai_sdk/proto/leapfrogai_sdk/completion/completion.proto @@ -27,7 +27,7 @@ message CompletionRequest { optional float repetition_penalty = 12; optional float presence_penalty = 13; optional float frequence_penalty = 14; - optional int32 best_of = 15; + optional string best_of = 15; map logit_bias = 16; // Maps are represented as a pair of a key type and a value type. optional bool return_full_text = 17; optional int32 truncate = 18;