### OpenPipe Configuration Example Source: https://docs.openpipe.ai/features/criteria/quick-start Example JSON structure for configuring OpenPipe project settings, including colors, navigation, API details, and appearance. ```json { "name": "OpenPipe", "colors": { "primary": "#FF5733", "light": "#FF5733", "dark": "#FF5733" }, "favicon": "/favicon.webp", "navigation": { "groups": [ { "group": "Welcome", "pages": [ "introduction", "overview", "base-models" ] }, { "group": "Getting Started", "pages": [ "getting-started/quick-start", "getting-started/openpipe-sdk" ] }, { "group": "Features", "pages": [ { "group": "Request Logs", "pages": [ "features/request-logs/logging-requests", "features/request-logs/reporting-anthropic", "features/request-logs/exporting-logs" ] }, { "group": "Datasets", "pages": [ "features/datasets/overview", "features/datasets/quick-start", "features/datasets/importing-logs", "features/datasets/uploading-data", "features/datasets/relabeling-data", "features/datasets/exporting-data" ] }, { "group": "Fine Tuning", "pages": [ "features/fine-tuning/quick-start", "features/fine-tuning/webapp", "features/fine-tuning/api", "features/fine-tuning/reward-models" ] }, { "group": "Direct Preference Optimization (DPO)", "pages": [ "features/dpo/overview", "features/dpo/quick-start" ] }, { "group": "Evaluations", "pages": [ "features/evaluations/overview", "features/evaluations/quick-start", "features/evaluations/code", "features/evaluations/criterion", "features/evaluations/head-to-head" ] }, { "group": "Criteria", "pages": [ "features/criteria/overview", "features/criteria/quick-start", "features/criteria/alignment-set", "features/criteria/api" ] }, { "group": "Chat Completions", "pages": [ "features/chat-completions/overview", "features/chat-completions/external-models", "features/chat-completions/anthropic", "features/chat-completions/gemini", "features/chat-completions/moa" ] }, "features/caching", "features/updating-metadata", "features/pruning-rules", "features/fallback", "features/deployments", "features/external-models" ] }, { "group": "API Reference", "pages": [ { "group": "Logs", "pages": [ "api-reference/post-report", "api-reference/post-report-anthropic", "api-reference/post-updatemetadata" ] }, { "group": "Chat Completions", "pages": [ "api-reference/post-chatcompletions" ] }, { "group": "Datasets", "pages": [ "api-reference/post-createDataset", "api-reference/get-listDatasets", "api-reference/delete-dataset", "api-reference/post-createDatasetEntries" ] }, { "group": "Models", "pages": [ "api-reference/post-createModel", "api-reference/get-getModel", "api-reference/get-listModels", "api-reference/delete-model" ] }, { "group": "Criteria", "pages": [ "api-reference/post-criteriajudge" ] } ] }, { "group": "Pricing", "pages": [ "pricing/pricing" ] } ] }, "logo": { "light": "https://mintlify.s3.us-west-1.amazonaws.com/openpipe/logo/light.svg", "dark": "https://mintlify.s3.us-west-1.amazonaws.com/openpipe/logo/dark.svg" }, "api": { "openapi": [ "openapi.json" ] }, "appearance": { "default": "light" }, "navbar": { "links": [], "primary": { "type": "button", "label": "Sign In", "href": "https://app.openpipe.ai" } }, "footer": { "socials": { "twitter": "https://twitter.com/OpenPipeAI", "linkedin": "https://www.linkedin.com/company/openpipe/about/" } } } ``` -------------------------------- ### OpenPipe SDK: Quick Start Source: https://docs.openpipe.ai/features/evaluations/overview Example of how to initialize and use the OpenPipe Python SDK to log requests. ```Python from openpipe import Openpipe # Initialize the client # Ensure OPENPIPE_API_KEY and OPENPIPE_BASE_URL are set as environment variables client = Openpipe() # Log a chat completion request response = client.chat.completions.create( model="gpt-4", messages=[ {"role": "user", "content": "What is the capital of France?"} ] ) print(response.choices[0].message.content) # The request and response are automatically logged by the client. ``` -------------------------------- ### OpenPipe SDK: Quick Start Source: https://docs.openpipe.ai/features/evaluations Example of how to initialize and use the OpenPipe Python SDK to log requests. ```Python from openpipe import Openpipe # Initialize the client # Ensure OPENPIPE_API_KEY and OPENPIPE_BASE_URL are set as environment variables client = Openpipe() # Log a chat completion request response = client.chat.completions.create( model="gpt-4", messages=[ {"role": "user", "content": "What is the capital of France?"} ] ) print(response.choices[0].message.content) # The request and response are automatically logged by the client. ``` -------------------------------- ### OpenPipe SDK Quick Start Source: https://docs.openpipe.ai/features/caching Guides users on how to quickly integrate the OpenPipe SDK into their projects to start logging LLM requests and leveraging OpenPipe's features. ```bash pip install openpipe export OPENPIPE_API_KEY="YOUR_API_KEY" from openpipe import LLM llm = LLM() response = llm.chat.completions.create( model="gpt-3.5-turbo", messages=[ {"role": "user", "content": "Hello!"} ] ) print(response.choices[0].message.content) ``` -------------------------------- ### OpenPipe Documentation Configuration Source: https://docs.openpipe.ai/features/fine-tuning/quick-start Configuration for the OpenPipe documentation site, specifying theme, colors, favicon, and navigation structure. It details the organization of content into sections like Welcome, Getting Started, Features (Request Logs, Datasets, Fine Tuning, DPO), and Evaluations. ```APIDOC docsConfig: $schema: "https://mintlify.com/docs.json" theme: "mint" name: "OpenPipe" colors: primary: "#FF5733" light: "#FF5733" dark: "#FF5733" favicon: "/favicon.webp" navigation: groups: - group: "Welcome" pages: - "introduction" - "overview" - "base-models" - group: "Getting Started" pages: - "getting-started/quick-start" - "getting-started/openpipe-sdk" - group: "Features" pages: - group: "Request Logs" pages: - "features/request-logs/logging-requests" - "features/request-logs/reporting-anthropic" - "features/request-logs/exporting-logs" - group: "Datasets" pages: - "features/datasets/overview" - "features/datasets/quick-start" - "features/datasets/importing-logs" - "features/datasets/uploading-data" - "features/datasets/relabeling-data" - "features/datasets/exporting-data" - group: "Fine Tuning" pages: - "features/fine-tuning/quick-start" - "features/fine-tuning/webapp" - "features/fine-tuning/api" - "features/fine-tuning/reward-models" - group: "Direct Preference Optimization (DPO)" pages: - "features/dpo/overview" - "features/dpo/quick-start" - group: "Evaluations" pages: - "features/evaluations/overview" ``` -------------------------------- ### Fine-Tuning Quick Start Metadata Source: https://docs.openpipe.ai/features/fine-tuning/quick-start Metadata associated with the Fine-Tuning Quick Start guide, including title, sidebar title, and a brief description. ```APIDOC pageMetadata: title: Fine-Tuning Quick Start sidebarTitle: Quick Start description: Train your first fine-tuned model with OpenPipe. href: /features/fine-tuning/quick-start ``` -------------------------------- ### OpenPipe Introduction Page Structure Source: https://docs.openpipe.ai/features/fine-tuning/overview This snippet describes the structure and metadata for the OpenPipe introduction page. It includes links to key sections like 'Get Started', 'Features', and a 'Sample Project' for users to explore the platform's capabilities. ```mdx "use strict"; const {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0]; const {useMDXComponents: _provideComponents} = arguments[0]; function _createMdxContent(props) { const _components = { img: "img", p: "p", ..._provideComponents(), ...props.components }, {Card, CardGroup, Frame} = _components; if (!Card) _missingMdxReference("Card", true); if (!CardGroup) _missingMdxReference("CardGroup", true); if (!Frame) _missingMdxReference("Frame", true); return _jsxs(_Fragment, { children: [_jsx(Frame, { children: _jsx(_components.img, { src: "https://mintlify.s3.us-west-1.amazonaws.com/openpipe/images/intro/dataset-general.png", alt: "" }) }), "\n", _jsxs(CardGroup, { cols: 2, children: [_jsx(Card, { title: "Get Started", icon: "code", href: "/getting-started/quick-start", children: _jsx(_components.p, { children: "Quickly integrate the OpenPipe SDK into your application and start collecting data." }) }), _jsx(Card, { title: "Features", icon: "lightbulb", href: "/overview#what-we-provide", children: _jsx(_components.p, { children: "View the platform features OpenPipe provides and learn how to use them." }) }), _jsx(Card, { title: "Sample Project", icon: "vial", href: "https://app.openpipe.ai/p/BRZFEx50Pf/request-logs", children: _jsx(_components.p, { children: "Glance over the public demo we’ve set up to get an idea for how OpenPipe works." }) })] })] }); } function MDXContent(props = {}) { const {wrapper: MDXLayout} = { ..._provideComponents(), ...props.components }; return MDXLayout ? _jsx(MDXLayout, { ...props, children: _jsx(_createMdxContent, { ...props }) }) : _createMdxContent(props); } return { default: MDXContent }; function _missingMdxReference(id, component) { throw new Error("Expected " + (component ? "com" } ``` -------------------------------- ### OpenPipe Documentation Configuration Source: https://docs.openpipe.ai/features/fine-tuning Configuration for the OpenPipe documentation site, specifying theme, colors, favicon, and navigation structure. It details the organization of content into sections like Welcome, Getting Started, Features (Request Logs, Datasets, Fine Tuning, DPO), and Evaluations. ```APIDOC docsConfig: $schema: "https://mintlify.com/docs.json" theme: "mint" name: "OpenPipe" colors: primary: "#FF5733" light: "#FF5733" dark: "#FF5733" favicon: "/favicon.webp" navigation: groups: - group: "Welcome" pages: - "introduction" - "overview" - "base-models" - group: "Getting Started" pages: - "getting-started/quick-start" - "getting-started/openpipe-sdk" - group: "Features" pages: - group: "Request Logs" pages: - "features/request-logs/logging-requests" - "features/request-logs/reporting-anthropic" - "features/request-logs/exporting-logs" - group: "Datasets" pages: - "features/datasets/overview" - "features/datasets/quick-start" - "features/datasets/importing-logs" - "features/datasets/uploading-data" - "features/datasets/relabeling-data" - "features/datasets/exporting-data" - group: "Fine Tuning" pages: - "features/fine-tuning/quick-start" - "features/fine-tuning/webapp" - "features/fine-tuning/api" - "features/fine-tuning/reward-models" - group: "Direct Preference Optimization (DPO)" pages: - "features/dpo/overview" - "features/dpo/quick-start" - group: "Evaluations" pages: - "features/evaluations/overview" ``` -------------------------------- ### OpenPipe Introduction Page Structure Source: https://docs.openpipe.ai/api-reference/fine-tuning This snippet describes the structure and metadata for the OpenPipe introduction page. It includes links to key sections like 'Get Started', 'Features', and a 'Sample Project' for users to explore the platform's capabilities. ```mdx "use strict"; const {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0]; const {useMDXComponents: _provideComponents} = arguments[0]; function _createMdxContent(props) { const _components = { img: "img", p: "p", ..._provideComponents(), ...props.components }, {Card, CardGroup, Frame} = _components; if (!Card) _missingMdxReference("Card", true); if (!CardGroup) _missingMdxReference("CardGroup", true); if (!Frame) _missingMdxReference("Frame", true); return _jsxs(_Fragment, { children: [_jsx(Frame, { children: _jsx(_components.img, { src: "https://mintlify.s3.us-west-1.amazonaws.com/openpipe/images/intro/dataset-general.png", alt: "" }) }), "\n", _jsxs(CardGroup, { cols: 2, children: [_jsx(Card, { title: "Get Started", icon: "code", href: "/getting-started/quick-start", children: _jsx(_components.p, { children: "Quickly integrate the OpenPipe SDK into your application and start collecting data." }) }), _jsx(Card, { title: "Features", icon: "lightbulb", href: "/overview#what-we-provide", children: _jsx(_components.p, { children: "View the platform features OpenPipe provides and learn how to use them." }) }), _jsx(Card, { title: "Sample Project", icon: "vial", href: "https://app.openpipe.ai/p/BRZFEx50Pf/request-logs", children: _jsx(_components.p, { children: "Glance over the public demo we’ve set up to get an idea for how OpenPipe works." }) })] })] }); } function MDXContent(props = {}) { const {wrapper: MDXLayout} = { ..._provideComponents(), ...props.components }; return MDXLayout ? _jsx(MDXLayout, { ...props, children: _jsx(_createMdxContent, { ...props }) }) : _createMdxContent(props); } return { default: MDXContent }; function _missingMdxReference(id, component) { throw new Error("Expected " + (component ? "com" } ``` -------------------------------- ### Criterion Prompt Example Source: https://docs.openpipe.ai/features/criteria/quick-start An example prompt template for an AI judge to evaluate LLM outputs based on language consistency between input and output. It specifies the expected format for passing or failing the criterion and highlights key templated variables. ```prompt Ask AI Mark the criteria as passed if the input and output are the same language. Mark it as failed if they are in different languages. Make sure to use the terms `input`, `output`, `passed`, and `failed` in your prompt to match our internal templating. ``` -------------------------------- ### OpenPipe Introduction Cards Source: https://docs.openpipe.ai/features/fine-tuning/overview Renders introductory cards for the OpenPipe documentation, linking to key sections like 'Get Started', 'Features', and a 'Sample Project'. It uses components like Frame, Card, and CardGroup, likely within an MDX environment. ```javascript use strict; const {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0]; const {useMDXComponents: _provideComponents} = arguments[0]; function _createMdxContent(props) { const _components = { img: "img", p: "p", ..._provideComponents(), ...props.components }; if (!Card) _missingMdxReference("Card", true); if (!CardGroup) _missingMdxReference("CardGroup", true); if (!Frame) _missingMdxReference("Frame", true); return _jsxs(_Fragment, { children: ["\n", _jsx(Frame, { children: _jsx(_components.img, { src: "https://mintlify.s3.us-west-1.amazonaws.com/openpipe/images/intro/dataset-general.png", alt: "" }) }), "\n", _jsxs(CardGroup, { cols: 2, children: ["\n", _jsx(Card, { title: "Get Started", icon: "code", href: "/getting-started/quick-start", children: _jsx(_components.p, { children: "Quickly integrate the OpenPipe SDK into your application and start collecting data." }) }), "\n", _jsx(Card, { title: "Features", icon: "lightbulb", href: "/overview#what-we-provide", children: _jsx(_components.p, { children: "View the platform features OpenPipe provides and learn how to use them." }) }), "\n", _jsx(Card, { title: "Sample Project", icon: "vial", href: "https://app.openpipe.ai/p/BRZFEx50Pf/request-logs", children: _jsx(_components.p, { children: "Glance over the public demo we’ve set up to get an idea for how OpenPipe works." }) }), "\n"] })] }); } function MDXContent(props = {}) { const {wrapper: MDXLayout} = { ..._provideComponents(), ...props.components }; return MDXLayout ? _jsx(MDXLayout, { ...props, children: _jsx(_createMdxContent, { ...props }) }) : _createMdxContent(props); } return { default: MDXContent }; function _missingMdxReference(id, component) { throw new Error("Expected " + (component ? "component" : "object") + " `" + id + "` to be defined: you likely forgot to import, pass, or provide it."); } ``` -------------------------------- ### Complete Example: Using OpenPipe with OpenAI and Metadata Tagging Source: https://docs.openpipe.ai/getting-started/openpipe-sdk A comprehensive Python example illustrating the import of both OpenPipe's OpenAI client and the 'os' module. It shows client initialization and hints at potential usage patterns, including setting up for metadata tagging, which is key for prompt management and fine-tuning. ```python from openpipe import OpenAI import os client = OpenAI( # You can optionally pass in the API key, otherwise it will be read from the OPENAI_API_KEY environment variable. # api_key="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", ) ``` -------------------------------- ### Evaluations Source: https://docs.openpipe.ai/features/criteria/alignment-set Guides for performing evaluations, including overview, quick start, code examples, criteria, and head-to-head comparisons. ```markdown features/evaluations/overview features/evaluations/quick-start features/evaluations/code features/evaluations/criterion features/evaluations/head-to-head ``` -------------------------------- ### Fine-Tuning Quick Start Metadata Source: https://docs.openpipe.ai/features/fine-tuning Metadata associated with the Fine-Tuning Quick Start guide, including title, sidebar title, and a brief description. ```APIDOC pageMetadata: title: Fine-Tuning Quick Start sidebarTitle: Quick Start description: Train your first fine-tuned model with OpenPipe. href: /features/fine-tuning/quick-start ``` -------------------------------- ### Python OpenAI SDK Example Source: https://docs.openpipe.ai/features/criteria/api This snippet shows a basic example of using the OpenAI SDK in Python. It demonstrates accessing a completion choice, likely from a chat or completion API call. Ensure the OpenAI library is installed (`pip install openai`). ```python from openpipe.openai import OpenAI # Find the config values in "Installing the SDK" client = OpenAI() completion = await client.chat.completions.create( messages=[ {"role": "user", "content": "Say this is a test"} ], model="gpt-3.5-turbo", ) best_response = completion.choices[0].message.content ``` -------------------------------- ### Get Criterion Judgement (Python SDK) Source: https://docs.openpipe.ai/features/criteria/api Example of using the OpenPipe Python SDK to get a criterion judgement for a previously generated output. Requires an initialized OpenPipe client. ```Python from openpipe.client import OpenPipe op_client = OpenPipe() result = op_client.get_criterion_judgement( criterion_id="criterion-1@v1", # if no version is specified, the latest version is used input={"messages": messages}, output=output, ) ``` -------------------------------- ### OpenPipe Configuration Example Source: https://docs.openpipe.ai/getting-started/openpipe-sdk An example snippet demonstrating how to configure OpenPipe, likely within a JavaScript or TypeScript environment. It shows setting up key-value pairs for prompts and other data. ```javascript { "prompt_id": "counting", "any_key": "any_value" } ``` -------------------------------- ### Node.js LLM Integration Example Source: https://docs.openpipe.ai/features/request-logs/logging-requests Example of importing and using the OpenAI library in a Node.js (TypeScript) environment. This snippet shows the basic setup for making LLM calls. ```typescript import OpenAI from "openai"; const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY, }); async function main() { const completion = await openai.chat.completions.create({ messages: [ { role: "system", content: "You are a helpful assistant.", }, { role: "user", content: "Hello world", }, ], model: "gpt-4", }); console.log(completion.choices[0].message); } main(); ``` -------------------------------- ### Node.js LLM Integration Example Source: https://docs.openpipe.ai/features/request-logs Example of importing and using the OpenAI library in a Node.js (TypeScript) environment. This snippet shows the basic setup for making LLM calls. ```typescript import OpenAI from "openai"; const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY, }); async function main() { const completion = await openai.chat.completions.create({ messages: [ { role: "system", content: "You are a helpful assistant.", }, { role: "user", content: "Hello world", }, ], model: "gpt-4", }); console.log(completion.choices[0].message); } main(); ``` -------------------------------- ### OpenPipe API Reference: Criteria Source: https://docs.openpipe.ai/features/criteria/quick-start Documentation for OpenPipe API endpoints related to criteria management, including creating, aligning, and deploying criteria. This section details the available operations and their usage. ```APIDOC OpenPipe API Reference: Criteria This section details the API endpoints for managing criteria within OpenPipe. ## Criteria Management ### Creating a Criterion - **Endpoint:** `/criteria` (POST) - **Description:** Creates a new criterion. - **Request Body:** ```json { "name": "string", "description": "string", "type": "string" // e.g., "classification", "comparison" } ``` - **Returns:** The created criterion object with its ID. ### Aligning a Criterion - **Endpoint:** `/criteria/{criterionId}/align` (POST) - **Description:** Aligns a criterion with dataset examples. - **Request Body:** ```json { "datasetId": "string", "alignmentExamples": [ { "input": "string", "output": "string", "label": "boolean" // true for positive, false for negative } ] } ``` - **Returns:** Status of the alignment operation. ### Deploying a Criterion - **Endpoint:** `/criteria/{criterionId}/deploy` (POST) - **Description:** Deploys a trained criterion for use in evaluations or runtime. - **Returns:** Confirmation of deployment. ### Runtime Evaluation (Example) - **Endpoint:** `/evaluate` (POST) - **Description:** Evaluates LLM outputs against deployed criteria. - **Request Body:** ```json { "prompt": "string", "response": "string", "criteriaIds": ["string"] } ``` - **Returns:** Evaluation results for each criterion. **Related Endpoints:** - GET /criteria: List all criteria. - GET /criteria/{criterionId}: Get details of a specific criterion. - DELETE /criteria/{criterionId}: Delete a criterion. ``` -------------------------------- ### Mintlify Configuration Schema Source: https://docs.openpipe.ai/features/fine-tuning/quick-start Configuration schema for Mintlify, defining site name, logo, favicon, OpenAPI integration, color themes, top bar elements, and navigation structure. ```APIDOC { "$schema": "https://mintlify.com/schema.json", "name": "OpenPipe", "logo": "$10:props:docsConfig:logo", "favicon": "/favicon.webp", "openapi": "$10:props:docsConfig:api:openapi", "modeToggle": { "default": "light" }, "colors": { "primary": "#FF5733", "light": "#FF5733", "dark": "#FF5733" }, "topbarCtaButton": { "name": "Sign In", "url": "https://app.openpipe.ai" }, "topbarLinks": [], "navigation": [ { "group": "Welcome", "pages": "$10:props:docsConfig:navigation:groups:0:pages" }, { "group": "Getting Started", "pages": "$10:props:docsConfig:navigation:groups:1:pages" }, { "group": "Features", "pages": "$10:props:docsConfig:navigation:groups:2:pages" }, { "group": "API Reference", "pages": "$10:props:docsConfig:navigation:groups:3:pages" }, { "group": "Pricing", "pages": "$10:props:docsConfig:navigation:groups:4:pages" } ], "anchors": [], "footerSocials": "$10:props:docsConfig:footer:socials" } ``` -------------------------------- ### OpenPipe OpenAI Client Initialization and Usage Source: https://docs.openpipe.ai/getting-started/openpipe-sdk Provides a comprehensive TypeScript example for initializing and using the OpenPipe OpenAI client. It showcases how to set up the client and make requests, including the crucial step of adding metadata tags for better organization and fine-tuning. ```typescript import OpenAI from "openpipe/openai"; // Fully compatible with original OpenAI initialization const OpenAI = require("openpipe/openai").default; const openai = new OpenAI({ // You can pass in any of the original OpenAI client options here // For example: // apiKey: "YOUR_API_KEY", // organization: "YOUR_ORG_ID", }); async function main() { const stream = openai.chat.completions.create({ model: "gpt-3.5-turbo", messages: [ { role: "user", content: "Hello world" }, ], // Add metadata tags to your requests metadata: { // You can add any key-value pairs here // We recommend assigning a unique tag to each prompt prompt_tag: "hello-world-prompt", // You can also add other relevant information user_id: "user-123", }, }); // Process the stream as usual for await (const chunk of stream) { console.log(chunk.choices[0]?.delta?.content || ""); } } main(); ``` -------------------------------- ### NodeJS OpenAI SDK Example Source: https://docs.openpipe.ai/features/criteria/api This snippet demonstrates how to use the OpenAI SDK in NodeJS (TypeScript). It covers importing the client, initializing it, and making a chat completion request. The example assumes you have the `openpipe/openai` package installed and your API key configured. ```typescript import OpenAI from "openpipe/openai"; // Find the config values in "Installing the SDK" const client = OpenAI(); const completion = await client.chat.completions.create({ messages: [ {"role": "user", "content": "Say this is a test"}, ], model: "gpt-3.5-turbo", }); best_response = completion.choices[0].message.content; ``` -------------------------------- ### Initialize OpenAI Client and Use Metadata Source: https://docs.openpipe.ai/getting-started/openpipe-sdk Provides a complete example of initializing the OpenAI client with an API key. It also highlights the compatibility with standard OpenAI initialization and the concept of metadata tagging for requests, which helps in organizing data for fine-tuning. ```typescript // Fully compatible with original OpenAI initialization const openai = new OpenAI({ apiKey: "my api key", }); ``` -------------------------------- ### Python Example for Metadata Tagging Source: https://docs.openpipe.ai/getting-started/openpipe-sdk This Python code snippet demonstrates how to initialize the OpenAI client with an API key and configure OpenPipe settings, including passing metadata for requests. It shows the necessary import statements and client initialization for using OpenPipe's features. ```python from openpipe import OpenAI import os client = OpenAI( # defaults to os.environ.get("OPENAI_API_KEY") api_key="My API Key", openpipe={ # defaults to os.environ.get("OPENPIPE_API_KEY") } ``` -------------------------------- ### API Reference: Dataset Management Source: https://docs.openpipe.ai/features/fine-tuning/quick-start APIs for managing datasets, including creation, listing, deletion, and adding entries to datasets. ```APIDOC POST /api-reference/post-createDataset Description: Creates a new dataset. GET /api-reference/get-listDatasets Description: Retrieves a list of all datasets. DELETE /api-reference/delete-dataset Description: Deletes a specified dataset. POST /api-reference/post-createDatasetEntries Description: Adds entries to an existing dataset. ``` -------------------------------- ### Direct Preference Optimization (DPO) Source: https://docs.openpipe.ai/features/criteria/alignment-set Information on Direct Preference Optimization (DPO), covering its overview and quick start guide. ```markdown features/dpo/overview features/dpo/quick-start ``` -------------------------------- ### Example Code Snippet with Score Calculation Source: https://docs.openpipe.ai/features/evaluations/code A snippet demonstrating how a score is calculated and returned. It includes comments indicating the start and end of the implementation and shows variable assignments for score. ```jsx // start implementation let score = 0.0; // end implementation return score; ``` -------------------------------- ### Project Configuration Data Source: https://docs.openpipe.ai/features/fine-tuning/quick-start Contains essential configuration parameters for the application, including the active subdomain, theme settings, and internal analytics keys. This data is crucial for application initialization and functionality. ```javascript { "initialBanner": null, "config": "$undefined", "subdomain": "openpipe", "children": [ { "theme": "mint" }, { "docsConfig": "$10:props:docsConfig", "subdomain": "openpipe", "internalAnalyticsWriteKey": "phc_TXdpocbGVeZVm5VJmAsHTMrCofBQu3e0kN8HGMNGTVW", "org": { "plan": "startup", "createdAt": "2023-08-14T22:03:53.804Z" } } ] } ``` -------------------------------- ### Fine-Tuning Models Source: https://docs.openpipe.ai/features/criteria/alignment-set Guides on fine-tuning models, including quick start, web app usage, API integration, and reward models. ```markdown features/fine-tuning/quick-start features/fine-tuning/webapp features/fine-tuning/api features/fine-tuning/reward-models ``` -------------------------------- ### JavaScript Configuration Example Source: https://docs.openpipe.ai/getting-started/openpipe-sdk Demonstrates a typical configuration object structure used in JavaScript for OpenPipe, specifying prompt identifiers, custom keys, and data storage settings. ```javascript { prompt_id: "counting", any_key: "any_value", store: true // Enable/disable data collection. Defaults to true. } ``` -------------------------------- ### Call LLM Chat Completions Source: https://docs.openpipe.ai/features/request-logs/logging-requests Example of calling the LLM chat completions API using a client object. It demonstrates an asynchronous operation to get a completion based on a provided payload. ```javascript const completion = await client.chat.completions.create(payload); ``` -------------------------------- ### Initialize OpenPipe OpenAI Client (TypeScript) Source: https://docs.openpipe.ai/getting-started/openpipe-sdk Demonstrates importing and initializing the OpenAI client from the openpipe/openai library. It highlights compatibility with the original OpenAI client setup, including API key configuration, and notes that the OpenPipe key is optional. ```typescript import OpenAI from "openpipe/openai"; // Fully compatible with original OpenAI initialization const openai = new OpenAI({ apiKey: "my api key", // defaults to process.env["OPENAI_API_KEY"] // openpipe key is optional }); ``` -------------------------------- ### Basic Python Integration Example Source: https://docs.openpipe.ai/getting-started/openpipe-sdk Demonstrates a basic integration of the OpenPipe SDK within a Python application. This example shows how to replace standard OpenAI calls with OpenPipe SDK calls to enable automatic recording. ```python # Replace this line # Example of how to use the OpenPipe SDK in Python. # This snippet shows how to replace generic OpenAI calls with OpenPipe calls. ``` -------------------------------- ### Call LLM Chat Completions Source: https://docs.openpipe.ai/features/request-logs Example of calling the LLM chat completions API using a client object. It demonstrates an asynchronous operation to get a completion based on a provided payload. ```javascript const completion = await client.chat.completions.create(payload); ``` -------------------------------- ### OpenAI Client Initialization with OpenPipe Source: https://docs.openpipe.ai/getting-started/openpipe-sdk Shows how to initialize the OpenAI client using the OpenPipe library. This setup is necessary before making any API calls or utilizing OpenPipe's features for logging and management. ```python from openpipe import OpenAI client = OpenAI( # You can optionally pass in the API key, otherwise it will be read from the OPENAI_API_KEY environment variable. # api_key="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", ) ``` -------------------------------- ### OpenPipe Documentation Navigation Structure Source: https://docs.openpipe.ai/features/criteria/quick-start Metadata for the OpenPipe documentation site's navigation, including page titles, descriptions, and hierarchical grouping. This structure guides users through the documentation content. ```json { "global": "$undefined", "groups": [ { "group": "Welcome", "pages": [ { "title": "OpenPipe Documentation", "sidebarTitle": "Introduction", "description": "Software engineers and data scientists use OpenPipe's intuitive fine-tuning and monitoring services to decrease the cost and latency of their LLM operations. You can use OpenPipe to collect and analyze LLM logs, create fine-tuned models, and compare output from multiple models given the same input.", "href": "/introduction" }, { "title": "Overview", "description": "OpenPipe is a streamlined platform designed to help product-focused teams train specialized LLM models as replacements for slow and expensive prompts.", "href": "/overview" }, { "title": "Base Models", "description": "Train and compare across a range of the most powerful base models.", "href": "/base-models" } ] }, { "group": "Getting Started", "pages": [ { "title": "Quick Start", "description": "Get started with OpenPipe in a few quick steps.", "href": "/getting-started/quick-start" }, { "title": "Installing the SDK", "description": null, "href": "/getting-started/openpipe-sdk" } ] }, { "group": "Features", "pages": [ { "group": "Request Logs", "pages": [ { "title": "Logging Requests", "description": "Record production data to train and improve your models' performance.", "href": "/features/request-logs/logging-requests" }, { "title": "Logging Anthropic Requests", "description": null, "href": "/features/request-logs/reporting-anthropic" }, { "title": "Exporting Logs", "sidebarTitle": "Exporting Logs", "description": "Export your past requests as a JSONL file in their raw form.", "href": "/features/request-logs/exporting-logs" } ] }, { "group": "Datasets", "pages": [ { "title": "Datasets", "sidebarTitle": "Overview", "description": "Collect, evaluate, and refine your training data.", "href": "/features/datasets/overview" }, { "title": "Datasets Quick Start", "sidebarTitle": "Quick Start", "description": "Create your first dataset and import training data.", "href": "/features/datasets/quick-start" }, { "title": "Importing Request Logs", "description": "Search and filter your past LLM requests to inspect your responses and build a training dataset.", "href": "/features/datasets/importing-logs" }, { "title": "Uploading Data", "sidebarTitle": "Uploading Data", "description": "Upload external data to kickstart your fine-tuning process. Use the OpenAI chat fine-tuning format.", "href": "/features/datasets/uploading-data" }, { "title": "Relabeling Data", "sidebarTitle": "Relabeling Data", "description": "Use powerful models to generate new outputs for your data before training.", "href": "/features/datasets/relabeling-data" } ] } ] } ] } ``` -------------------------------- ### OpenPipe Configuration Source: https://docs.openpipe.ai/features/fine-tuning/quick-start Configuration details for the OpenPipe documentation site, including Git source, Inkeep integration, Trieve settings, entitlements, and build information. ```javascript { "subdomain": "openpipe", "actualSubdomain": "openpipe", "gitSource": { "type": "github", "owner": "openpipe", "repo": "code", "deployBranch": "main", "contentDirectory": "docs", "isPrivate": false }, "inkeep": { "integrationApiKey": "0fac7bd9ebc2c4fe56cb5e15956b73ac06b84c8b48d802d4" }, "trieve": { "chatEnabled": true, "datasetId": "bd0474fa-b273-45d0-8084-48802023fb4a" }, "entitlements": { "AI_CHAT": { "status": "ENABLED" } }, "buildId": "684b20912dd44b5d70535706:success", "clientVersion": "0.0.1482" } ```