FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sdk-python/src/strands/types/event_loop.py at main · polytech-dev/sdk-python · GitHub
polytech-dev
/
sdk-python
Public
forked from
strands-agents/harness-sdk
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
sdk-python
/
src
/
strands
/
types
/
event_loop.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (44 loc) · 1.74 KB
Breadcrumbs
sdk-python
/
src
/
strands
/
types
/
event_loop.py
Copy path
File metadata and controls
57 lines (44 loc) · 1.74 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
"""Event loop-related type definitions for the SDK."""
from
typing
import
Literal
from
typing_extensions
import
Required
,
TypedDict
class
Usage
(
TypedDict
,
total
=
False
):
"""Token usage information for model interactions.
Attributes:
inputTokens: Number of tokens sent in the request to the model.
outputTokens: Number of tokens that the model generated for the request.
totalTokens: Total number of tokens (input + output).
cacheReadInputTokens: Number of tokens read from cache (optional).
cacheWriteInputTokens: Number of tokens written to cache (optional).
"""
inputTokens
:
Required
[
int
]
outputTokens
:
Required
[
int
]
totalTokens
:
Required
[
int
]
cacheReadInputTokens
:
int
cacheWriteInputTokens
:
int
class
Metrics
(
TypedDict
,
total
=
False
):
"""Performance metrics for model interactions.
Attributes:
latencyMs (int): Latency of the model request in milliseconds.
timeToFirstByteMs (int): Latency from sending model request to first
content chunk (contentBlockDelta or contentBlockStart) from the model in milliseconds.
"""
latencyMs
:
Required
[
int
]
timeToFirstByteMs
:
int
StopReason
=
Literal
[
"content_filtered"
,
"end_turn"
,
"guardrail_intervened"
,
"interrupt"
,
"max_tokens"
,
"stop_sequence"
,
"tool_use"
,
]
"""Reason for the model ending its response generation.
- "content_filtered": Content was filtered due to policy violation
- "end_turn": Normal completion of the response
- "guardrail_intervened": Guardrail system intervened
- "interrupt": Agent was interrupted for human input
- "max_tokens": Maximum token limit reached
- "stop_sequence": Stop sequence encountered
- "tool_use": Model requested to use a tool
"""
Back
|
FazBrowse Home
|
New Git URL