From cc0c342578e16a34baeb363cd7ce16980f6f8b3c Mon Sep 17 00:00:00 2001 From: Mikyo King Date: Thu, 11 Jan 2024 13:39:49 -0700 Subject: [PATCH] Add more to the READMEs --- README.md | 18 ++++++++++-------- js/README.md | 31 +++++++++++++++++++++++++------ 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8f46408fd..6c695baf0 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,16 @@ OpenInference provides a set of instrumentations for popular machine learning SD ## Python -| Package | Description | -|--------------------------------------------------------------------------------------------------------------------|-----------------------------------------------| -| [`openinference-semantic-conventions`](./python/openinference-semantic-conventions/README.md) | Semantic conventions for tracing of LLM Apps. | -| [`openinference-instrumentation-openai`](./python/instrumentation/openinference-instrumentation-openai/README.rst) | OpenInference Instrumentation for OpenAI SDK. | +Table of packages + +| Package | Description | Version | +| ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [`openinference-semantic-conventions`](./python/openinference-semantic-conventions/README.md) | Semantic conventions for tracing of LLM Apps. | [![PyPI Version](https://img.shields.io/pypi/v/openinference-semantic-conventions.svg)](https://pypi.python.org/pypi/openinference-semantic-conventions) | +| [`openinference-instrumentation-openai`](./python/instrumentation/openinference-instrumentation-openai/README.rst) | OpenInference Instrumentation for OpenAI SDK. | [![PyPI Version](https://img.shields.io/pypi/v/openinference-instrumentation-openai.svg)](https://pypi.python.org/pypi/openinference-instrumentation-openai.) | ## JavaScript -| Package | Description | -| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------- | -| [`@arizeai/openinference-semantic-conventions`](./js/packages/openinference-semantic-conventions/README.md) | Semantic conventions for tracing of LLM Apps. | -| [`@arizeai/openinference-instrumentation-openai`](./js/packages/openinference-instrumentation-openai/README.md) | OpenInference Instrumentation for OpenAI SDK. | +| Package | Description | Version | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [`@arizeai/openinference-semantic-conventions`](./js/packages/openinference-semantic-conventions/README.md) | Semantic conventions for tracing of LLM Apps. | [![NPM Version](https://img.shields.io/npm/v/@arizeai/openinference-semantic-conventions.svg)](https://www.npmjs.com/package/@arizeai/openinference-semantic-conventions) | +| [`@arizeai/openinference-instrumentation-openai`](./js/packages/openinference-instrumentation-openai/README.md) | OpenInference Instrumentation for OpenAI SDK. | [![NPM Version](https://img.shields.io/npm/v/@arizeai/openinference-instrumentation-openai)](https://www.npmjs.com/package/@arizeai/openinference-instrumentation-openai) | diff --git a/js/README.md b/js/README.md index 93d0b917e..3d6fc35dd 100644 --- a/js/README.md +++ b/js/README.md @@ -2,13 +2,32 @@ This is the JavaScript version of OpenInference, a framework for collecting traces from LLM applications. -## Development +> [!NOTE] +> Currently we only support OpenAI but we are working on adding support for other LLM frameworks and SDKs. If you are interested in contributing, please reach out to us by joining our slack community or opening an issue! -This project is built using [pnpm](https://pnpm.io/) in conjunction with [changesets](https://pnpm.io/using-changesets). To install dependencies, run `pnpm install`. - -## Publishing +## Installation ```shell -npx changeset # create a changeset -pnpm -r publish # publish to npm +npm install --save @arizeai/openinference-instrumentation-openai +``` + +## Usage + +To load the OpenAI instrumentation, specify it in the registerInstrumentations call along with any additional instrumentation you wish to enable. + +```typescript +const { NodeTracerProvider } = require("@opentelemetry/sdk-trace-node"); +const { + OpenAIInstrumentation, +} = require("@arizeai/openinference-instrumentation-openai"); +const { registerInstrumentations } = require("@opentelemetry/instrumentation"); + +const provider = new NodeTracerProvider(); +provider.register(); + +registerInstrumentations({ + instrumentations: [new OpenAIInstrumentation()], +}); ``` + +For more information on OpenTelemetry Node.js SDK, see the [OpenTelemetry Node.js SDK documentation](https://opentelemetry.io/docs/instrumentation/js/getting-started/nodejs/).