Skip to content
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

[TS] type as string #1022

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@
inputs: KVMap;
run_type: string;
id?: string;
start_time?: number;
end_time?: number;
start_time?: number | string;
end_time?: number | string;
extra?: KVMap;
error?: string;
serialized?: object;
Expand Down Expand Up @@ -1291,7 +1291,7 @@
treeFilter?: string;
isRoot?: boolean;
dataSourceType?: string;
}): Promise<any> {

Check warning on line 1294 in js/src/client.ts

View workflow job for this annotation

GitHub Actions / Check linting

Unexpected any. Specify a different type
let projectIds_ = projectIds || [];
if (projectNames) {
projectIds_ = [
Expand Down Expand Up @@ -1579,7 +1579,7 @@
`Failed to list shared examples: ${response.status} ${response.statusText}`
);
}
return result.map((example: any) => ({

Check warning on line 1582 in js/src/client.ts

View workflow job for this annotation

GitHub Actions / Check linting

Unexpected any. Specify a different type
...example,
_hostUrl: this.getHostUrl(),
}));
Expand Down Expand Up @@ -2722,7 +2722,7 @@
}

const feedbackResult = await evaluator.evaluateRun(run_, referenceExample);
const [_, feedbacks] = await this._logEvaluationFeedback(

Check warning on line 2725 in js/src/client.ts

View workflow job for this annotation

GitHub Actions / Check linting

'_' is assigned a value but never used
feedbackResult,
run_,
sourceInfo
Expand Down Expand Up @@ -3056,7 +3056,7 @@
async _logEvaluationFeedback(
evaluatorResponse: EvaluationResult | EvaluationResults,
run?: Run,
sourceInfo?: { [key: string]: any }

Check warning on line 3059 in js/src/client.ts

View workflow job for this annotation

GitHub Actions / Check linting

Unexpected any. Specify a different type
): Promise<[results: EvaluationResult[], feedbacks: Feedback[]]> {
const evalResults: Array<EvaluationResult> =
this._selectEvalResults(evaluatorResponse);
Expand Down Expand Up @@ -3095,7 +3095,7 @@
public async logEvaluationFeedback(
evaluatorResponse: EvaluationResult | EvaluationResults,
run?: Run,
sourceInfo?: { [key: string]: any }

Check warning on line 3098 in js/src/client.ts

View workflow job for this annotation

GitHub Actions / Check linting

Unexpected any. Specify a different type
): Promise<EvaluationResult[]> {
const [results] = await this._logEvaluationFeedback(
evaluatorResponse,
Expand Down Expand Up @@ -3363,7 +3363,7 @@
promptIdentifier: string,
like: boolean
): Promise<LikePromptResponse> {
const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);

Check warning on line 3366 in js/src/client.ts

View workflow job for this annotation

GitHub Actions / Check linting

'_' is assigned a value but never used
const response = await this.caller.call(
_getFetchImplementation(),
`${this.apiUrl}/likes/${owner}/${promptName}`,
Expand Down Expand Up @@ -3468,7 +3468,7 @@
}

public async getPrompt(promptIdentifier: string): Promise<Prompt | null> {
const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);

Check warning on line 3471 in js/src/client.ts

View workflow job for this annotation

GitHub Actions / Check linting

'_' is assigned a value but never used
const response = await this.caller.call(
_getFetchImplementation(),
`${this.apiUrl}/repos/${owner}/${promptName}`,
Expand Down Expand Up @@ -3512,7 +3512,7 @@
);
}

const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);

Check warning on line 3515 in js/src/client.ts

View workflow job for this annotation

GitHub Actions / Check linting

'_' is assigned a value but never used
if (!(await this._currentTenantIsOwner(owner))) {
throw await this._ownerConflictError("create a prompt", owner);
}
Expand Down Expand Up @@ -3545,7 +3545,7 @@

public async createCommit(
promptIdentifier: string,
object: any,

Check warning on line 3548 in js/src/client.ts

View workflow job for this annotation

GitHub Actions / Check linting

Unexpected any. Specify a different type
options?: {
parentCommitHash?: string;
}
Expand All @@ -3554,7 +3554,7 @@
throw new Error("Prompt does not exist, you must create it first.");
}

const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);

Check warning on line 3557 in js/src/client.ts

View workflow job for this annotation

GitHub Actions / Check linting

'_' is assigned a value but never used
const resolvedParentCommitHash =
options?.parentCommitHash === "latest" || !options?.parentCommitHash
? await this._getLatestCommitHash(`${owner}/${promptName}`)
Expand Down
2 changes: 1 addition & 1 deletion js/src/langchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export async function getLangchainCallbacks(
if (!current || visited.has(current.id)) continue;
visited.add(current.id);

runMap.set(current.id, current);
runMap.set(current.id, current as Run);
if (current.child_runs) {
queue.push(...current.child_runs);
}
Expand Down
6 changes: 3 additions & 3 deletions js/src/run_trees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function stripNonAlphanumeric(input: string) {
}

export function convertToDottedOrderFormat(
epoch: number,
epoch: number | string,
runId: string,
executionOrder = 1
) {
Expand Down Expand Up @@ -154,8 +154,8 @@ export class RunTree implements BaseRun {
project_name: string;
parent_run?: RunTree;
child_runs: RunTree[];
start_time: number;
end_time?: number;
start_time: number | string;
end_time?: number | string;
extra: KVMap;
tags?: string[];
error?: string;
Expand Down
16 changes: 13 additions & 3 deletions js/src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ export interface BaseRun {
name: string;

/** The epoch time at which the run started, if available. */
start_time?: number;
start_time?: number | string;

/** Specifies the type of run (tool, chain, llm, etc.). */
run_type: string;

/** The epoch time at which the run ended, if applicable. */
end_time?: number;
end_time?: number | string;

/** Any additional metadata or settings for the run. */
extra?: KVMap;
Expand Down Expand Up @@ -148,6 +148,10 @@ export interface Run extends BaseRun {
/** The ID of the project that owns this run. */
session_id?: string;

start_time: string;

end_time?: string;

/** IDs of any child runs spawned by this run. */
child_run_ids?: string[];

Expand Down Expand Up @@ -199,7 +203,7 @@ export interface RunCreate extends BaseRun {

export interface RunUpdate {
id?: string;
end_time?: number;
end_time?: number | string;
extra?: KVMap;
tags?: string[];
error?: string;
Expand Down Expand Up @@ -501,4 +505,10 @@ export interface RunWithAnnotationQueueInfo extends BaseRun {

/** The time this run was added to the queue. */
added_at?: string;

/** The ISO 8601 formatted string representing the start time of the run. */
start_time: string;

/** The ISO 8601 formatted string representing the end time of the run, if available. */
end_time?: string;
}
1 change: 1 addition & 0 deletions js/src/tests/client.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ test.concurrent(
id: runId,
name: "foo",
run_type: "llm",
start_time: new Date().toISOString(),
inputs: { input: "hello world" },
outputs: { output: "hi there" },
};
Expand Down
Loading