Skip to content

Commit

Permalink
[FIX]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye Gomez authored and Kye Gomez committed Aug 15, 2024
1 parent 24355f6 commit 0109abd
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 175 deletions.
4 changes: 2 additions & 2 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from swarms import Agent, OpenAIChat
from swarms.utils.loguru_logger import logger
from swarms_cloud.schema.cog_vlm_schemas import ChatCompletionResponse, UsageInfo
from agent_api_schemas import (
from swarms_cloud.schema.agent_api_schemas import (
AgentInput,
AgentOutput,
ModelList,
Expand Down Expand Up @@ -127,7 +127,7 @@ async def create_agent(request: Request, agent_input: AgentInput):
# Dict
agent_dict = agent.to_dict()

creation_log = {
{
"Timestamp": time.time(),
"Agent": agent_dict,
"IP": request.client.host,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "swarms-cloud"
version = "0.3.2"
version = "0.3.4"
description = "Swarms Cloud - Pytorch"
license = "MIT"
authors = ["Kye Gomez <[email protected]>"]
Expand Down
86 changes: 3 additions & 83 deletions swarms_cloud/__init__.py
Original file line number Diff line number Diff line change
@@ -1,83 +1,3 @@
from swarms_cloud.check_model_list import (
create_error_response,
)
from swarms_cloud.utils.calculate_pricing import calculate_pricing, count_tokens
from swarms_cloud.loggers.log_api_request_to_supabase import (
ModelAPILogEntry,
log_to_supabase,
)
from swarms_cloud.schema.openai_protocol import ( # noqa: E501
ChatCompletionRequest,
ChatCompletionRequestQos,
ChatCompletionResponse,
ChatCompletionResponseChoice,
ChatCompletionResponseStreamChoice,
ChatCompletionStreamResponse,
ChatMessage,
CompletionRequest,
CompletionRequestQos,
CompletionResponse,
CompletionResponseChoice,
CompletionResponseStreamChoice,
CompletionStreamResponse,
DeltaMessage,
EmbeddingsRequest,
EncodeRequest,
EncodeResponse,
ErrorResponse,
GenerateRequest,
GenerateRequestQos,
GenerateResponse,
GenerationConfig,
ModelCard,
ModelList,
ModelPermission,
UsageInfo,
)
from swarms_cloud.schema.openai_spec import (
InputOpenAISpec,
OpenAIAPIWrapper,
OutputOpenAISpec,
)
from swarms_cloud.utils.api_key_generator import generate_api_key
from swarms_cloud.utils.rate_limiter import rate_limiter
from swarms_cloud.models import *

__all__ = [
"create_error_response",
"calculate_pricing",
"count_tokens",
"ModelAPILogEntry",
"log_to_supabase",
"ChatCompletionRequest",
"ChatCompletionRequestQos",
"ChatCompletionResponse",
"ChatCompletionResponseChoice",
"ChatCompletionResponseStreamChoice",
"ChatCompletionStreamResponse",
"ChatMessage",
"CompletionRequest",
"CompletionRequestQos",
"CompletionResponse",
"CompletionResponseChoice",
"CompletionResponseStreamChoice",
"CompletionStreamResponse",
"DeltaMessage",
"EmbeddingsRequest",
"EncodeRequest",
"EncodeResponse",
"ErrorResponse",
"GenerateRequest",
"GenerateRequestQos",
"GenerateResponse",
"GenerationConfig",
"ModelCard",
"ModelList",
"ModelPermission",
"UsageInfo",
"InputOpenAISpec",
"OpenAIAPIWrapper",
"OutputOpenAISpec",
"generate_api_key",
"rate_limiter",
]
from swarms_cloud.utils import *
from swarms_cloud.schema import *
from swarms_cloud.loggers import *
9 changes: 9 additions & 0 deletions swarms_cloud/loggers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from swarms_cloud.loggers.log_api_request_to_supabase import (
ModelAPILogEntry,
log_to_supabase,
)

__all__ = [
"ModelAPILogEntry",
"log_to_supabase",
]
3 changes: 0 additions & 3 deletions swarms_cloud/models/__init__.py

This file was deleted.

79 changes: 0 additions & 79 deletions swarms_cloud/models/pali_gemma.py

This file was deleted.

67 changes: 64 additions & 3 deletions swarms_cloud/schema/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,75 @@
from agent_api_schemas import (
from swarms_cloud.schema.agent_api_schemas import (
AgentInput,
AgentOutput,
ModelList,
ModelSchema,
)
from swarms_cloud.schema.openai_protocol import ( # noqa: E501
ChatCompletionRequest,
ChatCompletionRequestQos,
ChatCompletionResponse,
ChatCompletionResponseChoice,
ChatCompletionResponseStreamChoice,
ChatCompletionStreamResponse,
ChatMessage,
CompletionRequest,
CompletionRequestQos,
CompletionResponse,
CompletionResponseChoice,
CompletionResponseStreamChoice,
CompletionStreamResponse,
DeltaMessage,
EmbeddingsRequest,
EncodeRequest,
EncodeResponse,
ErrorResponse,
GenerateRequest,
GenerateRequestQos,
GenerateResponse,
GenerationConfig,
ModelCard,
ModelList,
AgentOutput,
ModelPermission,
UsageInfo,
)
from swarms_cloud.schema.openai_spec import (
InputOpenAISpec,
OpenAIAPIWrapper,
OutputOpenAISpec,
)


__all__ = [
"AgentInput",
"ModelSchema",
"ModelList",
"AgentOutput",
"ChatCompletionRequest",
"ChatCompletionRequestQos",
"ChatCompletionResponse",
"ChatCompletionResponseChoice",
"ChatCompletionResponseStreamChoice",
"ChatCompletionStreamResponse",
"ChatMessage",
"CompletionRequest",
"CompletionRequestQos",
"CompletionResponse",
"CompletionResponseChoice",
"CompletionResponseStreamChoice",
"CompletionStreamResponse",
"DeltaMessage",
"EmbeddingsRequest",
"EncodeRequest",
"EncodeResponse",
"ErrorResponse",
"GenerateRequest",
"GenerateRequestQos",
"GenerateResponse",
"GenerationConfig",
"ModelCard",
"ModelList",
"ModelPermission",
"UsageInfo",
"InputOpenAISpec",
"OpenAIAPIWrapper",
"OutputOpenAISpec",
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

from swarms_cloud.schema.cog_vlm_schemas import (
AgentChatCompletionResponse,
ChatCompletionResponseChoice,
ChatCompletionResponse,
ChatMessageResponse,
)


Expand Down Expand Up @@ -133,4 +130,3 @@ class ParallelSwarmAPIOutput(BaseModel):
)
created_at: int = time.time()
owned_by: str = "TGSC"

14 changes: 14 additions & 0 deletions swarms_cloud/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from swarms_cloud.utils.api_key_generator import generate_api_key
from swarms_cloud.utils.calculate_pricing import calculate_pricing, count_tokens
from swarms_cloud.utils.rate_limiter import rate_limiter
from swarms_cloud.utils.check_model_list import (
create_error_response,
)

__all__ = [
"generate_api_key",
"calculate_pricing",
"count_tokens",
"rate_limiter",
"create_error_response",
]
File renamed without changes.

0 comments on commit 0109abd

Please sign in to comment.