from together import Together
client = Together()
identity = client.whoami()
if identity.type != "project_api_key":
raise RuntimeError("TOGETHER_API_KEY must be a project API key")
project_id = identity.project.id
# Read the attachment first: updating it requires its current etag.
adapter = client.endpoints.adapters.retrieve(
"dad_abc123",
project_id=project_id,
endpoint_id="ep_abc123",
deployment_id="dep_abc123",
)
updated = client.endpoints.adapters.update(
"dad_abc123",
project_id=project_id,
endpoint_id="ep_abc123",
deployment_id="dep_abc123",
adapter_revision_id="rv_abc123",
etag=adapter.etag,
)
print(updated)import Together from "together-ai";
const client = new Together();
const identity = await client.whoami();
if (identity.type !== "project_api_key") {
throw new Error("TOGETHER_API_KEY must be a project API key");
}
const projectId = identity.project.id;
// Read the attachment first: updating it requires its current etag.
const adapter = await client.endpoints.adapters.retrieve("dad_abc123", {
projectId,
endpointId: "ep_abc123",
deploymentId: "dep_abc123",
});
const updated = await client.endpoints.adapters.update("dad_abc123", {
projectId,
endpointId: "ep_abc123",
deploymentId: "dep_abc123",
adapterRevisionId: "rv_abc123",
etag: adapter.etag,
});
console.log(updated);
import Together from "together-ai";
const client = new Together();
const identity = await client.whoami();
if (identity.type !== "project_api_key") {
throw new Error("TOGETHER_API_KEY must be a project API key");
}
const projectId = identity.project.id;
// Read the attachment first: updating it requires its current etag.
const adapter = await client.endpoints.adapters.retrieve("dad_abc123", {
projectId,
endpointId: "ep_abc123",
deploymentId: "dep_abc123",
});
const updated = await client.endpoints.adapters.update("dad_abc123", {
projectId,
endpointId: "ep_abc123",
deploymentId: "dep_abc123",
adapterRevisionId: "rv_abc123",
etag: adapter.etag,
});
console.log(updated);
curl --request PATCH \
--url https://api.together.ai/v2/projects/{projectId}/endpoints/{endpointId}/deployments/{deploymentId}/adapters/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"adapterRevisionId": "<string>",
"etag": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.together.ai/v2/projects/{projectId}/endpoints/{endpointId}/deployments/{deploymentId}/adapters/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'adapterRevisionId' => '<string>',
'etag' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.together.ai/v2/projects/{projectId}/endpoints/{endpointId}/deployments/{deploymentId}/adapters/{id}"
payload := strings.NewReader("{\n \"adapterRevisionId\": \"<string>\",\n \"etag\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.together.ai/v2/projects/{projectId}/endpoints/{endpointId}/deployments/{deploymentId}/adapters/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"adapterRevisionId\": \"<string>\",\n \"etag\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.together.ai/v2/projects/{projectId}/endpoints/{endpointId}/deployments/{deploymentId}/adapters/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"adapterRevisionId\": \"<string>\",\n \"etag\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"adapterModelId": "<string>",
"desiredRevisionId": "<string>",
"perCluster": [
{
"adapterModelId": "<string>",
"clusterId": "<string>",
"state": "ADAPTER_LOAD_STATE_PENDING",
"readyPodCount": 123,
"failedPodCount": 123,
"totalPodCount": 123,
"realizedRevisionId": "<string>",
"realizedEtag": "<string>",
"reason": "<string>",
"message": "<string>",
"loadedAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"adapterModel": "<string>",
"realizedRevision": "<string>",
"adapterValid": true,
"adapterValidReason": "<string>"
}
],
"etag": "<string>",
"id": "<string>",
"adapterModel": "<string>",
"desiredRevision": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}Update a deployment adapter
Updates the pinned revision of an adapter attachment by its dad_ id using its row-level etag for optimistic concurrency.
from together import Together
client = Together()
identity = client.whoami()
if identity.type != "project_api_key":
raise RuntimeError("TOGETHER_API_KEY must be a project API key")
project_id = identity.project.id
# Read the attachment first: updating it requires its current etag.
adapter = client.endpoints.adapters.retrieve(
"dad_abc123",
project_id=project_id,
endpoint_id="ep_abc123",
deployment_id="dep_abc123",
)
updated = client.endpoints.adapters.update(
"dad_abc123",
project_id=project_id,
endpoint_id="ep_abc123",
deployment_id="dep_abc123",
adapter_revision_id="rv_abc123",
etag=adapter.etag,
)
print(updated)import Together from "together-ai";
const client = new Together();
const identity = await client.whoami();
if (identity.type !== "project_api_key") {
throw new Error("TOGETHER_API_KEY must be a project API key");
}
const projectId = identity.project.id;
// Read the attachment first: updating it requires its current etag.
const adapter = await client.endpoints.adapters.retrieve("dad_abc123", {
projectId,
endpointId: "ep_abc123",
deploymentId: "dep_abc123",
});
const updated = await client.endpoints.adapters.update("dad_abc123", {
projectId,
endpointId: "ep_abc123",
deploymentId: "dep_abc123",
adapterRevisionId: "rv_abc123",
etag: adapter.etag,
});
console.log(updated);
import Together from "together-ai";
const client = new Together();
const identity = await client.whoami();
if (identity.type !== "project_api_key") {
throw new Error("TOGETHER_API_KEY must be a project API key");
}
const projectId = identity.project.id;
// Read the attachment first: updating it requires its current etag.
const adapter = await client.endpoints.adapters.retrieve("dad_abc123", {
projectId,
endpointId: "ep_abc123",
deploymentId: "dep_abc123",
});
const updated = await client.endpoints.adapters.update("dad_abc123", {
projectId,
endpointId: "ep_abc123",
deploymentId: "dep_abc123",
adapterRevisionId: "rv_abc123",
etag: adapter.etag,
});
console.log(updated);
curl --request PATCH \
--url https://api.together.ai/v2/projects/{projectId}/endpoints/{endpointId}/deployments/{deploymentId}/adapters/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"adapterRevisionId": "<string>",
"etag": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.together.ai/v2/projects/{projectId}/endpoints/{endpointId}/deployments/{deploymentId}/adapters/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'adapterRevisionId' => '<string>',
'etag' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.together.ai/v2/projects/{projectId}/endpoints/{endpointId}/deployments/{deploymentId}/adapters/{id}"
payload := strings.NewReader("{\n \"adapterRevisionId\": \"<string>\",\n \"etag\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.together.ai/v2/projects/{projectId}/endpoints/{endpointId}/deployments/{deploymentId}/adapters/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"adapterRevisionId\": \"<string>\",\n \"etag\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.together.ai/v2/projects/{projectId}/endpoints/{endpointId}/deployments/{deploymentId}/adapters/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"adapterRevisionId\": \"<string>\",\n \"etag\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"adapterModelId": "<string>",
"desiredRevisionId": "<string>",
"perCluster": [
{
"adapterModelId": "<string>",
"clusterId": "<string>",
"state": "ADAPTER_LOAD_STATE_PENDING",
"readyPodCount": 123,
"failedPodCount": 123,
"totalPodCount": 123,
"realizedRevisionId": "<string>",
"realizedEtag": "<string>",
"reason": "<string>",
"message": "<string>",
"loadedAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"adapterModel": "<string>",
"realizedRevision": "<string>",
"adapterValid": true,
"adapterValidReason": "<string>"
}
],
"etag": "<string>",
"id": "<string>",
"adapterModel": "<string>",
"desiredRevision": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": null,
"code": null
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Project identifier.
Endpoint identifier.
Deployment identifier.
Adapter attachment dad_ id from a prior add, update, get, or list response.
Body
Response
OK
Adapter attached to a deployment with desired revision and observed load state.
Adapter model identifier attached to the deployment.
Adapter revision pinned on the deployment.
Per-cluster adapter load state reported by the controller.
Show child attributes
Show child attributes
Row-level etag required for UpdateAdapter and RemoveAdapter.
Adapter attachment dad_ id used by get, update, and remove; stale ids never address a replacement after remove and re-add.
Resource name of the adapter model, using projects/{projectId}/models/{adapterModelId}.
Resource name of the adapter model revision pinned on the deployment, using projects/{projectId}/models/{adapterModelId}/revisions/{revisionId}.
Was this page helpful?