Skip to content

Add support for new deployment endpoints #223

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 4 commits into from
Mar 19, 2024
Merged

Add support for new deployment endpoints #223

merged 4 commits into from
Mar 19, 2024

Conversation

aron
Copy link
Contributor

@aron aron commented Mar 14, 2024

This adds support for the following methods:

deployment.list()

await replicate.deployments.list()
{
  next: null,
  previous: null,
  results: [
    {
      owner: 'aron',
      name: 'my-app-image-generator',
      current_release: [Object]
    },
    {
      owner: 'aron',
      name: 'aron-sdxl-testing-api',
      current_release: [Object]
    },
    {
      owner: 'aron',
      name: 'arons-hello-world',
      current_release: [Object]
    },
    { owner: 'aron', name: 'aron-sdxl', current_release: [Object] }
  ]
}

deployment.create()

await replicate.deployments.create({name: 'test-js-client', model: 'stability-ai/sdxl', version: 'da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf', hardware: 'gpu-a100', min_instances:0,  max_instances: 0})
{
  owner: 'aron',
  name: 'test-js-client',
  current_release: {
    number: 1,
    model: 'stability-ai/sdxl',
    version: 'da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf',
    created_at: '2024-03-14T11:43:32.049157Z',
    created_by: {
      type: 'user',
      username: 'aron',
      name: 'Aron Carroll',
      github_url: 'https://github.com/aron'
    },
    configuration: { hardware: 'gpu-a100', min_instances: 0, max_instances: 0 }
  }
}

deployment.update()

await replicate.deployments.update('aron', 'my-app-image-generator', {max_instances: 0})
{
  owner: 'aron',
  name: 'my-app-image-generator',
  current_release: {
    number: 3,
    model: 'stability-ai/sdxl',
    version: 'da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf',
    created_at: '2024-03-14T11:42:34.934262Z',
    created_by: {
      type: 'user',
      username: 'aron',
      name: 'Aron Carroll',
      github_url: 'https://github.com/aron'
    },
    configuration: { hardware: 'gpu-t4', min_instances: 0, max_instances: 0 }
  }
}

@aron aron requested a review from mattt March 14, 2024 11:45
@aron aron force-pushed the support-deployments branch 2 times, most recently from 216e2e8 to 0402e36 Compare March 14, 2024 16:45
Comment on lines +36 to +39
scaling: {
min_instances: number;
max_instances: number;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

This was incorrect in the original PR adding deployments.get #206

Copy link
Contributor

Choose a reason for hiding this comment

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

Was I out of touch? No, it was the OpenAPI specification that was wrong #232

@aron aron force-pushed the support-deployments branch from 8cc84ba to aabaa0d Compare March 19, 2024 05:19
@mattt mattt merged commit 1c98382 into main Mar 19, 2024
@mattt mattt deleted the support-deployments branch March 19, 2024 08:51
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.

2 participants