Skip to content

Commit cbfa83f

Browse files
committed
docs - update readme issues.
Signed-off-by: Bill Maxwell <[email protected]>
1 parent 30fe92a commit cbfa83f

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

README.md

+21-7
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ print(response)
128128

129129
### `stream_exec(tool)`
130130

131-
This function streams the execution of a tool and returns the output, error, and process wait function.
131+
This function streams the execution of a tool and returns the output, error, and process wait function. The streams must be read from.
132132

133133
```python
134134
from gptscript.command import stream_exec, complex_tool
@@ -151,9 +151,16 @@ the response should be in JSON and match the format:
151151
""",
152152
)
153153

154+
def print_output(out, err):
155+
# Error stream has the debug info that is useful to see
156+
for line in err:
157+
print(line)
158+
159+
for line in out:
160+
print(line)
161+
154162
out, err, wait = stream_exec(tool)
155-
print(out)
156-
print(err)
163+
print_output(out, err)
157164
wait()
158165
```
159166

@@ -164,9 +171,16 @@ This function streams the execution of a tool from a file and returns the output
164171
```python
165172
from gptscript.command import stream_exec_file
166173

174+
def print_output(out, err):
175+
# Error stream has the debug info that is useful to see
176+
for line in err:
177+
print(line)
178+
179+
for line in out:
180+
print(line)
181+
167182
out, err, wait = stream_exec_file("./init.gpt")
168-
print(out)
169-
print(err)
183+
print_output(out, err)
170184
wait()
171185
```
172186

@@ -179,13 +193,13 @@ from gptscript.tool import FreeForm, Tool
179193
# Define a simple tool
180194
simple_tool = FreeForm(
181195
content="""
182-
What is the capitial of the United States?
196+
What is the capital of the United States?
183197
"""
184198
)
185199

186200
# Define a complex tool
187201
complex_tool = Tool(
188-
tools="sys.write",
202+
tools=["sys.write"],
189203
json_response=True,
190204
cache=False,
191205
instructions="""

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "gptscript"
7-
version = "0.1.0"
7+
version = "0.1.0-rc1"
88
description = "Run gptscripts from Python apps"
99
readme = "README.md"
1010
authors = [{ name = "Bill Maxwell", email = "[email protected]" }]

0 commit comments

Comments
 (0)