Skip to content

Commit

Permalink
Release v0.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Feb 19, 2024
1 parent b140e4a commit 77ec3ed
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 178 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.7"
version = "v0.2.8"
description = ""
readme = "README.md"
authors = []
Expand Down
5 changes: 1 addition & 4 deletions src/superagent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from .types import (
AgentDatasosurceList,
AgentList,
AgentRunList,
AgentToolList,
AgentType,
AppModelsRequestApiUser,
Expand Down Expand Up @@ -60,13 +59,12 @@
WorkflowStepList,
)
from .errors import UnprocessableEntityError
from .resources import agent, api_user, datasource, llm, telemetry, tool, vector_database, workflow, workflow_config
from .resources import agent, api_user, datasource, llm, tool, vector_database, workflow, workflow_config
from .environment import SuperagentEnvironment

__all__ = [
"AgentDatasosurceList",
"AgentList",
"AgentRunList",
"AgentToolList",
"AgentType",
"AppModelsRequestApiUser",
Expand Down Expand Up @@ -127,7 +125,6 @@
"api_user",
"datasource",
"llm",
"telemetry",
"tool",
"vector_database",
"workflow",
Expand Down
3 changes: 0 additions & 3 deletions src/superagent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from .resources.api_user.client import ApiUserClient, AsyncApiUserClient
from .resources.datasource.client import AsyncDatasourceClient, DatasourceClient
from .resources.llm.client import AsyncLlmClient, LlmClient
from .resources.telemetry.client import AsyncTelemetryClient, TelemetryClient
from .resources.tool.client import AsyncToolClient, ToolClient
from .resources.vector_database.client import AsyncVectorDatabaseClient, VectorDatabaseClient
from .resources.workflow.client import AsyncWorkflowClient, WorkflowClient
Expand Down Expand Up @@ -40,7 +39,6 @@ def __init__(
self.workflow = WorkflowClient(client_wrapper=self._client_wrapper)
self.workflow_config = WorkflowConfigClient(client_wrapper=self._client_wrapper)
self.vector_database = VectorDatabaseClient(client_wrapper=self._client_wrapper)
self.telemetry = TelemetryClient(client_wrapper=self._client_wrapper)


class AsyncSuperagent:
Expand All @@ -66,7 +64,6 @@ def __init__(
self.workflow = AsyncWorkflowClient(client_wrapper=self._client_wrapper)
self.workflow_config = AsyncWorkflowConfigClient(client_wrapper=self._client_wrapper)
self.vector_database = AsyncVectorDatabaseClient(client_wrapper=self._client_wrapper)
self.telemetry = AsyncTelemetryClient(client_wrapper=self._client_wrapper)


def _get_base_url(*, base_url: typing.Optional[str] = None, environment: SuperagentEnvironment) -> str:
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.7",
"X-Fern-SDK-Version": "v0.2.8",
}
token = self._get_token()
if token is not None:
Expand Down
14 changes: 2 additions & 12 deletions src/superagent/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# This file was auto-generated by Fern from our API Definition.

from . import agent, api_user, datasource, llm, telemetry, tool, vector_database, workflow, workflow_config
from . import agent, api_user, datasource, llm, tool, vector_database, workflow, workflow_config

__all__ = [
"agent",
"api_user",
"datasource",
"llm",
"telemetry",
"tool",
"vector_database",
"workflow",
"workflow_config",
]
__all__ = ["agent", "api_user", "datasource", "llm", "tool", "vector_database", "workflow", "workflow_config"]
10 changes: 10 additions & 0 deletions src/superagent/resources/agent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def create(
avatar: typing.Optional[str] = OMIT,
type: typing.Optional[AgentType] = OMIT,
parameters: typing.Optional[OpenAiAssistantParameters] = OMIT,
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
) -> AppModelsResponseAgent:
"""
Create a new agent
Expand All @@ -96,6 +97,8 @@ def create(
- type: typing.Optional[AgentType].
- parameters: typing.Optional[OpenAiAssistantParameters].
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
"""
_request: typing.Dict[str, typing.Any] = {"name": name}
if is_active is not OMIT:
Expand All @@ -116,6 +119,8 @@ def create(
_request["type"] = type.value
if parameters is not OMIT:
_request["parameters"] = parameters
if metadata is not OMIT:
_request["metadata"] = metadata
_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 @@ -550,6 +555,7 @@ async def create(
avatar: typing.Optional[str] = OMIT,
type: typing.Optional[AgentType] = OMIT,
parameters: typing.Optional[OpenAiAssistantParameters] = OMIT,
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
) -> AppModelsResponseAgent:
"""
Create a new agent
Expand All @@ -574,6 +580,8 @@ async def create(
- type: typing.Optional[AgentType].
- parameters: typing.Optional[OpenAiAssistantParameters].
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
"""
_request: typing.Dict[str, typing.Any] = {"name": name}
if is_active is not OMIT:
Expand All @@ -594,6 +602,8 @@ async def create(
_request["type"] = type.value
if parameters is not OMIT:
_request["parameters"] = parameters
if metadata is not OMIT:
_request["metadata"] = metadata
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/agents"),
Expand Down
2 changes: 0 additions & 2 deletions src/superagent/resources/telemetry/__init__.py

This file was deleted.

123 changes: 0 additions & 123 deletions src/superagent/resources/telemetry/client.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/superagent/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from .agent_datasosurce_list import AgentDatasosurceList
from .agent_list import AgentList
from .agent_run_list import AgentRunList
from .agent_tool_list import AgentToolList
from .agent_type import AgentType
from .app_models_request_api_user import AppModelsRequestApiUser
Expand Down Expand Up @@ -63,7 +62,6 @@
__all__ = [
"AgentDatasosurceList",
"AgentList",
"AgentRunList",
"AgentToolList",
"AgentType",
"AppModelsRequestApiUser",
Expand Down
29 changes: 0 additions & 29 deletions src/superagent/types/agent_run_list.py

This file was deleted.

8 changes: 7 additions & 1 deletion src/superagent/types/agent_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@ class AgentType(str, enum.Enum):

SUPERAGENT = "SUPERAGENT"
OPENAI_ASSISTANT = "OPENAI_ASSISTANT"
LLM = "LLM"

def visit(
self, superagent: typing.Callable[[], T_Result], openai_assistant: typing.Callable[[], T_Result]
self,
superagent: typing.Callable[[], T_Result],
openai_assistant: typing.Callable[[], T_Result],
llm: typing.Callable[[], T_Result],
) -> T_Result:
if self is AgentType.SUPERAGENT:
return superagent()
if self is AgentType.OPENAI_ASSISTANT:
return openai_assistant()
if self is AgentType.LLM:
return llm()
8 changes: 8 additions & 0 deletions src/superagent/types/llm_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,24 @@ class LlmProvider(str, enum.Enum):
OPENAI = "OPENAI"
AZURE_OPENAI = "AZURE_OPENAI"
HUGGINGFACE = "HUGGINGFACE"
PERPLEXITY = "PERPLEXITY"
TOGETHER_AI = "TOGETHER_AI"

def visit(
self,
openai: typing.Callable[[], T_Result],
azure_openai: typing.Callable[[], T_Result],
huggingface: typing.Callable[[], T_Result],
perplexity: typing.Callable[[], T_Result],
together_ai: typing.Callable[[], T_Result],
) -> T_Result:
if self is LlmProvider.OPENAI:
return openai()
if self is LlmProvider.AZURE_OPENAI:
return azure_openai()
if self is LlmProvider.HUGGINGFACE:
return huggingface()
if self is LlmProvider.PERPLEXITY:
return perplexity()
if self is LlmProvider.TOGETHER_AI:
return together_ai()
4 changes: 4 additions & 0 deletions src/superagent/types/tool_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ToolType(str, enum.Enum):
HAND_OFF = "HAND_OFF"
FUNCTION = "FUNCTION"
HTTP = "HTTP"
SUPERRAG = "SUPERRAG"

def visit(
self,
Expand All @@ -50,6 +51,7 @@ def visit(
hand_off: typing.Callable[[], T_Result],
function: typing.Callable[[], T_Result],
http: typing.Callable[[], T_Result],
superrag: typing.Callable[[], T_Result],
) -> T_Result:
if self is ToolType.ALGOLIA:
return algolia()
Expand Down Expand Up @@ -87,3 +89,5 @@ def visit(
return function()
if self is ToolType.HTTP:
return http()
if self is ToolType.SUPERRAG:
return superrag()

0 comments on commit 77ec3ed

Please sign in to comment.