Skip to content

Commit 8d8bebd

Browse files
onemquanrootmqWendong-Fan
authored
fix: set pillow and unstructured to be installed by default (#675)
Co-authored-by: zeromquan <[email protected]> Co-authored-by: Wendong <[email protected]>
1 parent 682f7f9 commit 8d8bebd

File tree

4 files changed

+71
-55
lines changed

4 files changed

+71
-55
lines changed

camel/agents/knowledge_graph_agent.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
1414
from typing import Optional, Union
1515

16-
from unstructured.documents.elements import Element
16+
try:
17+
from unstructured.documents.elements import Element
18+
except ImportError:
19+
Element = None
1720

1821
from camel.agents import ChatAgent
1922
from camel.messages import BaseMessage

camel/storages/graph_storages/graph_element.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
from dataclasses import dataclass, field
1717
from typing import List, Union
1818

19-
from unstructured.documents.elements import Element
19+
try:
20+
from unstructured.documents.elements import Element
21+
except ImportError:
22+
Element = None
2023

2124

2225
@dataclass
@@ -72,3 +75,8 @@ class Config:
7275
nodes: List[Node]
7376
relationships: List[Relationship]
7477
source: Element
78+
79+
def __post_init__(self):
80+
if Element is None:
81+
raise ImportError("""The 'unstructured' package is required to use
82+
the 'source' attribute.""")

poetry.lock

Lines changed: 57 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ anthropic = "^0.29.0"
3939
docstring-parser = "^0.15"
4040
pydantic = ">=1.9,<3"
4141
curl_cffi = "0.6.2"
42+
pillow ="^10.2.0"
4243

4344
# model-platforms
4445
litellm = { version = "^1.38.1", optional = true }
@@ -67,7 +68,6 @@ requests_oauthlib = { version = "^1.3.1", optional = true }
6768
prance = { version = "^23.6.21.0", optional = true }
6869
openapi-spec-validator = { version = "^0.7.1", optional = true }
6970
unstructured = { extras = ["all-docs"], version = "^0.10.30", optional = true }
70-
pillow = { version = "^10.2.0", optional = true }
7171
slack-sdk = { version = "^3.27.2", optional = true }
7272
pydub = { version = "^0.25.1", optional = true }
7373
pygithub = { version = "^2.3.0", optional = true }

0 commit comments

Comments
 (0)