Skip to content

Commit

Permalink
fix(python-sdk): temporarily remove async types
Browse files Browse the repository at this point in the history
  • Loading branch information
philipbalbas committed Apr 16, 2024
1 parent 328e752 commit 34ec344
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
14 changes: 8 additions & 6 deletions sdks/python/julep/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def __init__(
self._client_wrapper = SyncClientWrapper(
base_url=_get_base_url(base_url=base_url, environment=environment),
api_key=api_key,
httpx_client=httpx.Client(timeout=timeout)
if httpx_client is None
else httpx_client,
httpx_client=(
httpx.Client(timeout=timeout) if httpx_client is None else httpx_client
),
)

def list_sessions(
Expand Down Expand Up @@ -1838,9 +1838,11 @@ def __init__(
self._client_wrapper = AsyncClientWrapper(
base_url=_get_base_url(base_url=base_url, environment=environment),
api_key=api_key,
httpx_client=httpx.AsyncClient(timeout=timeout)
if httpx_client is None
else httpx_client,
httpx_client=(
httpx.AsyncClient(timeout=timeout)
if httpx_client is None
else httpx_client
),
)

async def list_sessions(
Expand Down
14 changes: 7 additions & 7 deletions sdks/python/julep/api/types/chat_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ class ChatSettings(pydantic.BaseModel):
length_penalty: typing.Optional[float] = pydantic.Field(
description="(Huggingface-like) Number between 0 and 2.0. 1.0 is neutral and values larger than that penalize number of tokens generated."
)
logit_bias: typing.Optional[
typing.Dict[str, typing.Optional[int]]
] = pydantic.Field(
description=(
"Modify the likelihood of specified tokens appearing in the completion.\n"
"\n"
"Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n"
logit_bias: typing.Optional[typing.Dict[str, typing.Optional[int]]] = (
pydantic.Field(
description=(
"Modify the likelihood of specified tokens appearing in the completion.\n"
"\n"
"Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n"
)
)
)
max_tokens: typing.Optional[int] = pydantic.Field(
Expand Down
4 changes: 2 additions & 2 deletions sdks/python/julep/managers/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ async def get(self, id: Union[UUID, str]) -> Agent:
return await self._get(id=id)

@beartype
@rewrap_in_class(Agent)
# @rewrap_in_class(Agent)
async def create(self, **kwargs: AgentCreateArgs) -> Agent:
"""
Create a new resource asynchronously with specified details.
Expand Down Expand Up @@ -662,7 +662,7 @@ async def delete(self, agent_id: Union[str, UUID]):
return await self._delete(agent_id=agent_id)

@beartype
@rewrap_in_class(Agent)
# @rewrap_in_class(Agent)
async def update(
self, *, agent_id: Union[str, UUID], **kwargs: AgentUpdateArgs
) -> Agent:
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/julep/managers/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ async def list(
).items

@beartype
@rewrap_in_class(Doc)
# @rewrap_in_class(Doc)
async def create(self, **kwargs: DocsCreateArgs) -> Doc:
"""
Create a new resource asynchronously.
Expand Down
4 changes: 2 additions & 2 deletions sdks/python/julep/managers/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ async def get(self, id: Union[UUID, str]) -> Session:
return await self._get(id=id)

@beartype
@rewrap_in_class(Session)
# @rewrap_in_class(Session)
async def create(self, **kwargs: SessionCreateArgs) -> Session:
"""
Asynchronously create a resource with the specified user and agent identifiers.
Expand Down Expand Up @@ -915,7 +915,7 @@ async def delete(self, session_id: Union[str, UUID]):
return await self._delete(session_id=session_id)

@beartype
@rewrap_in_class(Session)
# @rewrap_in_class(Session)
async def update(
self,
**kwargs: SessionUpdateArgs,
Expand Down
4 changes: 2 additions & 2 deletions sdks/python/julep/managers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ async def get(self, id: Union[UUID, str]) -> User:
return await self._get(id=id)

@beartype
@rewrap_in_class(User)
# @rewrap_in_class(User)
async def create(self, **kwargs: UserCreateArgs) -> User:
"""
Asynchronously create a new resource with the provided name, description, and documents.
Expand Down Expand Up @@ -484,7 +484,7 @@ async def delete(
)

@beartype
@rewrap_in_class(User)
# @rewrap_in_class(User)
async def update(
self, *, user_id: Union[str, UUID], **kwargs: UserUpdateArgs
) -> User:
Expand Down
1 change: 0 additions & 1 deletion sdks/python/julep/managers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ async def async_wrapper(*args, **kwargs):
return cls.construct(**kwargs, **result.dict())

def sync_wrapper(*args, **kwargs):
print(kwargs) # Add this line to debug
result = func(*args, **kwargs)
return cls.construct(**kwargs, **result.dict())

Expand Down

0 comments on commit 34ec344

Please sign in to comment.