-
Notifications
You must be signed in to change notification settings - Fork 299
feat: add a new SDK server #387
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
Conversation
734bdea
to
f388182
Compare
b8aca50
to
3b3eefa
Compare
pkg/sdkserver/routes.go
Outdated
if body[len(body)-1] != '}' { | ||
body = append(body, '"', '}') | ||
} |
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.
Is this in case a model making calls through the SDK fails to finish a JSON string?
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.
This was supposed to be removed, and I removed it from the wrong branch.
pkg/sdkserver/server.go
Outdated
s := &server{ | ||
client: g, | ||
events: events, | ||
} | ||
defer s.Close() | ||
|
||
s.addRoutes(http.DefaultServeMux) |
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.
Where does this s
server end up getting used?
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.
In addRoutes
, it sets up the routes for the various commands, which is where the client and events get used.
|
||
instructions := strings.TrimPrefix(tool.Instructions, types.DaemonPrefix) | ||
instructions, path := getPath(instructions) | ||
tool.Instructions = types.CommandPrefix + instructions | ||
|
||
port, ok := e.Ports.daemonPorts[tool.ID] | ||
port, ok := ports.daemonPorts[tool.ID] | ||
url := fmt.Sprintf("http://127.0.0.1:%d%s", port, path) |
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.
Not sure if there would be any use for this (and it's not part of your PR anyway), but can this be made configurable to listen on other interfaces as well?
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.
We can definitely discuss that!
3b3eefa
to
24a294a
Compare
return | ||
} | ||
|
||
logger.Debugf("parsing file: file=%s, content=%s", reqObject.File, reqObject.Content) |
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.
to log with fields or not to log with fields? 😁
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.
LGTM - no blocking comments, just some questions for my understanding :)
This server will be used in the SDKs for running gptscripts. This change also includes an implementation that allows the SDKs to "confirm" tools execution. Signed-off-by: Donnie Adams <[email protected]>
24a294a
to
0a75894
Compare
This server will be used in the SDKs for running gptscripts.