Skip to content

Commit

Permalink
feat: added None as default value + added more types
Browse files Browse the repository at this point in the history
  • Loading branch information
csgulati09 committed Dec 2, 2024
1 parent 6e9a3ec commit 2760bc6
Show file tree
Hide file tree
Showing 19 changed files with 401 additions and 345 deletions.
54 changes: 27 additions & 27 deletions portkey_ai/api_resources/types/api_keys_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@


class ApiKeyAddResponse(BaseModel, extra="allow"):
id: Optional[str]
key: Optional[str]
object: Optional[str]
id: Optional[str] = None
key: Optional[str] = None
object: Optional[str] = None
_headers: Optional[httpx.Headers] = PrivateAttr()

def get_headers(self) -> Optional[Dict[str, str]]:
Expand All @@ -25,24 +25,24 @@ def get(self, key: str, default: Optional[Any] = None):


class ApiKeyGetResponse(BaseModel, extra="allow"):
id: Optional[str]
key: Optional[str]
name: Optional[str]
description: Optional[str]
type: Optional[str]
organisation_id: Optional[str]
workspace_id: Optional[str]
user_id: Optional[str]
status: Optional[str]
created_at: Optional[str]
last_updated_at: Optional[str]
creation_mode: Optional[str]
rate_limits: Optional[List[Dict[str, Any]]]
usage_limits: Optional[Dict[str, Any]]
reset_usage: Optional[int]
scopes: Optional[List[str]]
defaults: Optional[Dict[str, Any]]
object: Optional[str]
id: Optional[str] = None
key: Optional[str] = None
name: Optional[str] = None
description: Optional[str] = None
type: Optional[str] = None
organisation_id: Optional[str] = None
workspace_id: Optional[str] = None
user_id: Optional[str] = None
status: Optional[str] = None
created_at: Optional[str] = None
last_updated_at: Optional[str] = None
creation_mode: Optional[str] = None
rate_limits: Optional[List[Dict[str, Any]]] = None
usage_limits: Optional[Dict[str, Any]] = None
reset_usage: Optional[int] = None
scopes: Optional[List[str]] = None
defaults: Optional[Dict[str, Any]] = None
object: Optional[str] = None
_headers: Optional[httpx.Headers] = PrivateAttr()

def get_headers(self) -> Optional[Dict[str, str]]:
Expand All @@ -59,9 +59,9 @@ def get(self, key: str, default: Optional[Any] = None):


class ApiKeyListResponse(BaseModel, extra="allow"):
object: Optional[str]
total: Optional[int]
data: Optional[List[Dict[str, Any]]]
object: Optional[str] = None
total: Optional[int] = None
data: Optional[List[Dict[str, Any]]] = None
_headers: Optional[httpx.Headers] = PrivateAttr()

def get_headers(self) -> Optional[Dict[str, str]]:
Expand All @@ -78,9 +78,9 @@ def get(self, key: str, default: Optional[Any] = None):


class ApiKeyUpdateResponse(BaseModel, extra="allow"):
object: Optional[str]
total: Optional[int]
data: Optional[List[Dict[str, Any]]]
object: Optional[str] = None
total: Optional[int] = None
data: Optional[List[Dict[str, Any]]] = None
_headers: Optional[httpx.Headers] = PrivateAttr()

def get_headers(self) -> Optional[Dict[str, str]]:
Expand Down
22 changes: 11 additions & 11 deletions portkey_ai/api_resources/types/assistant_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@


class ToolCodeInterpreter(BaseModel, extra="allow"):
type: Optional[str]
type: Optional[str] = None


class ToolRetrieval(BaseModel, extra="allow"):
type: Optional[str]
type: Optional[str] = None


class ToolFunction(BaseModel, extra="allow"):
type: Optional[str]
type: Optional[str] = None


Tool = Union[ToolCodeInterpreter, ToolRetrieval, ToolFunction]


class Assistant(BaseModel, extra="allow"):
id: Optional[str]
created_at: Optional[int]
id: Optional[str] = None
created_at: Optional[int] = None
description: Optional[str] = None
file_ids: Optional[List[str]] = None
instructions: Optional[str] = None
metadata: Optional[object] = None
model: Optional[str]
model: Optional[str] = None
name: Optional[str] = None
object: Optional[str]
object: Optional[str] = None
tools: Optional[List[Tool]]
_headers: Optional[httpx.Headers] = PrivateAttr()

Expand All @@ -59,7 +59,7 @@ def get_headers(self) -> Optional[Dict[str, str]]:


