Skip to content

chore: use workspace SDK functions#4

Merged
g-linville merged 6 commits intogptscript-ai:mainfrom
g-linville:workspace-sdk
Oct 22, 2024
Merged

chore: use workspace SDK functions#4
g-linville merged 6 commits intogptscript-ai:mainfrom
g-linville:workspace-sdk

Conversation

@g-linville
Copy link
Copy Markdown
Member

@g-linville g-linville commented Oct 22, 2024

This updates the dataset tools to use the workspace provider SDK.
I updated the tests so that we write and read all of the data in a single go, rather than reading pre-existing data from a test workspace.

Signed-off-by: Grant Linville <grant@acorn.io>
Signed-off-by: Grant Linville <grant@acorn.io>
Signed-off-by: Grant Linville <grant@acorn.io>
Comment thread main.go
Name string `json:"name"`
Description string `json:"description"`
Content string `json:"content"`
Contents string `json:"contents"`
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this to make it more consistent with the SDK's data types.

Comment thread pkg/dataset/manager.go Outdated
files, err := filepath.Glob(filepath.Join(m.datasetDir, "*"+extension))
func (m *Manager) ListDatasets(ctx context.Context) ([]DatasetMeta, error) {
files, err := m.gptscriptClient.ListFilesInWorkspace(ctx, gptscript.ListFilesInWorkspaceOptions{
Prefix: datasetFilePrefix,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be surprised if this worked in general. The intention with the Prefix fields (here and others) is that they are "directories." If we need more general prefixes, then I believe we would have to add support for it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least with the directory provider, this works. I have not tested it with S3 yet.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. It is the directory provider that I figured would not work.

Signed-off-by: Grant Linville <grant@acorn.io>
@g-linville g-linville requested a review from thedadams October 22, 2024 14:42
Signed-off-by: Grant Linville <grant@acorn.io>
Signed-off-by: Grant Linville <grant@acorn.io>
@g-linville g-linville merged commit fbd1b5f into gptscript-ai:main Oct 22, 2024
@g-linville g-linville deleted the workspace-sdk branch October 22, 2024 19:56
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