-
Notifications
You must be signed in to change notification settings - Fork 813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds simple game server for gen AI #3628
Adds simple game server for gen AI #3628
Conversation
Build Succeeded 👏 Build Id: 5b448a0c-59b1-4df1-a677-ed2f145182c7 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
🤔 should this be in this repo, or something like https://github.com/googleforgames/GenAI-quickstart which is more tied to Google Cloud products? |
f81ef87
to
4486fef
Compare
Build Succeeded 👏 Build Id: b54cb57f-d041-4644-a6c4-fb8c1fcd065e The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
252dfc0
to
2c95531
Compare
Build Failed 😱 Build Id: f7aae38e-ea2d-4b82-84ea-590749091e22 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
2c95531
to
cc755aa
Compare
Build Succeeded 👏 Build Id: a7c397b1-1253-4a7f-a396-cadd60de058c The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Build Succeeded 👏 Build Id: 85ce36b1-c260-4693-914d-78154de2de45 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
ba06ceb
to
4de0a04
Compare
Build Succeeded 👏 Build Id: 556ded6e-b601-473a-a6dc-f52a40195468 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
b49fb69
to
3d573b2
Compare
Build Succeeded 👏 Build Id: e5158145-6d98-4015-9169-db4eb9e43b3e The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
3d573b2
to
ff5d917
Compare
Build Succeeded 👏 Build Id: 9e9db44f-bc46-447a-94d8-26103c3cdda8 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
ff5d917
to
4219ab8
Compare
Build Succeeded 👏 Build Id: 0b8b0ef9-0e35-498e-aa44-038e4e1ade62 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Build Succeeded 👏 Build Id: cdb931cf-da09-44a8-81fe-d14f46b27024 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Build Failed 😱 Build Id: 52fe37e3-3640-4a2d-a4f8-1e0e28480650 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
abd82d5
to
db45799
Compare
Build Succeeded 👏 Build Id: a8087197-5a65-48d6-b5ab-93438b9427b9 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
db45799
to
1e3edd9
Compare
Creates a flag for the GenAI endpoint. Reuses a single http client to connect the GenAI endpoint. Allows multiple clients to connect via TCP or UDP and takes a prompt to forward to the GenAI endpoint and returns the response.
as the GenAI. The two clients can then chat with one another. Also removes UDP and makes other small changes to simplify the code.
This new structure only works with the genai/chat endpoint. However, this helps to prevent the AI from quickly going into a loop of responses
1e3edd9
to
26f555d
Compare
Build Succeeded 👏 Build Id: 5bdaea2a-3ff3-4e6f-8801-d1a81689fdf0 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
examples/simple-genai-server/main.go
Outdated
go autonomousChat(*prompt, genAiConn, simConn, *numChats, &wg) | ||
wg.Wait() | ||
|
||
log.Printf("Shutting down the Game Server.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be simpler if you just put these lines into the autonomousChat
function when you hit the base case:
if numChats <= 0 {
log.Printf("Shutting down the Game Server.")
shutdownErr := s.Shutdown()
if shutdownErr != nil {
log.Printf("Could not shutdown")
}
return
}
I also think that having the wait group here means that the <-sigCtx.Done()
line below never gets executed until after the autonomous chats complete. So an interrupt wouldn't be caught.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed up the code to pass through the sigCtx to the autonomousChat.
We get an error "error":"http: Server closed"
after the request to shutdown, but it looks like that's coming from the SDK Server httpEndpoint.
{"gsKey":"default/gen-ai-server-auto","message":"SDK server shutdown requested, waiting for game server shutdown","severity":"info","source":"*sdkserver.SDKServer","state":"RequestReady","time":"2024-02-23T23:25:18.158333903Z"}
{"message":"Shutting down SDK server","severity":"info","source":"main","time":"2024-02-23T23:25:18.196158733Z"}
{"error":"http: Server closed","message":"http server closed","severity":"info","source":"main","time":"2024-02-23T23:25:18.196415148Z"}
{"gsKey":"default/gen-ai-server-auto","message":"...shutting down workers","queue":"agones.dev.default.gen-ai-server-auto","severity":"info","source":"*sdkserver.SDKServer","time":"2024-02-23T23:25:18.196206956Z"}
{"error":"http: Server closed","gsKey":"default/gen-ai-server-auto","message":"Health check: http server closed","severity":"error","source":"*sdkserver.SDKServer","time":"2024-02-23T23:25:18.196492334Z"}
Just the one last comment on the new code that you added. Then this should be ready to merge! |
Build Succeeded 👏 Build Id: a4fca4b8-a585-4ff0-9ee7-b4f814892eb4 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Passes through the NewSigKillContext to the autonomous chat to allow for more graceful shutdown of the Game Server in the case of an interrupt.
2e9cad7
to
2ca9096
Compare
Build Succeeded 👏 Build Id: 1da4fa9e-f6b3-4119-b94e-276acfdd0552 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
What type of PR is this?
/kind documentation
What this PR does / Why we need it:
Creates a simple game server that can connect to a gen AI endpoint.
Which issue(s) this PR fixes:
Special notes for your reviewer: