Skip to content

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

Merged
merged 1 commit into from
May 28, 2024
Merged

Conversation

thedadams
Copy link
Contributor

This server will be used in the SDKs for running gptscripts.

Comment on lines 139 to 141
if body[len(body)-1] != '}' {
body = append(body, '"', '}')
}
Copy link
Member

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?

Copy link
Contributor Author

@thedadams thedadams May 24, 2024

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.

Comment on lines 53 to 61
s := &server{
client: g,
events: events,
}
defer s.Close()

s.addRoutes(http.DefaultServeMux)
Copy link
Member

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?

Copy link
Contributor Author

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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!

@thedadams thedadams force-pushed the add-clicky-server branch from 3b3eefa to 24a294a Compare May 24, 2024 22:25
return
}

logger.Debugf("parsing file: file=%s, content=%s", reqObject.File, reqObject.Content)
Copy link
Contributor

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? 😁

Copy link
Contributor

@iwilltry42 iwilltry42 left a 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]>
@thedadams thedadams force-pushed the add-clicky-server branch from 24a294a to 0a75894 Compare May 28, 2024 12:34
@thedadams thedadams merged commit 59bf155 into gptscript-ai:main May 28, 2024
1 check passed
@thedadams thedadams deleted the add-clicky-server branch May 28, 2024 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants