Skip to content

Commit b32f2a4

Browse files
authored
Merge pull request #42 from lmstudio-ai/update-python-tool-use-example
Show fragment round index arg in Python .act() example
2 parents dc131ff + 45d5b9e commit b32f2a4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

1_python/2_agent/act.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ The following code creates a conversation loop with an LLM agent that can create
9999
return "Error: {exc!r}"
100100
return "File created."
101101
102-
def print_fragment(fragment, *args):
102+
def print_fragment(fragment, round_index=0):
103+
# .act() supplies the round index as the second parameter
104+
# Setting a default value means the callback is also
105+
# compatible with .complete() and .respond().
103106
print(fragment.content, end="", flush=True)
104107
105108
model = lms.llm()

0 commit comments

Comments
 (0)