Skip to content

Commit

Permalink
changing best_of to a string in completions
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonprogis committed Sep 13, 2024
1 parent 4fe42fb commit 1166dd8
Show file tree
Hide file tree
Showing 15 changed files with 317 additions and 648 deletions.
44 changes: 20 additions & 24 deletions src/leapfrogai_sdk/audio/audio_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 6 additions & 55 deletions src/leapfrogai_sdk/audio/audio_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@ 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

class AudioTask(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
__slots__ = ()
TRANSCRIBE: _ClassVar[AudioTask]
TRANSLATE: _ClassVar[AudioTask]

TRANSCRIBE: AudioTask
TRANSLATE: AudioTask

Expand All @@ -42,42 +35,20 @@ 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")
METADATA_FIELD_NUMBER: _ClassVar[int]
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]
Expand All @@ -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]
Expand All @@ -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: ...
121 changes: 48 additions & 73 deletions src/leapfrogai_sdk/audio/audio_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
Loading

0 comments on commit 1166dd8

Please sign in to comment.