Skip to content

Commit

Permalink
remove type ignoring
Browse files Browse the repository at this point in the history
  • Loading branch information
saminegash committed Jul 22, 2024
1 parent 4fe6968 commit d3016fe
Show file tree
Hide file tree
Showing 33 changed files with 115 additions and 115 deletions.
8 changes: 4 additions & 4 deletions demo/blog_writer/actions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from langchain_community.document_loaders import PDFMinerLoader # type: ignore
from langchain_community.vectorstores import Chroma # type: ignore
from langchain_text_splitters import SentenceTransformersTokenTextSplitter # type: ignore
from loguru import logger # type: ignore
from langchain_community.document_loaders import PDFMinerLoader
from langchain_community.vectorstores import Chroma
from langchain_text_splitters import SentenceTransformersTokenTextSplitter
from loguru import logger

from sherpa_ai.actions.base import BaseAction

Expand Down
8 changes: 4 additions & 4 deletions demo/blog_writer/outliner.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import os
import time

import tiktoken # type: ignore
from langchain_community.chat_models import ChatOpenAI # type: ignore
from langchain_core.prompts import (ChatPromptTemplate, # type: ignore
import tiktoken
from langchain_community.chat_models import ChatOpenAI
from langchain_core.prompts import (ChatPromptTemplate,
HumanMessagePromptTemplate,
SystemMessagePromptTemplate)
from langchain_text_splitters import MarkdownTextSplitter # type: ignore
from langchain_text_splitters import MarkdownTextSplitter


class Outliner:
Expand Down
2 changes: 1 addition & 1 deletion demo/question_answering/qa_demo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from argparse import ArgumentParser

from langchain_core.messages import HumanMessage # type: ignore
from langchain_core.messages import HumanMessage
from slackapp.utils import get_qa_agent_from_config_file

import sherpa_ai.config as cfg
Expand Down
2 changes: 1 addition & 1 deletion demo/software_modeler/modeler_demo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from argparse import ArgumentParser

from langchain_core.messages import HumanMessage # type: ignore
from langchain_core.messages import HumanMessage
from slackapp.utils import get_qa_agent_from_config_file

import sherpa_ai.config as cfg
Expand Down
14 changes: 7 additions & 7 deletions src/apps/slackapp/slackapp/bolt_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import time
from typing import Dict, List, Optional

from flask import Flask, request # type: ignore
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage # type: ignore
from loguru import logger # type: ignore
from omegaconf import OmegaConf # type: ignore
from slack_bolt import App # type: ignore
from slack_bolt.adapter.flask import SlackRequestHandler # type: ignore
from flask import Flask, request
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage
from loguru import logger
from omegaconf import OmegaConf
from slack_bolt import App
from slack_bolt.adapter.flask import SlackRequestHandler
from slackapp.routes.whitelist import whitelist_blueprint
from slackapp.utils import get_qa_agent_from_config_file

Expand All @@ -27,7 +27,7 @@
from sherpa_ai.post_processors import md_link_to_slack
from sherpa_ai.scrape.file_scraper import QuestionWithFileHandler
from sherpa_ai.scrape.prompt_reconstructor import PromptReconstructor
from sherpa_ai.task_agent import TaskAgent # type: ignore
from sherpa_ai.task_agent import TaskAgent
from sherpa_ai.tools import get_tools
from sherpa_ai.utils import count_string_tokens, log_formatter, show_commands_only
from sherpa_ai.verbose_loggers import DummyVerboseLogger, SlackVerboseLogger
Expand Down
6 changes: 3 additions & 3 deletions src/apps/slackapp/slackapp/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Optional

from hydra.utils import instantiate # type: ignore
from langchain_core.language_models import BaseLanguageModel # type: ignore
from omegaconf import OmegaConf # type: ignore
from hydra.utils import instantiate
from langchain_core.language_models import BaseLanguageModel
from omegaconf import OmegaConf

from sherpa_ai.agents.qa_agent import QAAgent
from sherpa_ai.config.task_config import AgentConfig
Expand Down
6 changes: 3 additions & 3 deletions src/apps/slackapp/tests/test_get_response.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from datetime import datetime
from unittest.mock import MagicMock

import pytest # type: ignore
from langchain_community.llms import FakeListLLM # type: ignore
from loguru import logger # type: ignore
import pytest
from langchain_community.llms import FakeListLLM
from loguru import logger
from slackapp.bolt_app import get_response

import sherpa_ai.config as cfg
Expand Down
4 changes: 2 additions & 2 deletions src/sherpa_ai/actions/synthesize.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any

from langchain_core.language_models import BaseLanguageModel # type: ignore
from loguru import logger # type: ignore
from langchain_core.language_models import BaseLanguageModel
from loguru import logger

from sherpa_ai.actions.base import BaseAction

Expand Down
4 changes: 2 additions & 2 deletions src/sherpa_ai/agents/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, List, Optional

from langchain_core.language_models import BaseLanguageModel # type: ignore
from loguru import logger # type: ignore
from langchain_core.language_models import BaseLanguageModel
from loguru import logger

from sherpa_ai.actions.base import BaseAction, BaseRetrievalAction
from sherpa_ai.events import EventType
Expand Down
4 changes: 2 additions & 2 deletions src/sherpa_ai/agents/critic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import List, Optional

from langchain_core.language_models import BaseChatModel # type: ignore
from loguru import logger # type: ignore
from langchain_core.language_models import BaseChatModel
from loguru import logger

from sherpa_ai.agents.base import BaseAgent
from sherpa_ai.events import EventType
Expand Down
2 changes: 1 addition & 1 deletion src/sherpa_ai/agents/ml_engineer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Optional

from langchain_core.language_models import BaseLanguageModel # type: ignore
from langchain_core.language_models import BaseLanguageModel

from sherpa_ai.actions import Deliberation, GoogleSearch, SynthesizeOutput
from sherpa_ai.actions.arxiv_search import ArxivSearch
Expand Down
2 changes: 1 addition & 1 deletion src/sherpa_ai/agents/physicist.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Optional

from langchain_core.language_models import BaseLanguageModel # type: ignore
from langchain_core.language_models import BaseLanguageModel

from sherpa_ai.actions import Deliberation, GoogleSearch, SynthesizeOutput
from sherpa_ai.actions.base import BaseAction
Expand Down
4 changes: 2 additions & 2 deletions src/sherpa_ai/agents/planner.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional

from langchain_core.language_models import LLM # type: ignore
from loguru import logger # type: ignore
from langchain_core.language_models import LLM
from loguru import logger

from sherpa_ai.actions.planning import TaskPlanning
from sherpa_ai.agents.agent_pool import AgentPool
Expand Down
2 changes: 1 addition & 1 deletion src/sherpa_ai/agents/qa_agent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Optional

from langchain_core.language_models import BaseLanguageModel # type: ignore
from langchain_core.language_models import BaseLanguageModel

from sherpa_ai.actions import GoogleSearch, SynthesizeOutput
from sherpa_ai.actions.base import BaseAction
Expand Down
2 changes: 1 addition & 1 deletion src/sherpa_ai/connectors/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from abc import ABC, abstractmethod
from typing import List

from langchain_core.documents import Document # type: ignore
from langchain_core.documents import Document


class BaseVectorDB(ABC):
Expand Down
8 changes: 4 additions & 4 deletions src/sherpa_ai/connectors/chroma_vector_store.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import uuid

import chromadb # type: ignore
from chromadb.utils import embedding_functions # type: ignore
from langchain_core.documents import Document # type: ignore
from langchain_text_splitters import CharacterTextSplitter # type: ignore
import chromadb
from chromadb.utils import embedding_functions
from langchain_core.documents import Document
from langchain_text_splitters import CharacterTextSplitter

import sherpa_ai.config as cfg
from sherpa_ai.connectors.base import BaseVectorDB
Expand Down
12 changes: 6 additions & 6 deletions src/sherpa_ai/connectors/scripts/query_chroma.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import json
import uuid

import chromadb # type: ignore
from chromadb.config import Settings # type: ignore
from dotenv import load_dotenv # type: ignore
from langchain_openai import OpenAIEmbeddings # type: ignore
from langchain_community.vectorstores import Chroma # type: ignore
from loguru import logger # type: ignore
import chromadb
from chromadb.config import Settings
from dotenv import load_dotenv
from langchain_openai import OpenAIEmbeddings
from langchain_community.vectorstores import Chroma
from loguru import logger


def main(args):
Expand Down
18 changes: 9 additions & 9 deletions src/sherpa_ai/connectors/vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
import uuid
from typing import Any, Iterable, List, Optional, Tuple, Type

import chromadb # type: ignore
import pinecone # type: ignore
from langchain_community.vectorstores import Chroma # type: ignore
from langchain_core.documents import Document # type: ignore
from langchain_core.embeddings import Embeddings # type: ignore
from langchain_core.vectorstores import ( # type: ignore
import chromadb
import pinecone
from langchain_community.vectorstores import Chroma
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.vectorstores import (
VectorStore,
VectorStoreRetriever,
)
from langchain_openai import OpenAIEmbeddings # type: ignore
from langchain_openai import OpenAIEmbeddings

from langchain_text_splitters import CharacterTextSplitter # type: ignore
from loguru import logger # type: ignore
from langchain_text_splitters import CharacterTextSplitter
from loguru import logger

import sherpa_ai.config as cfg
from sherpa_ai.utils import load_files
Expand Down
2 changes: 1 addition & 1 deletion src/sherpa_ai/memory/shared_memory_with_vectordb.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Optional

from langchain_openai import OpenAIEmbeddings # type: ignore
from langchain_openai import OpenAIEmbeddings

from sherpa_ai.actions.planning import Plan

Expand Down
12 changes: 6 additions & 6 deletions src/sherpa_ai/models/chat_model_with_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
import typing
from typing import Any, Coroutine, List, Optional

from langchain_core.callbacks import ( # type: ignore
from langchain_core.callbacks import (
AsyncCallbackManagerForLLMRun,
CallbackManagerForLLMRun,
)
from langchain_core.language_models import BaseChatModel # type: ignore
from langchain_core.messages import BaseMessage # type: ignore
from langchain_core.outputs import ChatResult # type: ignore
from loguru import logger # type: ignore
from langchain_core.language_models import BaseChatModel
from langchain_core.messages import BaseMessage
from langchain_core.outputs import ChatResult
from loguru import logger


class ChatModelWithLogging(BaseChatModel):
llm: BaseChatModel
logger: type(logger) # type: ignore
logger: type(logger)

@property
def _llm_type(self):
Expand Down
10 changes: 5 additions & 5 deletions src/sherpa_ai/models/sherpa_base_chat_model.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import typing
from typing import Any, List, Optional

from langchain_openai import ChatOpenAI # type: ignore
from langchain_core.callbacks import ( # type: ignore
from langchain_openai import ChatOpenAI
from langchain_core.callbacks import (
AsyncCallbackManagerForLLMRun,
CallbackManagerForLLMRun,
)
from langchain_core.language_models import BaseChatModel # type: ignore
from langchain_core.messages import BaseMessage # type: ignore
from langchain_core.outputs import ChatResult # type: ignore
from langchain_core.language_models import BaseChatModel
from langchain_core.messages import BaseMessage
from langchain_core.outputs import ChatResult

from sherpa_ai.database.user_usage_tracker import UserUsageTracker
from sherpa_ai.verbose_loggers.base import BaseVerboseLogger
Expand Down
12 changes: 6 additions & 6 deletions src/sherpa_ai/models/sherpa_base_model.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import typing
from typing import Any, List, Optional

from langchain_openai import ChatOpenAI # type: ignore
from langchain_core.callbacks import ( # type: ignore
from langchain_openai import ChatOpenAI
from langchain_core.callbacks import (
AsyncCallbackManagerForLLMRun,
CallbackManagerForLLMRun,
)
from langchain_core.language_models import BaseChatModel # type: ignore
from langchain_core.messages import BaseMessage # type: ignore
from langchain_core.outputs import ChatResult # type: ignore
from pydantic import BaseModel # type: ignore
from langchain_core.language_models import BaseChatModel
from langchain_core.messages import BaseMessage
from langchain_core.outputs import ChatResult
from pydantic import BaseModel

from sherpa_ai.database.user_usage_tracker import UserUsageTracker

Expand Down
4 changes: 2 additions & 2 deletions src/sherpa_ai/orchestrator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import List, Optional

from langchain_openai import ChatOpenAI # type: ignore
from pydantic import BaseModel # type: ignore
from langchain_openai import ChatOpenAI
from pydantic import BaseModel

from sherpa_ai.actions.planning import Plan
from sherpa_ai.agents import AgentPool, Critic, MLEngineer, Physicist, Planner
Expand Down
2 changes: 1 addition & 1 deletion src/sherpa_ai/output_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import abstractmethod
from typing import Dict, NamedTuple

from langchain_core.output_parsers import BaseOutputParser # type: ignore
from langchain_core.output_parsers import BaseOutputParser


class TaskAction(NamedTuple):
Expand Down
2 changes: 1 addition & 1 deletion src/sherpa_ai/output_parsers/entity_validation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from enum import Enum
from typing import Tuple

from langchain_core.language_models import BaseLanguageModel # type: ignore
from langchain_core.language_models import BaseLanguageModel

from sherpa_ai.events import EventType
from sherpa_ai.memory import Belief
Expand Down
10 changes: 5 additions & 5 deletions src/sherpa_ai/prompt.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import time
from typing import Any, Callable, List

from langchain_core.messages import ( # type: ignore
from langchain_core.messages import (
AIMessage,
BaseMessage,
HumanMessage,
SystemMessage,
)
from langchain_core.prompts import BaseChatPromptTemplate # type: ignore
from langchain_core.vectorstores import VectorStoreRetriever # type: ignore
from loguru import logger # type: ignore
from pydantic import BaseModel # type: ignore
from langchain_core.prompts import BaseChatPromptTemplate
from langchain_core.vectorstores import VectorStoreRetriever
from loguru import logger
from pydantic import BaseModel

from sherpa_ai.prompt_generator import get_prompt
from sherpa_ai.tools import BaseTool
Expand Down
2 changes: 1 addition & 1 deletion src/sherpa_ai/prompt_generator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from typing import List

from langchain_core.tools import BaseTool # type: ignore
from langchain_core.tools import BaseTool


FINISH_NAME = "finish"
Expand Down
8 changes: 4 additions & 4 deletions src/sherpa_ai/reflection.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from os import environ
from typing import List

from langchain_core.language_models import BaseLanguageModel # type: ignore
from langchain_core.messages import BaseMessage # type: ignore
from langchain_core.tools import BaseTool # type: ignore
from loguru import logger # type: ignore
from langchain_core.language_models import BaseLanguageModel
from langchain_core.messages import BaseMessage
from langchain_core.tools import BaseTool
from loguru import logger

from sherpa_ai.prompt_generator import PromptGenerator

Expand Down
8 changes: 4 additions & 4 deletions src/sherpa_ai/scrape/extract_github_readme.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import base64
import re

import pinecone # type: ignore
import pinecone
import requests
from dotenv import dotenv_values # type: ignore
from langchain_openai import OpenAIEmbeddings # type: ignore
from loguru import logger # type: ignore
from dotenv import dotenv_values
from langchain_openai import OpenAIEmbeddings
from loguru import logger

import sherpa_ai.config as cfg
from sherpa_ai.connectors.vectorstores import ConversationStore
Expand Down
Loading

0 comments on commit d3016fe

Please sign in to comment.