Skip to content

Commit

Permalink
Release 0.1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Nov 6, 2023
1 parent a7dce5d commit 2a7b673
Show file tree
Hide file tree
Showing 41 changed files with 201 additions and 85 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "superagent-py"
version = "v0.1.22"
version = "v0.1.23"
description = ""
readme = "README.md"
authors = []
Expand All @@ -11,7 +11,7 @@ packages = [
[tool.poetry.dependencies]
python = "^3.7"
httpx = ">=0.21.2"
pydantic = "^1.9.2"
pydantic = ">= 1.9.2, < 3"

[tool.poetry.dev-dependencies]
mypy = "0.971"
Expand Down
2 changes: 1 addition & 1 deletion src/superagent/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "superagent-py",
"X-Fern-SDK-Version": "v0.1.22",
"X-Fern-SDK-Version": "v0.1.23",
}
token = self._get_token()
if token is not None:
Expand Down
14 changes: 8 additions & 6 deletions src/superagent/core/jsonable_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
from types import GeneratorType
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union

from pydantic import BaseModel
from pydantic.json import ENCODERS_BY_TYPE
try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore

from .datetime_utils import serialize_datetime

Expand All @@ -34,7 +36,7 @@ def generate_encoders_by_class_tuples(
return encoders_by_class_tuples


encoders_by_class_tuples = generate_encoders_by_class_tuples(ENCODERS_BY_TYPE)
encoders_by_class_tuples = generate_encoders_by_class_tuples(pydantic.json.ENCODERS_BY_TYPE)


def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any:
Expand All @@ -46,7 +48,7 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any]
for encoder_type, encoder_instance in custom_encoder.items():
if isinstance(obj, encoder_type):
return encoder_instance(obj)
if isinstance(obj, BaseModel):
if isinstance(obj, pydantic.BaseModel):
encoder = getattr(obj.__config__, "json_encoders", {})
if custom_encoder:
encoder.update(custom_encoder)
Expand Down Expand Up @@ -82,8 +84,8 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any]
encoded_list.append(jsonable_encoder(item, custom_encoder=custom_encoder))
return encoded_list

if type(obj) in ENCODERS_BY_TYPE:
return ENCODERS_BY_TYPE[type(obj)](obj)
if type(obj) in pydantic.json.ENCODERS_BY_TYPE:
return pydantic.json.ENCODERS_BY_TYPE[type(obj)](obj)
for encoder, classes_tuple in encoders_by_class_tuples.items():
if isinstance(obj, classes_tuple):
return encoder(obj)
Expand Down
7 changes: 5 additions & 2 deletions src/superagent/resources/agent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import urllib.parse
from json.decoder import JSONDecodeError

import pydantic

from ...core.api_error import ApiError
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ...core.jsonable_encoder import jsonable_encoder
Expand All @@ -19,6 +17,11 @@
from ...types.app_models_response_agent_invoke import AppModelsResponseAgentInvoke
from ...types.http_validation_error import HttpValidationError

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)

Expand Down
7 changes: 5 additions & 2 deletions src/superagent/resources/api_user/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
import urllib.parse
from json.decoder import JSONDecodeError

import pydantic

from ...core.api_error import ApiError
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ...core.jsonable_encoder import jsonable_encoder
from ...errors.unprocessable_entity_error import UnprocessableEntityError
from ...types.app_models_response_api_user import AppModelsResponseApiUser
from ...types.http_validation_error import HttpValidationError

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)

Expand Down
7 changes: 5 additions & 2 deletions src/superagent/resources/datasource/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import urllib.parse
from json.decoder import JSONDecodeError

import pydantic

from ...core.api_error import ApiError
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ...core.jsonable_encoder import jsonable_encoder
Expand All @@ -15,6 +13,11 @@
from ...types.datasource_list import DatasourceList
from ...types.http_validation_error import HttpValidationError

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)

Expand Down
7 changes: 5 additions & 2 deletions src/superagent/resources/llm/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import urllib.parse
from json.decoder import JSONDecodeError

import pydantic

from ...core.api_error import ApiError
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ...core.jsonable_encoder import jsonable_encoder
Expand All @@ -15,6 +13,11 @@
from ...types.http_validation_error import HttpValidationError
from ...types.llm_list import LlmList

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)

Expand Down
7 changes: 5 additions & 2 deletions src/superagent/resources/tool/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import urllib.parse
from json.decoder import JSONDecodeError

import pydantic

from ...core.api_error import ApiError
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ...core.jsonable_encoder import jsonable_encoder
Expand All @@ -15,6 +13,11 @@
from ...types.http_validation_error import HttpValidationError
from ...types.tool_list import ToolList

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)

Expand Down
7 changes: 5 additions & 2 deletions src/superagent/resources/workflow/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import urllib.parse
from json.decoder import JSONDecodeError

import pydantic

from ...core.api_error import ApiError
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ...core.jsonable_encoder import jsonable_encoder
Expand All @@ -15,6 +13,11 @@
from ...types.http_validation_error import HttpValidationError
from ...types.workflow_list import WorkflowList

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)

Expand Down
7 changes: 5 additions & 2 deletions src/superagent/types/agent_datasosurce_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime
from .prisma_models_agent_datasource import PrismaModelsAgentDatasource

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AgentDatasosurceList(pydantic.BaseModel):
success: bool
Expand Down
7 changes: 5 additions & 2 deletions src/superagent/types/agent_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime
from .prisma_models_agent import PrismaModelsAgent

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AgentList(pydantic.BaseModel):
success: bool
Expand Down
7 changes: 5 additions & 2 deletions src/superagent/types/agent_run_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AgentRunList(pydantic.BaseModel):
success: bool
Expand Down
7 changes: 5 additions & 2 deletions src/superagent/types/agent_tool_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime
from .prisma_models_agent_tool import PrismaModelsAgentTool

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AgentToolList(pydantic.BaseModel):
success: bool
Expand Down
7 changes: 5 additions & 2 deletions src/superagent/types/app_models_request_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AppModelsRequestAgent(pydantic.BaseModel):
is_active: typing.Optional[bool] = pydantic.Field(alias="isActive")
Expand Down
7 changes: 5 additions & 2 deletions src/superagent/types/app_models_request_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AppModelsRequestDatasource(pydantic.BaseModel):
name: str
Expand Down
7 changes: 5 additions & 2 deletions src/superagent/types/app_models_request_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AppModelsRequestLlm(pydantic.BaseModel):
provider: str
Expand Down
7 changes: 5 additions & 2 deletions src/superagent/types/app_models_request_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AppModelsRequestTool(pydantic.BaseModel):
name: str
Expand Down
7 changes: 5 additions & 2 deletions src/superagent/types/app_models_request_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AppModelsRequestWorkflow(pydantic.BaseModel):
name: str
Expand Down
7 changes: 5 additions & 2 deletions src/superagent/types/app_models_response_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime
from .prisma_models_agent import PrismaModelsAgent

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AppModelsResponseAgent(pydantic.BaseModel):
success: bool
Expand Down
7 changes: 5 additions & 2 deletions src/superagent/types/app_models_response_agent_invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AppModelsResponseAgentInvoke(pydantic.BaseModel):
success: bool
Expand Down
7 changes: 5 additions & 2 deletions src/superagent/types/app_models_response_api_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime
from .prisma_models_api_user import PrismaModelsApiUser

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AppModelsResponseApiUser(pydantic.BaseModel):
success: bool
Expand Down
Loading

0 comments on commit 2a7b673

Please sign in to comment.