Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityrail authored and mkorpela committed Apr 16, 2024
1 parent 5187be0 commit 8536933
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/app/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
Arxiv,
AvailableTools,
Connery,
DallE,
DDGSearch,
PressReleases,
PubMed,
Retrieval,
DallE,
SecFilings,
Tavily,
TavilyAnswer,
Expand Down
18 changes: 11 additions & 7 deletions backend/app/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,26 @@
from langchain.pydantic_v1 import BaseModel, Field
from langchain.tools.retriever import create_retriever_tool
from langchain_community.agent_toolkits.connery import ConneryToolkit
from langchain_core.tools import Tool
from langchain_community.retrievers.kay import KayAiRetriever
from langchain_community.retrievers.pubmed import PubMedRetriever
from langchain_community.retrievers.wikipedia import WikipediaRetriever
from langchain_community.retrievers.you import YouRetriever
from langchain_community.tools.ddg_search.tool import DuckDuckGoSearchRun
from langchain_community.tools.arxiv.tool import ArxivQueryRun
from langchain_community.tools.connery import ConneryService
from langchain_community.tools.ddg_search.tool import DuckDuckGoSearchRun
from langchain_community.tools.tavily_search import (
TavilyAnswer as _TavilyAnswer,
)
from langchain_community.tools.tavily_search import (
TavilySearchResults,
)
from langchain_community.utilities.arxiv import ArxivAPIWrapper
from langchain_community.utilities.tavily_search import TavilySearchAPIWrapper
from langchain_community.utilities.dalle_image_generator import DallEAPIWrapper
from langchain_community.utilities.tavily_search import TavilySearchAPIWrapper
from langchain_core.tools import Tool
from langchain_robocorp import ActionServerToolkit
from typing_extensions import TypedDict


from app.upload import vstore


Expand All @@ -40,6 +39,7 @@ class ArxivInput(BaseModel):
class PythonREPLInput(BaseModel):
query: str = Field(description="python command to run")


class DallEInput(BaseModel):
query: str = Field(description="image description to generate image from")

Expand All @@ -60,8 +60,7 @@ class AvailableTools(str, Enum):
DALL_E = "dall_e"


class ToolConfig(TypedDict):
...
class ToolConfig(TypedDict): ...


class BaseTool(BaseModel):
Expand Down Expand Up @@ -193,7 +192,10 @@ class Retrieval(BaseTool):
class DallE(BaseTool):
type: AvailableTools = Field(AvailableTools.DALL_E, const=True)
name: str = Field("Generate Image (Dall-E)", const=True)
description: str = Field("Generates images from a text description using OpenAI's DALL-E model.", const=True)
description: str = Field(
"Generates images from a text description using OpenAI's DALL-E model.",
const=True,
)


RETRIEVAL_DESCRIPTION = """Can be used to look up information that was uploaded to this assistant.
Expand Down Expand Up @@ -296,6 +298,7 @@ def _get_connery_actions():
tools = connery_toolkit.get_tools()
return tools


@lru_cache(maxsize=1)
def _get_dalle_tools():
return Tool(
Expand All @@ -304,6 +307,7 @@ def _get_dalle_tools():
"A wrapper around OpenAI DALL-E API. Useful for when you need to generate images from a text description. Input should be an image description.",
)


TOOLS = {
AvailableTools.ACTION_SERVER: _get_action_server,
AvailableTools.CONNERY: _get_connery_actions,
Expand Down

0 comments on commit 8536933

Please sign in to comment.