diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 266bce7..7703e9e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,9 +30,9 @@ jobs: - name: Run tests run: | poetry run coverage run -m unittest discover ./app/tests/ - poetry run coverage report -m + poetry run coverage report + poetry run coverage xml working-directory: ${{ github.workspace }} - name: Upload coverage report uses: codecov/codecov-action@v2 - diff --git a/README.md b/README.md index 475f9f4..f086c33 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![CI](https://github.com/weni-ai/SentenX/actions/workflows/ci.yaml/badge.svg)](https://github.com/weni-ai/SentenX/actions/workflows/ci.yaml) + # SentenX microservice that uses a sentence transformer model to index and search records. diff --git a/app/handlers/products.py b/app/handlers/products.py index d338bc7..db57766 100644 --- a/app/handlers/products.py +++ b/app/handlers/products.py @@ -1,8 +1,9 @@ from fastapi import APIRouter, HTTPException from fastapi.logger import logger +from pydantic import BaseModel + from app.handlers import IDocumentHandler from app.indexer import IDocumentIndexer -from pydantic import BaseModel class Product(BaseModel): diff --git a/app/indexer/products.py b/app/indexer/products.py index e0aaf91..fb3dd05 100644 --- a/app/indexer/products.py +++ b/app/indexer/products.py @@ -1,4 +1,5 @@ from langchain.docstore.document import Document + from app.handlers.products import Product from app.indexer import IDocumentIndexer from app.store import IStorage diff --git a/app/main.py b/app/main.py index c19ae5f..5558f05 100644 --- a/app/main.py +++ b/app/main.py @@ -1,3 +1,8 @@ +from fastapi import FastAPI +from langchain.embeddings import SagemakerEndpointEmbeddings, HuggingFaceHubEmbeddings +from langchain.embeddings.base import Embeddings +from langchain.vectorstores import ElasticVectorSearch, VectorStore + from app.handlers import IDocumentHandler from app.handlers.products import ProductsHandler from app.indexer import IDocumentIndexer @@ -6,11 +11,6 @@ from app.config import AppConfig from app.util import ContentHandler -from fastapi import FastAPI -from langchain.embeddings import SagemakerEndpointEmbeddings, HuggingFaceHubEmbeddings -from langchain.embeddings.base import Embeddings -from langchain.vectorstores import ElasticVectorSearch, VectorStore - class App: api: FastAPI diff --git a/app/store/elasticsearch_vector_store.py b/app/store/elasticsearch_vector_store.py index 766660b..e1e2038 100644 --- a/app/store/elasticsearch_vector_store.py +++ b/app/store/elasticsearch_vector_store.py @@ -1,5 +1,6 @@ from langchain.vectorstores import VectorStore from langchain.docstore.document import Document + from app.store import IStorage diff --git a/app/util.py b/app/util.py index 53c4b6d..f4be75f 100644 --- a/app/util.py +++ b/app/util.py @@ -1,4 +1,5 @@ import json + from langchain.embeddings.sagemaker_endpoint import EmbeddingsContentHandler