lite-agent 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of lite-agent might be problematic. Click here for more details.
- lite_agent/__init__.py +7 -0
- lite_agent/agent.py +310 -16
- lite_agent/loggers.py +1 -1
- lite_agent/message_transfers.py +111 -0
- lite_agent/processors/__init__.py +1 -1
- lite_agent/processors/stream_chunk_processor.py +63 -42
- lite_agent/runner.py +465 -29
- lite_agent/stream_handlers/__init__.py +5 -0
- lite_agent/stream_handlers/litellm.py +106 -0
- lite_agent/types/__init__.py +55 -0
- lite_agent/types/chunks.py +89 -0
- lite_agent/types/messages.py +68 -0
- lite_agent/types/tool_calls.py +15 -0
- lite_agent-0.2.0.dist-info/METADATA +111 -0
- lite_agent-0.2.0.dist-info/RECORD +17 -0
- lite_agent/__main__.py +0 -110
- lite_agent/chunk_handler.py +0 -166
- lite_agent/types.py +0 -152
- lite_agent-0.1.0.dist-info/METADATA +0 -22
- lite_agent-0.1.0.dist-info/RECORD +0 -13
- {lite_agent-0.1.0.dist-info → lite_agent-0.2.0.dist-info}/WHEEL +0 -0
lite_agent/types.py
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
from typing import Literal, TypedDict
|
|
2
|
-
|
|
3
|
-
import litellm
|
|
4
|
-
from pydantic import BaseModel
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class ToolCallFunction(BaseModel):
|
|
8
|
-
name: str
|
|
9
|
-
arguments: str | None = None
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class ToolCall(BaseModel):
|
|
13
|
-
type: Literal["function"]
|
|
14
|
-
function: ToolCallFunction
|
|
15
|
-
id: str
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class AssistantMessage(BaseModel):
|
|
19
|
-
id: str
|
|
20
|
-
role: Literal["assistant"] = "assistant"
|
|
21
|
-
content: str = ""
|
|
22
|
-
tool_calls: list[ToolCall] | None = None
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class Message(TypedDict):
|
|
26
|
-
role: str
|
|
27
|
-
content: str
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class UserMessageContentItemText(TypedDict):
|
|
31
|
-
type: Literal["text"]
|
|
32
|
-
text: str
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class UserMessageContentItemImageURLImageURL(TypedDict):
|
|
36
|
-
url: str
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
class UserMessageContentItemImageURL(TypedDict):
|
|
40
|
-
type: Literal["image_url"]
|
|
41
|
-
image_url: UserMessageContentItemImageURLImageURL
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class AgentUserMessage(TypedDict):
|
|
45
|
-
role: Literal["user"] = "user"
|
|
46
|
-
content: str | list[UserMessageContentItemText | UserMessageContentItemImageURL]
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
class AssistantMessageToolCallFunction(TypedDict):
|
|
50
|
-
name: str
|
|
51
|
-
arguments: str
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class AssistantMessageToolCall(TypedDict):
|
|
55
|
-
id: str
|
|
56
|
-
type: Literal["function"]
|
|
57
|
-
function: AssistantMessageToolCallFunction
|
|
58
|
-
tool_call_id: str
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class AgentAssistantMessage(TypedDict):
|
|
62
|
-
role: Literal["assistant"] = "assistant"
|
|
63
|
-
content: str
|
|
64
|
-
tool_calls: list[AssistantMessageToolCall] | None
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class AgentSystemMessage(TypedDict):
|
|
68
|
-
role: Literal["system"] = "system"
|
|
69
|
-
content: str
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
class AgentToolCallMessage(TypedDict):
|
|
73
|
-
role: Literal["tool"] = "tool"
|
|
74
|
-
tool_call_id: str
|
|
75
|
-
content: str
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
RunnerMessage = AgentUserMessage | AgentAssistantMessage | AgentToolCallMessage
|
|
79
|
-
AgentMessage = RunnerMessage | AgentSystemMessage
|
|
80
|
-
RunnerMessages = list[RunnerMessage]
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
class LiteLLMRawChunk(TypedDict):
|
|
84
|
-
"""
|
|
85
|
-
Define the type of chunk
|
|
86
|
-
"""
|
|
87
|
-
|
|
88
|
-
type: Literal["litellm_raw"]
|
|
89
|
-
raw: litellm.ModelResponseStream
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
class UsageChunk(TypedDict):
|
|
93
|
-
"""
|
|
94
|
-
Define the type of usage info chunk
|
|
95
|
-
"""
|
|
96
|
-
|
|
97
|
-
type: Literal["usage"]
|
|
98
|
-
usage: litellm.Usage
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
class FinalMessageChunk(TypedDict):
|
|
102
|
-
"""
|
|
103
|
-
Define the type of final message chunk
|
|
104
|
-
"""
|
|
105
|
-
|
|
106
|
-
type: Literal["final_message"]
|
|
107
|
-
message: AssistantMessage
|
|
108
|
-
finish_reason: Literal["stop", "tool_calls"]
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
class ToolCallChunk(TypedDict):
|
|
112
|
-
"""
|
|
113
|
-
Define the type of tool call chunk
|
|
114
|
-
"""
|
|
115
|
-
|
|
116
|
-
type: Literal["tool_call"]
|
|
117
|
-
name: str
|
|
118
|
-
arguments: str
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
class ToolCallResultChunk(TypedDict):
|
|
122
|
-
"""
|
|
123
|
-
Define the type of tool call result chunk
|
|
124
|
-
"""
|
|
125
|
-
|
|
126
|
-
type: Literal["tool_call_result"]
|
|
127
|
-
tool_call_id: str
|
|
128
|
-
name: str
|
|
129
|
-
content: str
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
class ContentDeltaChunk(TypedDict):
|
|
133
|
-
"""
|
|
134
|
-
Define the type of message chunk
|
|
135
|
-
"""
|
|
136
|
-
|
|
137
|
-
type: Literal["content_delta"]
|
|
138
|
-
delta: str
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
class ToolCallDeltaChunk(TypedDict):
|
|
142
|
-
"""
|
|
143
|
-
Define the type of tool call delta chunk
|
|
144
|
-
"""
|
|
145
|
-
|
|
146
|
-
type: Literal["tool_call_delta"]
|
|
147
|
-
tool_call_id: str
|
|
148
|
-
name: str
|
|
149
|
-
arguments_delta: str
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
AgentChunk = LiteLLMRawChunk | UsageChunk | FinalMessageChunk | ToolCallChunk | ToolCallResultChunk | ContentDeltaChunk | ToolCallDeltaChunk
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: lite-agent
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: A lightweight, extensible framework for building AI agent.
|
|
5
|
-
Author-email: Jianqi Pan <jannchie@gmail.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Keywords: AI,agent framework,assistant,chatbot,function call,openai,pydantic,rich,tooling
|
|
8
|
-
Classifier: Intended Audience :: Developers
|
|
9
|
-
Classifier: Intended Audience :: Science/Research
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Classifier: Topic :: Communications :: Chat
|
|
17
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
-
Requires-Python: >=3.10
|
|
20
|
-
Requires-Dist: funcall>=0.6.0
|
|
21
|
-
Requires-Dist: prompt-toolkit>=3.0.51
|
|
22
|
-
Requires-Dist: rich>=14.0.0
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
lite_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
lite_agent/__main__.py,sha256=D4Yg5a6hDYMq6aCEGg3MjILF4pVWD6mBKjri-qs7Rzk,3766
|
|
3
|
-
lite_agent/agent.py,sha256=LmC5aqMVWsq5AkE18Od0FEVUdiZN1GTs5OlO6mrvxUM,1187
|
|
4
|
-
lite_agent/chunk_handler.py,sha256=MDk9rW_axZ412VOPnITbQGVr-mCGAe2jy3khUXkYbvM,5135
|
|
5
|
-
lite_agent/loggers.py,sha256=0-yb_1Ec8TodfTI_nZWeCJSpSZZM9R53UUOE5--L2iw,57
|
|
6
|
-
lite_agent/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
lite_agent/runner.py,sha256=TaBm6pCFwdJtygNnmVZDlFbkK3-Z1s52YD9XviwrA6o,2257
|
|
8
|
-
lite_agent/types.py,sha256=NUpoSDaaiWWYezWluDdWBb-DsYFvZFoNd4tLWqBzCZ4,3058
|
|
9
|
-
lite_agent/processors/__init__.py,sha256=AIxxS9uLcNws1Erf-b8z8zZKaKA5NQ7ooZ7HaCIJTq4,115
|
|
10
|
-
lite_agent/processors/stream_chunk_processor.py,sha256=WlVcfc4kdiCz0Fc1Ybe5GapN2stK0C_0DIymbiGpZfI,3420
|
|
11
|
-
lite_agent-0.1.0.dist-info/METADATA,sha256=oFRlVtYwsr1P9RPOP2JNu309-Jpqc95f-TYrExmrFBc,972
|
|
12
|
-
lite_agent-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
13
|
-
lite_agent-0.1.0.dist-info/RECORD,,
|
|
File without changes
|