Documentation Index
Fetch the complete documentation index at: https://docs.hipocap.com/llms.txt
Use this file to discover all available pages before exploring further.
LaminarClient
HTTP client for Laminar API operations.import { LaminarClient } from '@lmnr-ai/lmnr';
const client = new LaminarClient({
projectApiKey: process.env.LMNR_PROJECT_API_KEY,
});
// Tag a completed trace
await client.tags.tag(traceId, ['user-feedback-positive']);
Constructor parameters:| Name | Type | Default | Description |
|---|
projectApiKey | string | LMNR_PROJECT_API_KEY env | API key |
baseUrl | string | https://api.lmnr.ai | API base URL |
port | number | 443 | API port |
Resources:Add tags to a completed trace.await client.tags.tag('trace-uuid', ['positive-feedback', 'resolved']);
Example: Capture a trace ID and tag laterimport { Laminar, LaminarClient, observe } from '@lmnr-ai/lmnr';
Laminar.initialize();
const client = new LaminarClient();
const traceId = await observe({ name: 'chat_completion' }, async () => {
// ... your work ...
return Laminar.getTraceId();
});
await Laminar.flush();
if (traceId) {
await client.tags.tag(traceId, 'good');
}
Parameters:| Name | Type | Default | Description |
|---|
traceId | string | — | Trace UUID |
tags | string[] | string | — | Tag(s) to add |
Returns: Promise<any>Note: Call after Laminar.flush() to ensure trace exists.
client.datasets
Dataset operations.// List datasets
const datasets = await client.datasets.listDatasets();
// Get by name
const dataset = await client.datasets.getDatasetByName('my-dataset');
// Push datapoints
await client.datasets.push({
name: 'my-dataset',
points: [{ data: { query: 'test' }, target: { answer: '42' } }],
createDataset: true,
});
// Pull datapoints
const points = await client.datasets.pull({
name: 'my-dataset',
limit: 100,
});
client.datasets.listDatasets()
Returns: Promise<Dataset[]>
client.datasets.getDatasetByName(name)
Parameters:| Name | Type | Default | Description |
|---|
name | string | — | Dataset name |
Returns: Promise<Dataset[]>
client.datasets.pull(options)
Pull datapoints from a dataset.Parameters:| Name | Type | Default | Description |
|---|
options.name | string | — | Dataset name |
options.id | string | — | Dataset ID |
options.limit | number | 100 | Max datapoints |
options.offset | number | 0 | Pagination offset |
Returns: Promise<GetDatapointsResponse<D, T>>
client.datasets.push(options)
Push datapoints to a dataset.Parameters:| Name | Type | Default | Description |
|---|
options.points | Datapoint<D, T>[] | — | Datapoints to push |
options.name | string | — | Dataset name |
options.id | string | — | Dataset ID |
options.batchSize | number | 100 | Batch size |
options.createDataset | boolean | false | Create dataset if missing |
Returns: Promise<PushDatapointsResponse | undefined>
client.evals
Evaluation operations.// Initialize evaluation
const eval = await client.evals.init('my-eval', 'default-group');
// Create datapoint
await client.evals.createDatapoint({
evalId: eval.id,
data: { query: 'test' },
target: { answer: '42' },
});
client.evals.init(name?, groupName?, metadata?)
Parameters:| Name | Type | Default | Description |
|---|
name | string | — | Evaluation name |
groupName | string | — | Group name |
metadata | Record<string, any> | — | Evaluation metadata |
Returns: Promise<InitEvaluationResponse>
client.evals.createDatapoint(options)
Parameters:| Name | Type | Default | Description |
|---|
options.evalId | string | — | Evaluation UUID |
options.data | any | — | Input data |
options.target | any | — | Target/expected output |
options.metadata | Record<string, any> | — | Datapoint metadata |
options.index | number | — | Dataset index |
options.traceId | string | — | Trace UUID |
Returns: Promise<string>
client.evaluators.score(options)
Attach evaluator score to a trace or span.await client.evaluators.score({
name: 'quality',
score: 0.95,
traceId: 'trace-uuid',
});
Parameters:Pass exactly one of traceId or spanId.| Name | Type | Default | Description |
|---|
options.name | string | — | Evaluator name |
options.score | number | — | Score value |
options.metadata | Record<string, any> | — | Score metadata |
options.traceId | string | — | Trace UUID |
options.spanId | string | — | Span UUID |
Returns: Promise<void>
client.agent.run(options)
Run a browser agent.const result = await client.agent.run({
prompt: 'Find the pricing on example.com',
maxSteps: 50,
returnScreenshots: true,
});
Parameters:| Name | Type | Default | Description |
|---|
prompt | string | — | Agent instruction (required) |
parentSpanContext | string | Current span | Parent trace context |
model | string | — | Model to use |
stream | boolean | false | Stream responses |
maxSteps | number | 100 | Maximum steps |
startUrl | string | — | Starting URL |
timeout | number | — | Timeout in ms |
returnScreenshots | boolean | false | Include screenshots |
returnAgentState | boolean | false | Return agent state |
returnStorageState | boolean | false | Return storage state |
disableGiveControl | boolean | false | Disable “give control” |
enableThinking | boolean | true | Enable thinking |
Returns:
Promise<AgentOutput> when stream is false
Promise<ReadableStream<RunAgentResponseChunk>> when stream is true
LaminarClient
Synchronous HTTP client for Laminar API operations.from lmnr import LaminarClient
client = LaminarClient()
# Tag a completed trace
client.tags.tag(trace_id, ["user-feedback-positive"])
Constructor parameters:| Name | Type | Default | Description |
|---|
project_api_key | str | LMNR_PROJECT_API_KEY env | API key |
base_url | str | https://api.lmnr.ai | API base URL |
port | int | From URL | API port |
timeout | int | 3600 | Request timeout (seconds) |
Resources:Add tags to a completed trace.from lmnr import Laminar, LaminarClient, observe
Laminar.initialize()
client = LaminarClient()
@observe()
def my_trace():
return Laminar.get_trace_id()
trace_id = my_trace()
Laminar.flush()
if trace_id:
client.tags.tag(trace_id, ["user-feedback-positive"])
Parameters:| Name | Type | Default | Description |
|---|
trace_id | str | int | uuid.UUID | — | Trace identifier |
tags | list[str] | str | — | Tag(s) to add |
Returns: list[dict] (returns [] on 404)Note: Call after the trace has ended (use Laminar.flush() for short-lived scripts).
client.close()
Close the underlying HTTP client.Returns: None
client.datasets.pull(name=None, id=None, limit=100, offset=0)
Pull datapoints from a dataset.Parameters:| Name | Type | Default | Description |
|---|
name | str | None | Dataset name |
id | uuid.UUID | None | Dataset ID |
limit | int | 100 | Max datapoints |
offset | int | 0 | Pagination offset |
Returns: GetDatapointsResponse
client.datasets.push(points, name=None, id=None, batch_size=100, create_dataset=False)
Push datapoints to a dataset.Parameters:| Name | Type | Default | Description |
|---|
points | list[Datapoint] | — | Datapoints to push |
name | str | None | Dataset name |
id | uuid.UUID | None | Dataset ID |
batch_size | int | 100 | Batch size |
create_dataset | bool | False | Create dataset if missing |
Returns: PushDatapointsResponse | None
client.evals.init(name=None, group_name=None, metadata=None)
Initialize an evaluation.Parameters:| Name | Type | Default | Description |
|---|
name | str | None | Evaluation name |
group_name | str | None | Group name |
metadata | dict | None | Evaluation metadata |
Returns: InitEvaluationResponse
client.evaluators.score(…)
Create a score for a trace or span.Parameters:Pass exactly one of trace_id or span_id.| Name | Type | Default | Description |
|---|
name | str | — | Evaluator name |
score | float | — | Score value |
trace_id | str | int | uuid.UUID | None | Trace identifier |
span_id | str | int | uuid.UUID | None | Span identifier |
metadata | dict | None | Score metadata |
Returns: None
AsyncLaminarClient
Async variant of LaminarClient.from lmnr import AsyncLaminarClient
client = AsyncLaminarClient()
await client.tags.tag(trace_id, ["feedback"])
await client.close()
Constructor parameters:| Name | Type | Default | Description |
|---|
project_api_key | str | None | API key (defaults to LMNR_PROJECT_API_KEY) |
base_url | str | None | API base URL (defaults to LMNR_BASE_URL or https://api.lmnr.ai) |
port | int | None | API port (defaults to 443) |
timeout | int | 3600 | Request timeout (seconds) |
await client.close()
Returns: None