Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
44250d44
"vscode:/vscode.git/clone" did not exist on "f1d5c95a4e646e006422e8c7fd22e22a30fa5972"
Unverified
Commit
44250d44
authored
May 14, 2025
by
Biswa Panda
Committed by
GitHub
May 14, 2025
Browse files
fix: keep example hello world deployment's output deterministic for testing (#1051)
parent
40c4f04c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
examples/hello_world/hello_world.py
examples/hello_world/hello_world.py
+3
-4
No files found.
examples/hello_world/hello_world.py
View file @
44250d44
...
...
@@ -14,7 +14,6 @@
# limitations under the License.
import
logging
import
os
from
fastapi.responses
import
StreamingResponse
from
pydantic
import
BaseModel
...
...
@@ -78,7 +77,7 @@ class Backend:
logger
.
info
(
f
"Backend received:
{
req_text
}
"
)
text
=
f
"
{
req_text
}
-
{
self
.
message
}
"
for
token
in
text
.
split
():
yield
f
"
[process_id:
{
os
.
getpid
()
}
]
Backend:
{
token
}
"
yield
f
"Backend:
{
token
}
"
@
service
(
...
...
@@ -103,7 +102,7 @@ class Middle:
next_request
=
RequestType
(
text
=
text
).
model_dump_json
()
async
for
response
in
self
.
backend
.
generate
(
next_request
):
logger
.
info
(
f
"Middle received response:
{
response
}
"
)
yield
f
"
[process_id:
{
os
.
getpid
()
}
]
Middle:
{
response
}
"
yield
f
"Middle:
{
response
}
"
@
service
(
...
...
@@ -134,6 +133,6 @@ class Frontend:
async
def
content_generator
():
async
for
response
in
self
.
middle
.
generate
(
request
.
model_dump_json
()):
yield
f
"
[process_id:
{
os
.
getpid
()
}
]
Frontend:
{
response
}
"
yield
f
"Frontend:
{
response
}
"
return
StreamingResponse
(
content_generator
())
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment