Skip to content

Commit

Permalink
Release v0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Feb 7, 2024
1 parent f72590f commit 7bec1b3
Show file tree
Hide file tree
Showing 15 changed files with 393 additions and 32 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "superagent-py"
version = "v0.2.0"
version = "v0.2.1"
description = ""
readme = "README.md"
authors = []
Expand Down
20 changes: 20 additions & 0 deletions src/superagent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
AgentRunList,
AgentToolList,
AgentType,
AppModelsRequestApiUser,
AppModelsRequestDatasource,
AppModelsRequestLlm,
AppModelsRequestTool,
Expand All @@ -24,11 +25,17 @@
DatasourceList,
DatasourceStatus,
DatasourceType,
FunctionDefinition,
HttpValidationError,
LlmList,
LlmModel,
LlmParams,
LlmProvider,
OpenAiAssistantParameters,
OpenAiAssistantParametersToolsItem,
OpenAiAssistantParametersToolsItem_CodeInterpreter,
OpenAiAssistantParametersToolsItem_Function,
OpenAiAssistantParametersToolsItem_Retrieval,
PrismaModelsAgent,
PrismaModelsAgentDatasource,
PrismaModelsAgentLlm,
Expand All @@ -40,6 +47,9 @@
PrismaModelsVectorDb,
PrismaModelsWorkflow,
PrismaModelsWorkflowStep,
ToolAssistantToolsCode,
ToolAssistantToolsFunction,
ToolAssistantToolsRetrieval,
ToolList,
ToolType,
ValidationError,
Expand All @@ -60,6 +70,7 @@
"AgentRunList",
"AgentToolList",
"AgentType",
"AppModelsRequestApiUser",
"AppModelsRequestDatasource",
"AppModelsRequestLlm",
"AppModelsRequestTool",
Expand All @@ -78,11 +89,17 @@
"DatasourceList",
"DatasourceStatus",
"DatasourceType",
"FunctionDefinition",
"HttpValidationError",
"LlmList",
"LlmModel",
"LlmParams",
"LlmProvider",
"OpenAiAssistantParameters",
"OpenAiAssistantParametersToolsItem",
"OpenAiAssistantParametersToolsItem_CodeInterpreter",
"OpenAiAssistantParametersToolsItem_Function",
"OpenAiAssistantParametersToolsItem_Retrieval",
"PrismaModelsAgent",
"PrismaModelsAgentDatasource",
"PrismaModelsAgentLlm",
Expand All @@ -95,6 +112,9 @@
"PrismaModelsWorkflow",
"PrismaModelsWorkflowStep",
"SuperagentEnvironment",
"ToolAssistantToolsCode",
"ToolAssistantToolsFunction",
"ToolAssistantToolsRetrieval",
"ToolList",
"ToolType",
"UnprocessableEntityError",
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.2.0",
"X-Fern-SDK-Version": "v0.2.1",
}
token = self._get_token()
if token is not None:
Expand Down
38 changes: 20 additions & 18 deletions src/superagent/resources/agent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
from ...types.agent_datasosurce_list import AgentDatasosurceList
from ...types.agent_list import AgentList
from ...types.agent_tool_list import AgentToolList
from ...types.agent_type import AgentType
from ...types.app_models_response_agent import AppModelsResponseAgent
from ...types.app_models_response_agent_invoke import AppModelsResponseAgentInvoke
from ...types.http_validation_error import HttpValidationError
from ...types.llm_params import LlmParams
from ...types.llm_provider import LlmProvider
from ...types.open_ai_assistant_parameters import OpenAiAssistantParameters

