Skip to content

Commit

Permalink
Chore: Ran typegen for clients
Browse files Browse the repository at this point in the history
  • Loading branch information
lordsarcastic committed Nov 30, 2024
1 parent c2b26a1 commit 79cfcd4
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 119 deletions.
67 changes: 35 additions & 32 deletions sdk/ahnlich-client-py/ahnlich_client_py/internals/ai_query.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# pyre-strict
import typing
from dataclasses import dataclass

from ahnlich_client_py.internals import bincode
import typing
from ahnlich_client_py.internals import serde_types as st

from ahnlich_client_py.internals import bincode

class AIModel:
VARIANTS = [] # type: typing.Sequence[typing.Type[AIModel]]
Expand All @@ -13,7 +11,7 @@ def bincode_serialize(self) -> bytes:
return bincode.serialize(self, AIModel)

@staticmethod
def bincode_deserialize(input: bytes) -> "AIModel":
def bincode_deserialize(input: bytes) -> 'AIModel':
v, buffer = bincode.deserialize(input, AIModel)
if buffer:
raise st.DeserializationError("Some input bytes were not read")
Expand Down Expand Up @@ -61,7 +59,6 @@ class AIModel__ClipVitB32Text(AIModel):
INDEX = 6 # type: int
pass


AIModel.VARIANTS = [
AIModel__AllMiniLML6V2,
AIModel__AllMiniLML12V2,
Expand All @@ -80,7 +77,7 @@ def bincode_serialize(self) -> bytes:
return bincode.serialize(self, AIQuery)

@staticmethod
def bincode_deserialize(input: bytes) -> "AIQuery":
def bincode_deserialize(input: bytes) -> 'AIQuery':
v, buffer = bincode.deserialize(input, AIQuery)
if buffer:
raise st.DeserializationError("Some input bytes were not read")
Expand Down Expand Up @@ -114,6 +111,7 @@ class AIQuery__GetSimN(AIQuery):
condition: typing.Optional["PredicateCondition"]
closest_n: st.uint64
algorithm: "Algorithm"
preprocess_action: "PreprocessAction"


@dataclass(frozen=True)
Expand Down Expand Up @@ -150,9 +148,7 @@ class AIQuery__DropNonLinearAlgorithmIndex(AIQuery):
class AIQuery__Set(AIQuery):
INDEX = 7 # type: int
store: str
inputs: typing.Sequence[
typing.Tuple["StoreInput", typing.Dict[str, "MetadataValue"]]
]
inputs: typing.Sequence[typing.Tuple["StoreInput", typing.Dict[str, "MetadataValue"]]]
preprocess_action: "PreprocessAction"


Expand All @@ -171,29 +167,41 @@ class AIQuery__DropStore(AIQuery):


@dataclass(frozen=True)
class AIQuery__InfoServer(AIQuery):
class AIQuery__GetKey(AIQuery):
INDEX = 10 # type: int
pass
store: str
keys: typing.Sequence["StoreInput"]


@dataclass(frozen=True)
class AIQuery__ListStores(AIQuery):
class AIQuery__InfoServer(AIQuery):
INDEX = 11 # type: int
pass


@dataclass(frozen=True)
class AIQuery__PurgeStores(AIQuery):
class AIQuery__ListClients(AIQuery):
INDEX = 12 # type: int
pass


@dataclass(frozen=True)
class AIQuery__Ping(AIQuery):
class AIQuery__ListStores(AIQuery):
INDEX = 13 # type: int
pass


@dataclass(frozen=True)
class AIQuery__PurgeStores(AIQuery):
INDEX = 14 # type: int
pass


@dataclass(frozen=True)
class AIQuery__Ping(AIQuery):
INDEX = 15 # type: int
pass

AIQuery.VARIANTS = [
AIQuery__CreateStore,
AIQuery__GetPred,
Expand All @@ -205,7 +213,9 @@ class AIQuery__Ping(AIQuery):
AIQuery__Set,
AIQuery__DelKey,
AIQuery__DropStore,
AIQuery__GetKey,
AIQuery__InfoServer,
AIQuery__ListClients,
AIQuery__ListStores,
AIQuery__PurgeStores,
AIQuery__Ping,
Expand All @@ -221,7 +231,7 @@ def bincode_serialize(self) -> bytes:
return bincode.serialize(self, AIServerQuery)

@staticmethod
def bincode_deserialize(input: bytes) -> "AIServerQuery":
def bincode_deserialize(input: bytes) -> 'AIServerQuery':
v, buffer = bincode.deserialize(input, AIServerQuery)
if buffer:
raise st.DeserializationError("Some input bytes were not read")
Expand All @@ -235,7 +245,7 @@ def bincode_serialize(self) -> bytes:
return bincode.serialize(self, AIStoreInputType)

@staticmethod
def bincode_deserialize(input: bytes) -> "AIStoreInputType":
def bincode_deserialize(input: bytes) -> 'AIStoreInputType':
v, buffer = bincode.deserialize(input, AIStoreInputType)
if buffer:
raise st.DeserializationError("Some input bytes were not read")
Expand All @@ -253,7 +263,6 @@ class AIStoreInputType__Image(AIStoreInputType):
INDEX = 1 # type: int
pass


AIStoreInputType.VARIANTS = [
AIStoreInputType__RawString,
AIStoreInputType__Image,
Expand All @@ -267,7 +276,7 @@ def bincode_serialize(self) -> bytes:
return bincode.serialize(self, Algorithm)

@staticmethod
def bincode_deserialize(input: bytes) -> "Algorithm":
def bincode_deserialize(input: bytes) -> 'Algorithm':
v, buffer = bincode.deserialize(input, Algorithm)
if buffer:
raise st.DeserializationError("Some input bytes were not read")
Expand Down Expand Up @@ -297,7 +306,6 @@ class Algorithm__KDTree(Algorithm):
INDEX = 3 # type: int
pass


Algorithm.VARIANTS = [
Algorithm__EuclideanDistance,
Algorithm__DotProductSimilarity,
Expand All @@ -313,7 +321,7 @@ def bincode_serialize(self) -> bytes:
return bincode.serialize(self, MetadataValue)

@staticmethod
def bincode_deserialize(input: bytes) -> "MetadataValue":
def bincode_deserialize(input: bytes) -> 'MetadataValue':
v, buffer = bincode.deserialize(input, MetadataValue)
if buffer:
raise st.DeserializationError("Some input bytes were not read")
Expand All @@ -331,7 +339,6 @@ class MetadataValue__Image(MetadataValue):
INDEX = 1 # type: int
value: typing.Sequence[st.uint8]


MetadataValue.VARIANTS = [
MetadataValue__RawString,
MetadataValue__Image,
Expand All @@ -345,7 +352,7 @@ def bincode_serialize(self) -> bytes:
return bincode.serialize(self, NonLinearAlgorithm)

@staticmethod
def bincode_deserialize(input: bytes) -> "NonLinearAlgorithm":
def bincode_deserialize(input: bytes) -> 'NonLinearAlgorithm':
v, buffer = bincode.deserialize(input, NonLinearAlgorithm)
if buffer:
raise st.DeserializationError("Some input bytes were not read")
Expand All @@ -357,7 +364,6 @@ class NonLinearAlgorithm__KDTree(NonLinearAlgorithm):
INDEX = 0 # type: int
pass


NonLinearAlgorithm.VARIANTS = [
NonLinearAlgorithm__KDTree,
]
Expand All @@ -370,7 +376,7 @@ def bincode_serialize(self) -> bytes:
return bincode.serialize(self, Predicate)

@staticmethod
def bincode_deserialize(input: bytes) -> "Predicate":
def bincode_deserialize(input: bytes) -> 'Predicate':
v, buffer = bincode.deserialize(input, Predicate)
if buffer:
raise st.DeserializationError("Some input bytes were not read")
Expand Down Expand Up @@ -404,7 +410,6 @@ class Predicate__NotIn(Predicate):
key: str
value: typing.Sequence["MetadataValue"]


Predicate.VARIANTS = [
Predicate__Equals,
Predicate__NotEquals,
Expand All @@ -420,7 +425,7 @@ def bincode_serialize(self) -> bytes:
return bincode.serialize(self, PredicateCondition)

@staticmethod
def bincode_deserialize(input: bytes) -> "PredicateCondition":
def bincode_deserialize(input: bytes) -> 'PredicateCondition':
v, buffer = bincode.deserialize(input, PredicateCondition)
if buffer:
raise st.DeserializationError("Some input bytes were not read")
Expand All @@ -444,7 +449,6 @@ class PredicateCondition__Or(PredicateCondition):
INDEX = 2 # type: int
value: typing.Tuple["PredicateCondition", "PredicateCondition"]


PredicateCondition.VARIANTS = [
PredicateCondition__Value,
PredicateCondition__And,
Expand All @@ -459,7 +463,7 @@ def bincode_serialize(self) -> bytes:
return bincode.serialize(self, PreprocessAction)

@staticmethod
def bincode_deserialize(input: bytes) -> "PreprocessAction":
def bincode_deserialize(input: bytes) -> 'PreprocessAction':
v, buffer = bincode.deserialize(input, PreprocessAction)
if buffer:
raise st.DeserializationError("Some input bytes were not read")
Expand All @@ -477,7 +481,6 @@ class PreprocessAction__ModelPreprocessing(PreprocessAction):
INDEX = 1 # type: int
pass


PreprocessAction.VARIANTS = [
PreprocessAction__NoPreprocessing,
PreprocessAction__ModelPreprocessing,
Expand All @@ -491,7 +494,7 @@ def bincode_serialize(self) -> bytes:
return bincode.serialize(self, StoreInput)

@staticmethod
def bincode_deserialize(input: bytes) -> "StoreInput":
def bincode_deserialize(input: bytes) -> 'StoreInput':
v, buffer = bincode.deserialize(input, StoreInput)
if buffer:
raise st.DeserializationError("Some input bytes were not read")
Expand All @@ -509,8 +512,8 @@ class StoreInput__Image(StoreInput):
INDEX = 1 # type: int
value: typing.Sequence[st.uint8]


StoreInput.VARIANTS = [
StoreInput__RawString,
StoreInput__Image,
]

Loading

0 comments on commit 79cfcd4

Please sign in to comment.