Skip to content

Commit 07e4d18

Browse files
author
camel-docs-bot
committed
Auto-update documentation after merge [skip ci]
1 parent 986eda5 commit 07e4d18

File tree

2 files changed

+221
-0
lines changed

2 files changed

+221
-0
lines changed

docs/mintlify/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@
525525
"reference/camel.toolkits.image_generation_toolkit",
526526
"reference/camel.toolkits.jina_reranker_toolkit",
527527
"reference/camel.toolkits.klavis_toolkit",
528+
"reference/camel.toolkits.lark_toolkit",
528529
"reference/camel.toolkits.linkedin_toolkit",
529530
"reference/camel.toolkits.markitdown_toolkit",
530531
"reference/camel.toolkits.math_toolkit",
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
<a id="camel.toolkits.lark_toolkit"></a>
2+
3+
<a id="camel.toolkits.lark_toolkit.LarkToolkit"></a>
4+
5+
## LarkToolkit
6+
7+
```python
8+
class LarkToolkit(BaseToolkit):
9+
```
10+
11+
A toolkit for Lark (Feishu) chat operations.
12+
13+
<a id="camel.toolkits.lark_toolkit.LarkToolkit.__init__"></a>
14+
15+
### __init__
16+
17+
```python
18+
def __init__(
19+
self,
20+
app_id: Optional[str] = None,
21+
app_secret: Optional[str] = None,
22+
use_feishu: bool = False,
23+
timeout: Optional[float] = None
24+
):
25+
```
26+
27+
Initializes the LarkToolkit.
28+
29+
**Parameters:**
30+
31+
- **app_id** (Optional[str]): The Lark application ID. If not provided, uses LARK_APP_ID environment variable.
32+
- **app_secret** (Optional[str]): The Lark application secret. If not provided, uses LARK_APP_SECRET environment variable.
33+
- **use_feishu** (bool): Set to True to use Feishu (China) API endpoints instead of Lark (international). (default: :obj:`False`)
34+
- **timeout** (Optional[float]): Request timeout in seconds.
35+
36+
<a id="camel.toolkits.lark_toolkit.LarkToolkit._get_tenant_http_headers"></a>
37+
38+
### _get_tenant_http_headers
39+
40+
```python
41+
def _get_tenant_http_headers(self):
42+
```
43+
44+
**Returns:**
45+
46+
Dict[str, str]: Headers dict with Content-Type and Authorization.
47+
48+
<a id="camel.toolkits.lark_toolkit.LarkToolkit._convert_timestamp"></a>
49+
50+
### _convert_timestamp
51+
52+
```python
53+
def _convert_timestamp(self, ts: Any):
54+
```
55+
56+
Convert millisecond timestamp to readable datetime string.
57+
58+
**Parameters:**
59+
60+
- **ts**: Timestamp value (can be string or int, in milliseconds).
61+
62+
**Returns:**
63+
64+
str: ISO format datetime string, or original value if conversion
65+
fails.
66+
67+
<a id="camel.toolkits.lark_toolkit.LarkToolkit._process_message_items"></a>
68+
69+
### _process_message_items
70+
71+
```python
72+
def _process_message_items(self, items: List[Dict[str, Any]]):
73+
```
74+
75+
Process message items to agent-friendly format.
76+
77+
**Parameters:**
78+
79+
- **items**: List of message items from API response.
80+
81+
**Returns:**
82+
83+
List[Dict[str, Any]]: Simplified items with only essential fields.
84+
85+
<a id="camel.toolkits.lark_toolkit.LarkToolkit.lark_list_chats"></a>
86+
87+
### lark_list_chats
88+
89+
```python
90+
def lark_list_chats(
91+
self,
92+
sort_type: Literal['ByCreateTimeAsc', 'ByActiveTimeDesc'] = 'ByCreateTimeAsc',
93+
page_size: int = 20,
94+
page_token: Optional[str] = None
95+
):
96+
```
97+
98+
Lists chats and groups that the user belongs to.
99+
100+
Use this method to discover available chats and obtain chat_id values.
101+
102+
**Parameters:**
103+
104+
- **sort_type** (str): Sort order for chats. Options: - "ByCreateTimeAsc" (default) - "ByActiveTimeDesc"
105+
- **page_size** (int): Number of chats to return per page (max 100). (default: :obj:`20`)
106+
- **page_token** (Optional[str]): Token for pagination. Use the page_token from previous response to get next page.
107+
108+
**Returns:**
109+
110+
Dict[str, object]: A dictionary containing:
111+
- chats: List of chat objects with chat_id and name
112+
- has_more: Whether there are more chats to fetch
113+
- page_token: Token to fetch the next page
114+
115+
<a id="camel.toolkits.lark_toolkit.LarkToolkit.lark_get_chat_messages"></a>
116+
117+
### lark_get_chat_messages
118+
119+
```python
120+
def lark_get_chat_messages(
121+
self,
122+
container_id: str,
123+
container_id_type: Literal['chat', 'thread'] = 'chat',
124+
start_time: Optional[str] = None,
125+
end_time: Optional[str] = None,
126+
sort_type: Literal['ByCreateTimeAsc', 'ByCreateTimeDesc'] = 'ByCreateTimeAsc',
127+
page_size: int = 20,
128+
page_token: Optional[str] = None
129+
):
130+
```
131+
132+
Gets message history from a chat with optional time filtering.
133+
134+
Retrieves messages from a specific chat. Requires the bot to be a
135+
member of the chat.
136+
137+
**Parameters:**
138+
139+
- **container_id** (str): The container ID to retrieve messages from.
140+
- **container_id_type** (str): The container type. Options: - "chat": Chat (p2p or group) - "thread": Thread
141+
- **start_time** (Optional[str]): Start time filter (Unix timestamp in seconds, e.g., "1609459200"). Messages created after this time. Not supported for "thread" container type.
142+
- **end_time** (Optional[str]): End time filter (Unix timestamp in seconds). Messages created before this time. Not supported for "thread" container type.
143+
- **sort_type** (str): Sort order for messages. Options: - "ByCreateTimeAsc": Oldest first (default) - "ByCreateTimeDesc": Newest first
144+
- **page_size** (int): Number of messages to return per page (max 50). (default: :obj:`20`)
145+
- **page_token** (Optional[str]): Token for pagination. Use the page_token from previous response to get next page.
146+
147+
**Returns:**
148+
149+
Dict[str, object]: A dictionary containing:
150+
- messages: List of processed message objects with fields:
151+
- message_id: Message identifier
152+
- msg_type: Message type (text, image, file, etc.)
153+
- text: Extracted message text content
154+
- time: Human-readable timestamp (UTC)
155+
- sender_id: Sender's user ID
156+
- sender_type: Type of sender
157+
- has_more: Whether there are more messages to fetch
158+
- page_token: Token to fetch the next page
159+
160+
<a id="camel.toolkits.lark_toolkit.LarkToolkit.lark_get_message_resource"></a>
161+
162+
### lark_get_message_resource
163+
164+
```python
165+
def lark_get_message_resource(
166+
self,
167+
message_id: str,
168+
file_key: str,
169+
resource_type: Literal['image', 'file']
170+
):
171+
```
172+
173+
Obtains resource files in messages, including audios, videos,
174+
images, and files. Emoji resources cannot be downloaded, and the
175+
resource files for download cannot exceed 100 MB.
176+
177+
**Parameters:**
178+
179+
- **message_id** (str): The message ID containing the resource.
180+
- **file_key** (str): The resource file key from message content.
181+
- **resource_type** (str): Resource type, either "image" or "file".
182+
183+
**Returns:**
184+
185+
Dict[str, object]: A dictionary containing:
186+
- content_type: Response Content-Type header value
187+
- path: File path where content was saved
188+
- size: Content size in bytes
189+
190+
<a id="camel.toolkits.lark_toolkit.LarkToolkit.lark_get_message_resource_key"></a>
191+
192+
### lark_get_message_resource_key
193+
194+
```python
195+
def lark_get_message_resource_key(self, message_id: str):
196+
```
197+
198+
Gets the resource key from a message's content.
199+
200+
**Parameters:**
201+
202+
- **message_id** (str): The message ID to fetch.
203+
204+
**Returns:**
205+
206+
Dict[str, object]: A dictionary containing:
207+
- key: The resource key from message content
208+
209+
<a id="camel.toolkits.lark_toolkit.LarkToolkit.get_tools"></a>
210+
211+
### get_tools
212+
213+
```python
214+
def get_tools(self):
215+
```
216+
217+
**Returns:**
218+
219+
List[FunctionTool]: A list of FunctionTool objects
220+
representing the functions in the toolkit.

0 commit comments

Comments
 (0)