try:
import pydantic.v1 as pydantic # type: ignore
Expand Down Expand Up @@ -62,14 +64,14 @@ def create(
*,
is_active: typing.Optional[bool] = OMIT,
name: str,
type: typing.Optional[str] = OMIT,
initial_message: typing.Optional[str] = OMIT,
prompt: typing.Optional[str] = OMIT,
llm_model: typing.Optional[str] = OMIT,
llm_provider: typing.Optional[LlmProvider] = OMIT,
description: typing.Optional[str] = OMIT,
avatar: typing.Optional[str] = OMIT,
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
type: typing.Optional[AgentType] = OMIT,
parameters: typing.Optional[OpenAiAssistantParameters] = OMIT,
) -> AppModelsResponseAgent:
"""
Create a new agent
Expand All @@ -79,8 +81,6 @@ def create(
- name: str.
- type: typing.Optional[str].
- initial_message: typing.Optional[str].
- prompt: typing.Optional[str].
Expand All @@ -93,13 +93,13 @@ def create(
- avatar: typing.Optional[str].
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
- type: typing.Optional[AgentType].
- parameters: typing.Optional[OpenAiAssistantParameters].
"""
_request: typing.Dict[str, typing.Any] = {"name": name}
if is_active is not OMIT:
_request["isActive"] = is_active
if type is not OMIT:
_request["type"] = type
if initial_message is not OMIT:
_request["initialMessage"] = initial_message
if prompt is not OMIT:
Expand All @@ -112,8 +112,10 @@ def create(
_request["description"] = description
if avatar is not OMIT:
_request["avatar"] = avatar
if metadata is not OMIT:
_request["metadata"] = metadata
if type is not OMIT:
_request["type"] = type.value
if parameters is not OMIT:
_request["parameters"] = parameters
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/agents"),
Expand Down Expand Up @@ -540,14 +542,14 @@ async def create(
*,
is_active: typing.Optional[bool] = OMIT,
name: str,
type: typing.Optional[str] = OMIT,
initial_message: typing.Optional[str] = OMIT,
prompt: typing.Optional[str] = OMIT,
llm_model: typing.Optional[str] = OMIT,
llm_provider: typing.Optional[LlmProvider] = OMIT,
description: typing.Optional[str] = OMIT,
avatar: typing.Optional[str] = OMIT,
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
type: typing.Optional[AgentType] = OMIT,
parameters: typing.Optional[OpenAiAssistantParameters] = OMIT,
) -> AppModelsResponseAgent:
"""
Create a new agent
Expand All @@ -557,8 +559,6 @@ async def create(
- name: str.
- type: typing.Optional[str].
- initial_message: typing.Optional[str].
- prompt: typing.Optional[str].
Expand All @@ -571,13 +571,13 @@ async def create(
- avatar: typing.Optional[str].
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
- type: typing.Optional[AgentType].
- parameters: typing.Optional[OpenAiAssistantParameters].
"""
_request: typing.Dict[str, typing.Any] = {"name": name}
if is_active is not OMIT:
_request["isActive"] = is_active
if type is not OMIT:
_request["type"] = type
if initial_message is not OMIT:
_request["initialMessage"] = initial_message
if prompt is not OMIT:
Expand All @@ -590,8 +590,10 @@ async def create(
_request["description"] = description
if avatar is not OMIT:
_request["avatar"] = avatar
if metadata is not OMIT:
_request["metadata"] = metadata
if type is not OMIT:
_request["type"] = type.value
if parameters is not OMIT:
_request["parameters"] = parameters
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/agents"),
Expand Down
61 changes: 55 additions & 6 deletions src/superagent/resources/api_user/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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_request_api_user import AppModelsRequestApiUser
from ...types.app_models_response_api_user import AppModelsResponseApiUser
from ...types.http_validation_error import HttpValidationError

Expand All @@ -24,17 +25,17 @@ class ApiUserClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper

def create(self, *, email: str) -> AppModelsResponseApiUser:
def create(self, *, request: AppModelsRequestApiUser) -> AppModelsResponseApiUser:
"""
Create a new API user
Parameters:
- email: str.
- request: AppModelsRequestApiUser.
"""
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/api-users"),
json=jsonable_encoder({"email": email}),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down Expand Up @@ -84,22 +85,46 @@ def delete(self) -> typing.Any:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def indentify(self, *, request: AppModelsRequestApiUser) -> typing.Any:
"""
Indentify an api user
Parameters:
- request: AppModelsRequestApiUser.
"""
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/api-users/identify"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)


class AsyncApiUserClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper

async def create(self, *, email: str) -> AppModelsResponseApiUser:
async def create(self, *, request: AppModelsRequestApiUser) -> AppModelsResponseApiUser:
"""
Create a new API user
Parameters:
- email: str.
- request: AppModelsRequestApiUser.
"""
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/api-users"),
json=jsonable_encoder({"email": email}),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down Expand Up @@ -148,3 +173,27 @@ async def delete(self) -> typing.Any:
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def indentify(self, *, request: AppModelsRequestApiUser) -> typing.Any:
"""
Indentify an api user
Parameters:
- request: AppModelsRequestApiUser.
"""
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/api-users/identify"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
Loading

0 comments on commit 7bec1b3

Please sign in to comment.