Skip to content
Draft
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
3 changes: 2 additions & 1 deletion sdks/node/scripts/loadTest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as weave from 'weave';
import type {WeaveClient} from 'weave';

const func = weave.op(async () => 1);
const myFunction = async (a: number = 1, b: string = 'hello', c: boolean = true) => {
Expand All @@ -13,7 +14,7 @@ const myFunction2 = async ({ a, b = 'wuh' }: { a?: number; b?: string }) => {
};
const func4 = weave.op(myFunction2, { parameterNames: 'useParam0Object' });

async function bench(func: weave.Op<any>, calls: number, client: weave.WeaveClient) {
async function bench(func: weave.Op<any>, calls: number, client: WeaveClient) {
console.log(`Benchmarking with ${calls} calls...`);
const startTime = Date.now();
const promises = Array(calls)
Expand Down
4 changes: 2 additions & 2 deletions sdks/node/src/__tests__/call.manipulation.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as weave from 'weave';
import {WeaveClient} from '../weaveClient';
import {op, Op} from 'weave';
import {CallState, InternalCall} from 'weave/call';
import {getGlobalClient} from 'weave/clientApi';
Expand All @@ -10,7 +10,7 @@ const mockUpdateCall = jest.fn();

jest.mock('weave/clientApi', () => ({
getGlobalClient: jest.fn(() => {
const weaveClient = new weave.WeaveClient(
const weaveClient = new WeaveClient(
null as any,
null as any,
mockProjectId
Expand Down
5 changes: 3 additions & 2 deletions sdks/node/src/__tests__/call.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import * as weave from 'weave';
import {op, type Op} from 'weave';
import {WeaveClient} from '../weaveClient';

const mockOpName = 'weave://test-project-id/op/test-op';
const mockCallId = 'test-call-id';
const mockProjectId = 'test-project-id';

jest.mock('weave/clientApi', () => ({
getGlobalClient: jest.fn(() => {
const weaveClient = new weave.WeaveClient(
const weaveClient = new WeaveClient(
null as any,
null as any,
mockProjectId
Expand All @@ -22,7 +23,7 @@ jest.mock('weave/clientApi', () => ({
newStack: [],
}),
createCall: (...args: any) => {
return weave.WeaveClient.prototype.createCall.apply(weaveClient, args);
return WeaveClient.prototype.createCall.apply(weaveClient, args);
},
startCall: (...args: any[]) => {
return Promise.resolve();
Expand Down
9 changes: 8 additions & 1 deletion sdks/node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,16 @@ export {
type WeaveImage,
} from './media';
export {op} from './op';
export * from './types';
export type {Op, OpDecorator} from './opType';
/**
* @deprecated Create clients via `weave.init()` — direct construction is
* not part of the supported public API and the runtime export will be
* removed in a future release.
*/
export {WeaveClient} from "./weaveClient";
export {WeaveObject, ObjectRef} from './weaveObject';
export {MessagesPrompt, StringPrompt} from './prompt';

// CJS-only side-effect: install the `require()` patcher so CJS hosts
// auto-instrument supported modules. ESM hosts use the loader hook in
// `./esm/instrument.mjs` instead, registered via `--import=weave/instrument`.
Expand Down
2 changes: 0 additions & 2 deletions sdks/node/src/types.ts

This file was deleted.

5 changes: 5 additions & 0 deletions sdks/node/src/weaveClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ export class WeaveClient {
private errorCount = 0;
private readonly MAX_ERRORS = 10;

/**
* @deprecated Create clients via `weave.init()` — direct construction is
* not part of the supported public API and the runtime export will be
* removed in a future release.
*/
constructor(
public traceServerApi: TraceServerApi<any>,
private wandbServerApi: WandbServerApi,
Expand Down
Loading