thomas commited on
Commit ·
2b38366
1
Parent(s): c24b9a6
feature(#15_phone): fixed lint issues
Browse files
src/model/basic_model.py
CHANGED
|
@@ -11,4 +11,4 @@ class BasicModel:
|
|
| 11 |
class DataStatus:
|
| 12 |
CREATED = "created"
|
| 13 |
UPDATED = "updated"
|
| 14 |
-
DELETED = "deleted"
|
|
|
|
| 11 |
class DataStatus:
|
| 12 |
CREATED = "created"
|
| 13 |
UPDATED = "updated"
|
| 14 |
+
DELETED = "deleted"
|
src/model/image_model.py
CHANGED
|
@@ -12,4 +12,4 @@ class ImageModel:
|
|
| 12 |
self.status = DataStatus.CREATED
|
| 13 |
|
| 14 |
def to_json(self) -> Any:
|
| 15 |
-
return {"image_name": self.image_name, "image_text": self.image_text}
|
|
|
|
| 12 |
self.status = DataStatus.CREATED
|
| 13 |
|
| 14 |
def to_json(self) -> Any:
|
| 15 |
+
return {"image_name": self.image_name, "image_text": self.image_text}
|
src/rising_plugin/image_embedding.py
CHANGED
|
@@ -3,7 +3,9 @@ from langchain.embeddings.openai import OpenAIEmbeddings
|
|
| 3 |
from ..common.utils import OPENAI_API_KEY, PINECONE_NAMESPACE, PINECONE_INDEX_NAME
|
| 4 |
from .pinecone_engine import (
|
| 5 |
init_pinecone,
|
| 6 |
-
get_pinecone_index_namespace,
|
|
|
|
|
|
|
| 7 |
)
|
| 8 |
from ..model.basic_model import DataStatus
|
| 9 |
from ..model.image_model import ImageModel
|
|
@@ -36,7 +38,9 @@ def embed_image_text(image: ImageModel) -> str:
|
|
| 36 |
elif image.status == DataStatus.DELETED:
|
| 37 |
delete_pinecone(namespace=pinecone_namespace, key=image.image_name)
|
| 38 |
elif image.status == DataStatus.UPDATED:
|
| 39 |
-
update_pinecone(
|
|
|
|
|
|
|
| 40 |
except Exception as e:
|
| 41 |
return "fail to embed image text"
|
| 42 |
return "success to embed image text"
|
|
|
|
| 3 |
from ..common.utils import OPENAI_API_KEY, PINECONE_NAMESPACE, PINECONE_INDEX_NAME
|
| 4 |
from .pinecone_engine import (
|
| 5 |
init_pinecone,
|
| 6 |
+
get_pinecone_index_namespace,
|
| 7 |
+
delete_pinecone,
|
| 8 |
+
update_pinecone,
|
| 9 |
)
|
| 10 |
from ..model.basic_model import DataStatus
|
| 11 |
from ..model.image_model import ImageModel
|
|
|
|
| 38 |
elif image.status == DataStatus.DELETED:
|
| 39 |
delete_pinecone(namespace=pinecone_namespace, key=image.image_name)
|
| 40 |
elif image.status == DataStatus.UPDATED:
|
| 41 |
+
update_pinecone(
|
| 42 |
+
namespace=pinecone_namespace, key=image.image_name, value=embed_image
|
| 43 |
+
)
|
| 44 |
except Exception as e:
|
| 45 |
return "fail to embed image text"
|
| 46 |
return "success to embed image text"
|