Skip to content

Commit

Permalink
chore: format imports (#22)
Browse files Browse the repository at this point in the history
Co-authored-by: leoguillaume <[email protected]>
  • Loading branch information
leoguillaume and leoguillaumegouv authored Sep 24, 2024
1 parent 4fe3e0a commit 3208baa
Show file tree
Hide file tree
Showing 26 changed files with 57 additions and 121 deletions.
14 changes: 7 additions & 7 deletions app/endpoints/chat.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import httpx
import json
from typing import Union

from fastapi import APIRouter, Security, HTTPException
from fastapi import APIRouter, HTTPException, Security
from fastapi.responses import StreamingResponse
import httpx

from app.schemas.chat import ChatCompletionRequest, ChatCompletion, ChatCompletionChunk
from app.utils.security import check_api_key
from app.utils.lifespan import clients
from app.utils.config import LOGGER
from app.schemas.chat import ChatCompletion, ChatCompletionChunk, ChatCompletionRequest
from app.schemas.config import LANGUAGE_MODEL_TYPE
from app.tools import *
from app.tools import __all__ as tools_list
from app.schemas.config import LANGUAGE_MODEL_TYPE
from app.utils.config import LOGGER
from app.utils.lifespan import clients
from app.utils.security import check_api_key

router = APIRouter()

Expand Down
6 changes: 3 additions & 3 deletions app/endpoints/chunks.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from fastapi import APIRouter, Security
from qdrant_client.http.models import Filter, HasIdCondition

from app.schemas.chunks import Chunks, Chunk, ChunkRequest
from app.utils.security import check_api_key
from app.utils.lifespan import clients
from app.helpers._vectorstore import VectorStore
from app.schemas.chunks import Chunk, ChunkRequest, Chunks
from app.utils.lifespan import clients
from app.utils.security import check_api_key

router = APIRouter()

Expand Down
14 changes: 7 additions & 7 deletions app/endpoints/collections.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from typing import Union, Optional
from typing import Optional, Union

from fastapi import APIRouter, Security, Response
from fastapi import APIRouter, Response, Security

from app.schemas.collections import Collections, Collection
from app.utils.security import check_api_key
from app.utils.lifespan import clients
from app.utils.data import delete_contents
from app.utils.config import LOGGER
from app.helpers import VectorStore
from app.schemas.collections import Collection, Collections
from app.utils.config import LOGGER
from app.utils.data import delete_contents
from app.utils.lifespan import clients
from app.utils.security import check_api_key

router = APIRouter()

Expand Down
1 change: 0 additions & 1 deletion app/endpoints/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from app.utils.lifespan import clients
from app.utils.security import check_api_key


router = APIRouter()


Expand Down
6 changes: 3 additions & 3 deletions app/endpoints/embeddings.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from fastapi import APIRouter, Security, HTTPException
from fastapi import APIRouter, HTTPException, Security

from app.schemas.embeddings import EmbeddingsRequest, Embeddings
from app.schemas.config import EMBEDDINGS_MODEL_TYPE
from app.schemas.embeddings import Embeddings, EmbeddingsRequest
from app.utils.lifespan import clients
from app.utils.security import check_api_key
from app.schemas.config import EMBEDDINGS_MODEL_TYPE

router = APIRouter()

Expand Down
2 changes: 1 addition & 1 deletion app/endpoints/files.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import base64
import uuid
from typing import List, Optional, Union
import uuid

from botocore.exceptions import ClientError
from fastapi import APIRouter, HTTPException, Response, Security, UploadFile
Expand Down
3 changes: 1 addition & 2 deletions app/endpoints/models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from typing import Union, Optional
from typing import Optional, Union

from fastapi import APIRouter, Security

from app.schemas.models import Model, Models
from app.utils.lifespan import clients
from app.utils.security import check_api_key


router = APIRouter()


Expand Down
2 changes: 1 addition & 1 deletion app/endpoints/search.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from fastapi import APIRouter, Security

from app.helpers import VectorStore
from app.schemas.search import SearchRequest, Searches
from app.schemas.search import Searches, SearchRequest
from app.utils.lifespan import clients
from app.utils.security import check_api_key

Expand Down
2 changes: 1 addition & 1 deletion app/endpoints/tools.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from fastapi import APIRouter, Security

from app.schemas.tools import Tools
from app.utils.security import check_api_key
from app.tools import *
from app.tools import __all__ as tools_list
from app.utils.security import check_api_key

router = APIRouter()

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/_gristkeymanager.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime as dt

from grist_api import GristDocAPI
from fastapi import HTTPException
from grist_api import GristDocAPI
from redis import Redis


Expand Down
5 changes: 3 additions & 2 deletions app/helpers/_universalparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
from typing import List, Optional

from docx import Document
from langchain.docstore.document import Document as LangchainDocument
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_community.document_loaders import PDFMinerLoader
from langchain.docstore.document import Document as LangchainDocument
import magic

from ._textcleaner import TextCleaner
from app.schemas.files import JsonFile

from ._textcleaner import TextCleaner


class UniversalParser:
DOCX_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
Expand Down
2 changes: 1 addition & 1 deletion app/schemas/chunks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Literal, List
from typing import List, Literal

from pydantic import BaseModel

Expand Down
4 changes: 2 additions & 2 deletions app/schemas/completions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional, List, Union, Dict, Iterable
from typing import Dict, Iterable, List, Optional, Union

from pydantic import BaseModel, Field
from openai.types import Completion
from pydantic import BaseModel, Field


class CompletionRequest(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions app/schemas/embeddings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional, Literal, List, Union
from typing import List, Literal, Optional, Union

from pydantic import BaseModel
from openai.types import CreateEmbeddingResponse
from pydantic import BaseModel


class EmbeddingsRequest(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion app/schemas/files.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Literal, List, Optional, Dict
from typing import Dict, List, Literal, Optional
from uuid import UUID

from pydantic import BaseModel
Expand Down
6 changes: 3 additions & 3 deletions app/schemas/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Literal, List
from typing import List, Literal

from pydantic import BaseModel
from openai.types import Model
from pydantic import BaseModel

from app.schemas.config import LANGUAGE_MODEL_TYPE, EMBEDDINGS_MODEL_TYPE
from app.schemas.config import EMBEDDINGS_MODEL_TYPE, LANGUAGE_MODEL_TYPE


class Model(Model):
Expand Down
2 changes: 1 addition & 1 deletion app/schemas/tools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Literal, List
from typing import List, Literal

from pydantic import BaseModel

Expand Down
3 changes: 2 additions & 1 deletion app/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging

import pytest
import requests
import logging


def pytest_addoption(parser):
Expand Down
11 changes: 6 additions & 5 deletions app/tests/test_files.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import os
import logging
import os

import pytest
import wget

from app.schemas.files import Upload, Uploads, Files, File
from app.schemas.collections import Collections, Collection
from app.schemas.models import Models, Model
from app.schemas.config import PRIVATE_COLLECTION_TYPE, METADATA_COLLECTION, LANGUAGE_MODEL_TYPE, EMBEDDINGS_MODEL_TYPE
from app.schemas.collections import Collection, Collections
from app.schemas.config import EMBEDDINGS_MODEL_TYPE, LANGUAGE_MODEL_TYPE, METADATA_COLLECTION, PRIVATE_COLLECTION_TYPE
from app.schemas.files import File, Files, Upload, Uploads
from app.schemas.models import Model, Models
from app.utils.security import encode_string


Expand Down
2 changes: 1 addition & 1 deletion app/tests/test_tools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from app.schemas.tools import Tools, Tool
from app.schemas.tools import Tool, Tools


@pytest.mark.usefixtures("args", "session")
Expand Down
6 changes: 3 additions & 3 deletions app/tests/tools/test_baserag.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import os
import logging
import os

import pytest
import wget

from app.schemas.config import EMBEDDINGS_MODEL_TYPE, LANGUAGE_MODEL_TYPE
from app.schemas.models import Models, Model
from app.schemas.chat import ChatCompletion
from app.schemas.config import EMBEDDINGS_MODEL_TYPE, LANGUAGE_MODEL_TYPE
from app.schemas.models import Model, Models


@pytest.mark.usefixtures("args", "session")
Expand Down
3 changes: 1 addition & 2 deletions app/tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from ._baserag import BaseRAG
from ._fewshots import FewShots

__all__ = ["BaseRAG", "FewShots"]
__all__ = ["BaseRAG"]
64 changes: 0 additions & 64 deletions app/tools/_fewshots.py

This file was deleted.

Empty file removed app/utils/assertations.py
Empty file.
4 changes: 2 additions & 2 deletions app/utils/lifespan.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import time
from contextlib import asynccontextmanager
from functools import partial
import time
from typing import Dict, List

import requests
from fastapi import FastAPI, HTTPException
from openai import OpenAI
import requests

from app.schemas.config import EMBEDDINGS_MODEL_TYPE, LANGUAGE_MODEL_TYPE, METADATA_COLLECTION
from app.schemas.models import Model, Models
Expand Down
8 changes: 4 additions & 4 deletions app/utils/security.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Annotated
import hashlib
import base64
import hashlib
from typing import Annotated

from fastapi import HTTPException, Depends
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
from fastapi import Depends, HTTPException
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer

from app.utils.lifespan import clients

Expand Down

0 comments on commit 3208baa

Please sign in to comment.