Spaces:
Sleeping
Sleeping
Commit
·
638f225
1
Parent(s):
3fdba15
only support str or list[str] for product data
Browse files- app/schemas/requests.py +1 -1
- app/services/base.py +1 -1
- app/services/service_anthropic.py +1 -1
- app/services/service_openai.py +1 -1
- app/utils/converter.py +4 -1
app/schemas/requests.py
CHANGED
@@ -18,7 +18,7 @@ class ExtractionRequest(BaseModel):
|
|
18 |
img_urls: Optional[List[str]] = None
|
19 |
product_taxonomy: str
|
20 |
request_meta: Optional[Dict[str, str]] = None
|
21 |
-
product_data: Optional[Dict[str, Union[str, List]]] = None
|
22 |
ai_model: str = settings.DEFAULT_MODEL # type: ignore
|
23 |
max_attempts: int = settings.DEFAULT_MAX_ATTEMPTS # type: ignore
|
24 |
|
|
|
18 |
img_urls: Optional[List[str]] = None
|
19 |
product_taxonomy: str
|
20 |
request_meta: Optional[Dict[str, str]] = None
|
21 |
+
product_data: Optional[Dict[str, Union[str, List[str]]]] = None
|
22 |
ai_model: str = settings.DEFAULT_MODEL # type: ignore
|
23 |
max_attempts: int = settings.DEFAULT_MAX_ATTEMPTS # type: ignore
|
24 |
|
app/services/base.py
CHANGED
@@ -34,7 +34,7 @@ class BaseAttributionService(ABC):
|
|
34 |
ai_model: str,
|
35 |
img_urls: List[str],
|
36 |
product_taxonomy: str,
|
37 |
-
product_data: Dict[str, Union[str, List]],
|
38 |
pil_images: List[Any] = None,
|
39 |
img_paths: List[str] = None,
|
40 |
) -> Dict[str, Any]:
|
|
|
34 |
ai_model: str,
|
35 |
img_urls: List[str],
|
36 |
product_taxonomy: str,
|
37 |
+
product_data: Dict[str, Union[str, List[str]]],
|
38 |
pil_images: List[Any] = None,
|
39 |
img_paths: List[str] = None,
|
40 |
) -> Dict[str, Any]:
|
app/services/service_anthropic.py
CHANGED
@@ -41,7 +41,7 @@ class AnthropicService(BaseAttributionService):
|
|
41 |
ai_model: str,
|
42 |
img_urls: List[str],
|
43 |
product_taxonomy: str,
|
44 |
-
product_data: Dict[str, Union[str, List]],
|
45 |
pil_images: List[Any] = None, # do not remove, this is for weave
|
46 |
img_paths: List[str] = None,
|
47 |
) -> Dict[str, Any]:
|
|
|
41 |
ai_model: str,
|
42 |
img_urls: List[str],
|
43 |
product_taxonomy: str,
|
44 |
+
product_data: Dict[str, Union[str, List[str]]],
|
45 |
pil_images: List[Any] = None, # do not remove, this is for weave
|
46 |
img_paths: List[str] = None,
|
47 |
) -> Dict[str, Any]:
|
app/services/service_openai.py
CHANGED
@@ -58,7 +58,7 @@ class OpenAIService(BaseAttributionService):
|
|
58 |
ai_model: str,
|
59 |
img_urls: List[str],
|
60 |
product_taxonomy: str,
|
61 |
-
product_data: Dict[str, Union[str, List]],
|
62 |
pil_images: List[Any] = None, # do not remove, this is for weave
|
63 |
img_paths: List[str] = None,
|
64 |
) -> Dict[str, Any]:
|
|
|
58 |
ai_model: str,
|
59 |
img_urls: List[str],
|
60 |
product_taxonomy: str,
|
61 |
+
product_data: Dict[str, Union[str, List[str]]],
|
62 |
pil_images: List[Any] = None, # do not remove, this is for weave
|
63 |
img_paths: List[str] = None,
|
64 |
) -> Dict[str, Any]:
|
app/utils/converter.py
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
-
|
|
|
|
|
|
|
2 |
"""
|
3 |
Convert product data to a string.
|
4 |
|
|
|
1 |
+
from typing import Dict, List, Union
|
2 |
+
|
3 |
+
|
4 |
+
def product_data_to_str(product_data: Dict[str, Union[str, List[str]]]) -> str:
|
5 |
"""
|
6 |
Convert product data to a string.
|
7 |
|