class AssistantList(BaseModel, extra="allow"):
object: Optional[str]
object: Optional[str] = None
data: Optional[List[Assistant]]
_headers: Optional[httpx.Headers] = PrivateAttr()

Expand All @@ -78,9 +78,9 @@ def get_headers(self) -> Optional[Dict[str, str]]:


class AssistantDeleted(BaseModel, extra="allow"):
id: Optional[str]
object: Optional[str]
deleted: Optional[bool]
id: Optional[str] = None
object: Optional[str] = None
deleted: Optional[bool] = None
_headers: Optional[httpx.Headers] = PrivateAttr()

def __str__(self):
Expand Down
32 changes: 16 additions & 16 deletions portkey_ai/api_resources/types/chat_complete_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@


class TopLogprob(BaseModel, extra="allow"):
token: Optional[str]
token: Optional[str] = None
bytes: Optional[List[int]] = None
logprob: Optional[float]
logprob: Optional[float] = None


class ChatCompletionTokenLogprob(BaseModel, extra="allow"):
token: Optional[str]
token: Optional[str] = None
bytes: Optional[List[int]] = None
logprob: Optional[float]
logprob: Optional[float] = None
top_logprobs: Optional[List[TopLogprob]]


Expand All @@ -53,7 +53,7 @@ class DeltaToolCallFunction(BaseModel, extra="allow"):


class DeltaToolCall(BaseModel, extra="allow"):
index: Optional[int]
index: Optional[int] = None
id: Optional[str] = None
function: Optional[DeltaToolCallFunction] = None
type: Optional[str] = None
Expand Down Expand Up @@ -83,37 +83,37 @@ def __getitem__(self, key):


class FunctionCall(BaseModel, extra="allow"):
arguments: Optional[str]
name: Optional[str]
arguments: Optional[str] = None
name: Optional[str] = None


class ChatCompletionMessageToolCall(BaseModel, extra="allow"):
id: Optional[str]
id: Optional[str] = None
function: Optional[FunctionCall]
type: Optional[str]
type: Optional[str] = None


class ChatCompletionMessage(BaseModel, extra="allow"):
content: Optional[Union[str, Iterable[Any]]] = None
role: Optional[str]
role: Optional[str] = None
function_call: Optional[FunctionCall] = None
tool_calls: Optional[List[ChatCompletionMessageToolCall]] = None
refusal: Optional[str] = None


class Choice(BaseModel, extra="allow"):
finish_reason: Optional[str]
index: Optional[int]
finish_reason: Optional[str] = None
index: Optional[int] = None
logprobs: Optional[ChoiceLogprobs] = None
message: Optional[ChatCompletionMessage]


class ChatCompletions(BaseModel, extra="allow"):
id: Optional[str]
id: Optional[str] = None
choices: Optional[List[Choice]]
created: Optional[int]
model: Optional[str]
object: Optional[str]
created: Optional[int] = None
model: Optional[str] = None
object: Optional[str] = None
system_fingerprint: Optional[str] = None
usage: Optional[Usage] = None
service_tier: Optional[str] = None
Expand Down
20 changes: 10 additions & 10 deletions portkey_ai/api_resources/types/complete_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@


class CompletionUsage(BaseModel, extra="allow"):
completion_tokens: Optional[int]
prompt_tokens: Optional[int]
total_tokens: Optional[int]
completion_tokens: Optional[int] = None
prompt_tokens: Optional[int] = None
total_tokens: Optional[int] = None


class Logprobs(BaseModel, extra="allow"):
Expand All @@ -22,18 +22,18 @@ class Logprobs(BaseModel, extra="allow"):


class CompletionChoice(BaseModel, extra="allow"):
finish_reason: Optional[str]
index: Optional[int]
finish_reason: Optional[str] = None
index: Optional[int] = None
logprobs: Optional[Logprobs] = None
text: Optional[str]
text: Optional[str] = None


class TextCompletion(BaseModel, extra="allow"):
id: Optional[str]
id: Optional[str] = None
choices: List[CompletionChoice]
created: Optional[int]
model: Optional[str]
object: Optional[str]
created: Optional[int] = None
model: Optional[str] = None
object: Optional[str] = None
system_fingerprint: Optional[str] = None
usage: Optional[CompletionUsage] = None
_headers: Optional[httpx.Headers] = PrivateAttr()
Expand Down
48 changes: 24 additions & 24 deletions portkey_ai/api_resources/types/configs_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@


