Skip to content

Commit

Permalink
rm method
Browse files Browse the repository at this point in the history
  • Loading branch information
hinthornw committed Sep 18, 2024
1 parent b91c89c commit 5c26f7d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 105 deletions.
58 changes: 0 additions & 58 deletions js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3280,64 +3280,6 @@ export class Client {
await raiseForStatus(response, "add runs to annotation queue");
}

/**
* List runs from an annotation queue with the specified queue ID.
* @param queueId - The ID of the annotation queue
* @param limit - The maximum number of runs to return
* @returns An async iterable of RunWithAnnotationQueueInfo objects
*/
public async *listRunsFromAnnotationQueue(
queueId: string,
limit?: number
): AsyncIterable<RunWithAnnotationQueueInfo> {
const baseUrl = `/annotation-queues/${assertUuid(queueId, "queueId")}/run`;
let index = 0;
let i = 0;
while (true) {
try {
console.log("GETTT", `${this.apiUrl}${baseUrl}/${index}`);
const response = await this.caller.call(
_getFetchImplementation(),
`${this.apiUrl}${baseUrl}/${index}`,
{
method: "GET",
headers: this.headers,
signal: AbortSignal.timeout(this.timeout_ms),
...this.fetchOptions,
}
);

if (!response.ok) {
if (response.status === 404) {
break;
}
await raiseForStatus(response, "list runs from annotation queue");
}

const run: RunWithAnnotationQueueInfo = await response.json();
yield run;

i++;
if (limit !== undefined && i >= limit) {
return;
}

index++;
} catch (error) {
if (
error &&
typeof error === "object" &&
"message" in error &&
typeof error.message === "string" &&
error.message.includes("404")
) {
break;
}
throw error;
}
}
}

protected async _currentTenantIsOwner(owner: string): Promise<boolean> {
const settings = await this._getSettings();
return owner == "-" || settings.tenant_handle === owner;
Expand Down
8 changes: 1 addition & 7 deletions js/src/tests/client.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1213,13 +1213,7 @@ test("annotationqueue crud", async () => {
// 3. Add the run to the annotation queue
await client.addRunsToAnnotationQueue(fetchedQueue.id, [runId]);

// 4. Check that the run is in the annotation queue
const queuedRuns = await toArray(
client.listRunsFromAnnotationQueue(queue.id)
);
expect(queuedRuns.some((r) => r.id === runId)).toBe(true);

// 5. Update the annotation queue description and check that it is updated
// 4. Update the annotation queue description and check that it is updated
const newDescription = "Updated description";
await client.updateAnnotationQueue(queue.id, {
name: queueName,
Expand Down
40 changes: 0 additions & 40 deletions python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4681,46 +4681,6 @@ def add_runs_to_annotation_queue(
)
ls_utils.raise_for_status_with_text(response)

def list_runs_from_annotation_queue(
self, queue_id: ID_TYPE, *, limit: Optional[int] = None
) -> Iterator[ls_schemas.RunWithAnnotationQueueInfo]:
"""List runs from an annotation queue with the specified queue ID.
Args:
queue_id (ID_TYPE): The ID of the annotation queue.
limit (Optional[int]): The maximum number of runs to return.
Yields:
ls_schemas.RunWithAnnotationQueueInfo: An iterator of runs from the
annotation queue.
"""
base_url = f"/annotation-queues/{_as_uuid(queue_id, 'queue_id')}/run"
index = 0
i = 0
while True:
try:
response = self.request_with_retries(
"GET",
f"{base_url}/{index}",
headers=self._headers,
)
if response.status_code == 404:
break
ls_utils.raise_for_status_with_text(response)

run = ls_schemas.RunWithAnnotationQueueInfo(**response.json())
yield run

i += 1
if limit is not None and i >= limit:
return

index += 1
except ls_utils.LangSmithNotFoundError:
break
except ls_utils.LangSmithError as e:
raise e

def create_comparative_experiment(
self,
name: str,
Expand Down

0 comments on commit 5c26f7d

Please sign in to comment.