File size: 3,592 Bytes
791c906
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""
Claude tools for the support agent: executor income statement, quality params, etc.
Define tools here; implement real API/DB calls inside each function.
"""
from langchain_core.tools import tool


@tool
def get_exec_quality_params(executive_id: str, period: str = "last 14 days") -> str:
    """Get job quality parameters and metrics for the executor (domovyat), optionally over a time period (history of parameter changes).
    Use when the user asks about quality, ratings, scores, performance, or how quality changed over time.
    executive_id: identifier of the executor.
    period: time period for the snapshot or history, e.g. 'last 14 days', 'last week', '2025-01-01 to 2025-01-15'.
    Default is last 14 days. Maximum range allowed is 1 month (30 days); longer periods are truncated.
    """
    # TODO: replace with real API or DB call; enforce max 30 days when resolving period
    return f"[Заглушка: параметры качества исполнителя {executive_id!r} за период {period!r} (по умолчанию 14 дней, макс. 30 дней). Подключите ваш API.]"

@tool
def get_exec_orders_history(executive_id: str, period: str = "last 7 days") -> str:
    """Get the executor's orders history over a time period: what services they did, which addresses, amount earned, whether on time.
    Use when the user asks about past orders, history of work, or what they did on certain days.
    executive_id: identifier of the executor.
    period: time period, e.g. 'last 7 days', 'last 3 days', '2025-01-01 to 2025-01-07'.
    Default is last 7 days. Maximum range allowed is 10 days (longer periods are truncated).
    """
    # TODO: replace with real API or DB call; enforce max 10 days when resolving period
    return f"[Заглушка: история заказов исполнителя {executive_id!r} за период {period!r} (по умолчанию 7 дней, макс. 10 дней). Подключите ваш API.]"

@tool
def get_exec_next_orders(executive_id: str) -> str:
    """Get details of the executor's next orders: what services they'll be doing, which addresses they'll be working at, amount of money they'll be earning, 
    any comments from the customer, number of people in the team, whether they need to pick up supplies from the warehouse, etc.
    """
    # TODO: replace with real API or DB call
    return f"[Заглушка: следующие заказы исполнителя {executive_id!r}. Подключите ваш API.]"

@tool
def get_exec_revenue_and_fines_feed(executive_id: str, period: str = "last 7 days") -> str:
    """Get the revenue and fines feed for the executor over a time period.
    Use when the user asks about fines, penalties, or recent revenue/fines list.
    executive_id: identifier of the executor.
    period: time period, e.g. 'last 7 days', 'last 3 days', '2025-01-01 to 2025-01-07'.
    Default is last 7 days. Maximum range allowed is 10 days (longer periods are truncated).
    """
    # TODO: replace with real API or DB call; enforce max 10 days when resolving period
    return f"[Заглушка: лента доходов и штрафов исполнителя {executive_id!r} за период {period!r} (по умолчанию 7 дней, макс. 10 дней). Подключите ваш API.]"


def get_all_tools():
    """Return the list of tools to bind to the LLM."""
    return [
        get_exec_next_orders,
        get_exec_quality_params,
        get_exec_revenue_and_fines_feed,
        get_exec_orders_history
    ]