class ConfigAddResponse(BaseModel, extra="allow"):
id: Optional[str]
version_id: Optional[str]
slug: Optional[str]
object: Optional[str]
id: Optional[str] = None
version_id: Optional[str] = None
slug: Optional[str] = None
object: Optional[str] = None
_headers: Optional[httpx.Headers] = PrivateAttr()

def get_headers(self) -> Optional[Dict[str, str]]:
Expand All @@ -26,22 +26,22 @@ def get(self, key: str, default: Optional[Any] = None):


class ConfigGetResponse(BaseModel, extra="allow"):
id: Optional[str]
id: Optional[str] = None
organisation_id: Optional[str] = None
config: Optional[Union[str, dict]]
name: Optional[str]
workspace_id: Optional[str]
slug: Optional[str]
is_default: Optional[int]
status: Optional[str]
owner_id: Optional[str]
created_at: Optional[str]
updated_by: Optional[str]
last_updated_at: Optional[str]
format: Optional[str]
type: Optional[str]
version_id: Optional[str]
object: Optional[str]
config: Optional[Union[str, dict]] = None
name: Optional[str] = None
workspace_id: Optional[str] = None
slug: Optional[str] = None
is_default: Optional[int] = None
status: Optional[str] = None
owner_id: Optional[str] = None
created_at: Optional[str] = None
updated_by: Optional[str] = None
last_updated_at: Optional[str] = None
format: Optional[str] = None
type: Optional[str] = None
version_id: Optional[str] = None
object: Optional[str] = None
_headers: Optional[httpx.Headers] = PrivateAttr()

def get_headers(self) -> Optional[Dict[str, str]]:
Expand All @@ -58,9 +58,9 @@ def get(self, key: str, default: Optional[Any] = None):


class ConfigListResponse(BaseModel, extra="allow"):
object: Optional[str]
total: Optional[int]
data: Optional[List[Dict[str, Any]]]
object: Optional[str] = None
total: Optional[int] = None
data: Optional[List[Dict[str, Any]]] = None

_headers: Optional[httpx.Headers] = PrivateAttr()

Expand All @@ -78,8 +78,8 @@ def get(self, key: str, default: Optional[Any] = None):


class ConfigUpdateResponse(BaseModel, extra="allow"):
version_id: Optional[str]
object: Optional[str]
version_id: Optional[str] = None
object: Optional[str] = None
_headers: Optional[httpx.Headers] = PrivateAttr()

def get_headers(self) -> Optional[Dict[str, str]]:
Expand Down
8 changes: 4 additions & 4 deletions portkey_ai/api_resources/types/embeddings_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ class Usage(BaseModel, extra="allow"):

class Embedding(BaseModel, extra="allow"):
embedding: Union[List[float], str]
index: Optional[int]
object: Optional[str]
index: Optional[int] = None
object: Optional[str] = None


class CreateEmbeddingResponse(BaseModel, extra="allow"):
success: Optional[bool] = None
warning: Optional[str] = None
data: List[Embedding]
model: Optional[str]
object: Optional[str]
model: Optional[str] = None
object: Optional[str] = None
usage: Usage
_headers: Optional[httpx.Headers] = PrivateAttr()

Expand Down
6 changes: 3 additions & 3 deletions portkey_ai/api_resources/types/feedback_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@


class FeedbackResponse(BaseModel, extra="allow"):
status: Optional[str]
message: Optional[str]
feedback_ids: Optional[List[str]]
status: Optional[str] = None
message: Optional[str] = None
feedback_ids: Optional[List[str]] = None
4 changes: 2 additions & 2 deletions portkey_ai/api_resources/types/generation_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ def get(self, key: str, default: Optional[Any] = None):


class Function(BaseModel, extra="allow"):
name: Optional[str]
name: Optional[str] = None
description: Optional[str] = None
parameters: Optional[FunctionParameters] = None


class Tool(BaseModel, extra="allow"):
function: Function
type: Optional[str]
type: Optional[str] = None


class PromptRenderData(BaseModel, extra="allow"):
Expand Down
2 changes: 1 addition & 1 deletion portkey_ai/api_resources/types/image_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Image(BaseModel, extra="allow"):


class ImagesResponse(BaseModel, extra="allow"):
created: Optional[int]
created: Optional[int] = None
data: List[Image]
_headers: Optional[httpx.Headers] = PrivateAttr()

Expand Down
Loading

0 comments on commit 2760bc6

Please sign in to comment.