Skip to content

Conversation

@andreibratu
Copy link

@andreibratu andreibratu commented Feb 27, 2025

  • Functions wrapped in HL decorators enforce receiving functions that take inputs and optionally, a message argument
  • Functions wrapped in HL decorators keep their signature
  • Use /otel in processing
  • prompt decorator no longer creates its own span; similar to Python, we add metadata directly on LLM provider span
  • Validation and better warnings on evaluations run

package.json Outdated
"repository": "https://github.com/humanloop/humanloop-node",
"main": "./index.js",
"types": "./index.d.ts",
"main": "./dist/index.js",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert before merging

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦆

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"qs": "6.11.2",
"readable-stream": "^4.5.2",
"stable-hash": "0.0.4",
"url-join": "4.0.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any of these ESM-only? (have we tested it's installable on customer-like environments that had issue with pmap?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those are deps packed by fern

}
}

// ... existing code ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i assume this is AI?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(is this a sign that any other bits of code need cleanup/looking at?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

*
* @param func - The function to wrap
* @param opentelemetryTracer - The OpenTelemetry tracer instance
* @param path - Optional span path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this optional? path below is a non-optional string

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

}

Object.keys(inputs!).forEach((inputKey) => {
if (!parameters.hasOwnProperty(inputKey)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the right way to check, or is "in" better?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

@jamesbaskerville jamesbaskerville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally lgtm but needs some cleanup. utilities/ should be empty.

.filter(([_, value]) => value !== undefined)
.map(([key, value]) => ({
key,
value: { stringValue: value!.toString() },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as python -- does string always make sense? Do we not send any other type of attr?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outdated & fixed

"X-Fern-SDK-Name": "humanloop",
"X-Fern-SDK-Version": SDK_VERSION,
},
body: JSON.stringify(this.spanToProto(span)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Does this match the OTLP spec for JSON spans? Slightly concerned there are differences that are unknown. We may be better off directly sending protos around and processing them as such.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 126 to 128
OpenAI?: any,
Anthropic?: any,
CohereAI?: any,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change ooc?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted

version,
}: {
callable: InputsMessagesCallableType<I, M, O>;
public prompt<I, O>(args: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These three should probably still have docstrings, though they can be a little less involved than previously

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

"content" in funcOutput
) {
outputMessage =
funcOutput as unknown as ChatMessage;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Comment on lines +296 to +319
console.log(`\n${CYAN}Navigate to your Evaluation:${RESET}\n${evaluation.url}\n`);
console.log(
`${CYAN}${type_.charAt(0).toUpperCase() + type_.slice(1)} Version ID: ${
hlFile.versionId
}${RESET}`,
);
console.log(`${CYAN}Run ID: ${runId}${RESET}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these in console logs instead of process.stdout.write?

Comment on lines +439 to +465
// TODO: trigger run when updated API is available
console.log(
`${CYAN}\nRunning ${hlFile.name} over the Dataset ${hlDataset.name}${RESET}`,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so does this do nothing atm? What does this TODO mean?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure, pre my changes

await new Promise((resolve) => setTimeout(resolve, 500));
}
} while (stats.status !== "completed");
console.log(stats.report);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same q on process.stdout vs. console.log

Comment on lines +486 to +510
// TODO: Add back in with number valence on Evaluators
// improvementCheck: improvementCheck,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need to go in now?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

});
} catch (error: any) {
// If the name exists, go and get it
// TODO: Update API GET to allow querying by name and file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a linear ticket?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andreibratu andreibratu force-pushed the decorators-fixes-latest branch from df194c1 to 2838674 Compare March 10, 2025 11:22
@andreibratu andreibratu force-pushed the decorators-fixes-latest branch from f663e59 to dfe5cc9 Compare March 10, 2025 12:55
@andreibratu andreibratu marked this pull request as ready for review March 10, 2025 13:27
@andreibratu andreibratu merged commit 392886c into master Mar 10, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants