Skip to content

Commit

Permalink
Run poe check
Browse files Browse the repository at this point in the history
  • Loading branch information
HamadaSalhab committed Sep 25, 2024
1 parent 8e0de53 commit 00a198e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 14 deletions.
9 changes: 6 additions & 3 deletions integrations-service/integrations/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from .dalle_image_generator import DalleImageGeneratorArguments, DalleImageGeneratorSetup
from .dalle_image_generator import (
DalleImageGeneratorArguments,
DalleImageGeneratorSetup,
)
from .duckduckgo_search import DuckDuckGoSearchExecutionArguments
from .weather import WeatherExecutionArguments, WeatherExecutionSetup
from .wikipedia import WikipediaExecutionArguments
from .hacker_news import HackerNewsExecutionArguments

# TODO: Move these models somewhere else
Expand All @@ -12,3 +13,5 @@
IntegrationExecutionRequest,
IntegrationExecutionResponse,
)
from .weather import WeatherExecutionArguments, WeatherExecutionSetup
from .wikipedia import WikipediaExecutionArguments
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from pydantic import BaseModel, Field


class DalleImageGeneratorSetup(BaseModel):
api_key: str = Field(str, description="The API key for DALL-E")


class DalleImageGeneratorArguments(BaseModel):
prompt: str = Field(str, description="The image generation prompt")
4 changes: 1 addition & 3 deletions integrations-service/integrations/models/hacker_news.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@


class HackerNewsExecutionArguments(BaseModel):
url: str = Field(
..., description="The URL of the Hacker News thread to fetch"
)
url: str = Field(..., description="The URL of the Hacker News thread to fetch")
9 changes: 6 additions & 3 deletions integrations-service/integrations/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

from pydantic import BaseModel

from .dalle_image_generator import DalleImageGeneratorArguments, DalleImageGeneratorSetup
from .dalle_image_generator import (
DalleImageGeneratorArguments,
DalleImageGeneratorSetup,
)
from .duckduckgo_search import DuckDuckGoSearchExecutionArguments
from .wikipedia import WikipediaExecutionArguments
from .weather import WeatherExecutionSetup, WeatherExecutionArguments
from .hacker_news import HackerNewsExecutionArguments
from .weather import WeatherExecutionArguments, WeatherExecutionSetup
from .wikipedia import WikipediaExecutionArguments

ExecuteIntegrationArguments = Union[
WikipediaExecutionArguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
@router.post("/execute/{provider}", tags=["execution"])
async def execute(
provider: str = Path(..., description="The integration provider"),
request: IntegrationExecutionRequest = Body(..., description="The integration execution request")
request: IntegrationExecutionRequest = Body(
..., description="The integration execution request"
),
) -> IntegrationExecutionResponse:
try:
result = await execute_integration(provider, request.setup, request.arguments)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from ..models import ExecuteIntegrationArguments, ExecuteIntegrationSetup
from .integrations.dalle_image_generator import dalle_image_generator
from .integrations.duckduckgo_search import duckduckgo_search
from .integrations.wikipedia import wikipedia
from .integrations.weather import weather
from .integrations.hacker_news import hacker_news
from .integrations.weather import weather
from .integrations.wikipedia import wikipedia


async def execute_integration(
provider: str, setup: ExecuteIntegrationSetup | None, arguments: ExecuteIntegrationArguments
provider: str,
setup: ExecuteIntegrationSetup | None,
arguments: ExecuteIntegrationArguments,
) -> str:
match provider:
case "duckduckgo_search":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ async def send_mail(arguments: dict) -> str:
Dummy integration for sending an email to a specified recipient with a given subject and message.
"""

return "Mail sent"
return "Mail sent"

0 comments on commit 00a198e

Please sign in to comment.