langfuse@1.0.0
This adaptor exports the following from common:
- as()
- combine()
- cursor()
- dataPath()
- dataValue()
- dateFns
- each()
- field()
- fields()
- fn()
- fnIf()
- group()
- lastReferenceValue()
- map()
- merge()
- scrubEmojis()
- sourceValue()
- util
Functions
LangfuseApiClient
LangfuseApiClient(func) ⇒ Operation
Access the langfuse client API. Accepts a callback which receives state and the client API object. See the full API reference at https://js.reference.langfuse.com/.
| Param | Type | Description |
|---|---|---|
| func | function | Callback (state, api) => state receiving the LangfuseApiClient as api |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response from the Langfuse API |
| references | an array of all previous data objects used in the Job |
Example: Fetch recent observations
langfuse(async (state, api) => {
const { data } = await api.observations.getMany({ limit: 10 });
return { ...state, data };
});
Example: List score configs
langfuse(async (state, api) => {
const { data: configs } = await api.scoreConfigs.get({ limit: 100 });
return { ...state, data: configs };
});
Example: Query aggregate metrics
langfuse(async (state, api) => {
const query = {
view: 'observations',
metrics: [{ measure: 'totalCost', aggregation: 'sum' }],
fromTimestamp: '2025-01-01T00:00:00Z',
toTimestamp: '2025-06-01T00:00:00Z',
};
const { data } = await api.metrics.metrics({ query: JSON.stringify(query) });
return { ...state, data };
});
Interfaces
LangfuseState
State object
Properties
| Name | Description |
|---|---|
| data | the parsed response from the Langfuse API |
| references | an array of all previous data objects used in the Job |