-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New form factor for traceable wrapper
- Loading branch information
1 parent
21dcbc7
commit 4a7d16e
Showing
4 changed files
with
143 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Client } from "../client.js"; | ||
import { traceable } from "../run_helpers.js"; | ||
import { RunTree } from "../run_trees.js"; | ||
import { v4 as uuidv4 } from "uuid"; | ||
|
||
// async function deleteProject(langchainClient: Client, projectName: string) { | ||
// try { | ||
// await langchainClient.readProject({ projectName }); | ||
// await langchainClient.deleteProject({ projectName }); | ||
// } catch (e) { | ||
// // Pass | ||
// } | ||
// } | ||
|
||
test.concurrent( | ||
"Test traceable wrapper", | ||
async () => { | ||
const langchainClient = new Client({ | ||
callerOptions: { maxRetries: 0 }, | ||
}); | ||
const testFunction = (a: string, b: number) => { | ||
return a + b; | ||
}; | ||
const projectName = "__test_traceable_wrapper"; | ||
const runId = uuidv4(); | ||
const runTree = new RunTree({ | ||
name: "Test Run Tree", | ||
id: runId, | ||
client: langchainClient, | ||
project_name: projectName, | ||
}); | ||
|
||
const traceableFunction = traceable(testFunction); | ||
|
||
traceableFunction.setParentRunTree(runTree); | ||
|
||
console.log(await traceableFunction("testing", 9)); | ||
|
||
// await deleteProject(langchainClient, projectName); | ||
}, | ||
180_000 | ||
); |