npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rungalileo/galileo

v1.1.0

Published

JS client for Galileo

Downloads

118

Readme

Galileo

JS client for Galileo.

Setup

Note: Optional LangChain dependencies are only needed for Observe Callback and may be excluded if not being used.

Without optional dependencies

npm i @rungalileo/galileo --no-optional

With optional dependencies

npm i @rungalileo/galileo

Making changes

When updating the code, only modify the *.ts files in src and then run:

  • npm run build

Examples Setup

In the root directory, run:

  • npm i
  • npm link

In the examples directory, run:

  • npm i
  • npm link @rungalileo/galileo-js

Copy examples/.env.example as examples/.env and set all variables.

Use node to run examples, e.g. node examples/evaluate/workflow.js.

Evaluate Usage

Workflow

Initialize workflow logging.

Note: If the given project name exists, workflows will be logged to that existing project. A new project will be created if the project name does not exist. A timestamped generic name will be created if no project name is set.

import { GalileoEvaluateWorkflow } from "@rungalileo/galileo-js";

const evaluateWorkflow = new GalileoEvaluateWorkflow("Evaluate Example Project"); // Accepts project name

await evaluateWorkflow.init();

Adding workflows

Workflows can be added using addWorkflow, addAgentWorkflow, and addSingleStepWorkflow.

Note: Steps and nested workflows can only be added on addWorkflow and addAgentWorkflow.

evaluateWorkflow.addWorkflow(new WorkflowStep({input, output, ...step}));

Adding steps and nested workflows

Workflow steps can be added using addLlmStep, addRetrieverStep, addToolStep, addWorkflow, and addAgentWorkflow.

evaluateWorkflow.addLlmStep(new LlmStep({input, output, ...step}));

Nested workflows can be added using addWorkflowStep and addAgentStep.

The next step you add will be a child of this workflow.

evaluateWorkflow.addWorkflowStep(new WorkflowStep({input, output, ...step}));

Concluding workflows

To end a workflow or step out of the nested workflow, use concludeWorkflow.

evaluateWorkflow.concludeWorkflow(output, durationNs, statusCode);

Uploading workflows

Use uploadWorkflows to upload workflows to Galileo Observe.

const scorers_config = {...config}

await observeWorkflows.uploadWorkflows(scorers_config);

Observe Usage

Workflow

Initialize workflow logging.

Note: If the given project name exists, workflows will be logged to that existing project. A new project will be created if the project name does not exist. A timestamped generic name will be created if no project name is set.

import { GalileoObserveWorkflow } from "@rungalileo/galileo-js";

const observeWorkflow = new GalileoObserveWorkflow("Observe Example Project"); // Accepts project name

await observeWorkflow.init();

Adding workflows

Workflows can be added using addWorkflow, addAgentWorkflow, and addSingleStepWorkflow.

Note: Steps and nested workflows can only be added on addWorkflow and addAgentWorkflow.

observeWorkflow.addWorkflow(new WorkflowStep({input, output, ...step}));

Adding steps and nested workflows

Workflow steps can be added using addLlmStep, addRetrieverStep, addToolStep, addWorkflow, and addAgentWorkflow.

observeWorkflow.addLlmStep(new LlmStep({input, output, ...step}));

Nested workflows can be added using addWorkflowStep and addAgentStep.

The next step you add will be a child of this workflow.

observeWorkflows.addWorkflowStep(new WorkflowStep({input, output, ...step}));

Concluding workflows

To end a workflow or step out of the nested workflow, use concludeWorkflow.

observeWorkflows.concludeWorkflow(output, durationNs, statusCode);

Uploading workflows

Use uploadWorkflows to upload workflows to Galileo Observe.

await observeWorkflows.uploadWorkflows();

Callback

Initialize callbacks.

import { GalileoObserveCallback } from "@rungalileo/galileo-js";

const observe_callback = new GalileoObserveCallback("Observe Example Project")

await observe_callback.init();

Add the callback {callbacks: [observe_callback]} in the Langchain invoke step of your application.

Retrieving data from Observe

Initialize the API Client.

import { ApiClient } from "@rungalileo/observe";

const apiClient = new ApiClient();

await apiClient.init("Observe Example Project");

You can use this with getLoggedData to retrieve the raw data.

const rows = await apiClient.getLoggedData(
    start_time,
    end_time,
    filters,
    sort_spec,
    limit
);

console.log(rows);

You can use getMetrics to get corresponding metrics.

const metrics = await apiClient.getMetrics(
    start_time,
    end_time,
    filters
);

console.log(metrics);