Search is not available for this dataset
repo_id stringlengths 12 110 | file_path stringlengths 24 164 | content stringlengths 3 89.3M | __index_level_0__ int64 0 0 |
|---|---|---|---|
public_repos/langsmith-cookbook/typescript-testing-examples/simple-test | public_repos/langsmith-cookbook/typescript-testing-examples/simple-test/src/index.ts | import {
ChatPromptTemplate,
HumanMessagePromptTemplate,
SystemMessagePromptTemplate,
} from "langchain/prompts";
import { ChatOpenAI } from "langchain/chat_models/openai";
import { StringOutputParser } from "langchain/schema/output_parser";
/**
* Returns a chain that prompts the user to write a rap battle res... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples/simple-test | public_repos/langsmith-cookbook/typescript-testing-examples/simple-test/tests/index.test.ts | import { Client } from "langsmith";
import { expect } from "./jest_helper";
import { getChain } from "../src/index";
// Supported in versions >= 0.0.139
import { RunCollectorCallbackHandler } from "langchain/callbacks";
const client = new Client();
function parseAndLog(runId: string, actual: any): void {
try {
... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples/simple-test | public_repos/langsmith-cookbook/typescript-testing-examples/simple-test/tests/jest_helper.ts | import jestExpect from "expect";
import { Client } from "langsmith";
const client = new Client();
/**
* A wrapper for jest's expect to include LangSmith logging.
* @param actual - Actual value to be expected
* @param options - An object containing the following properties:
* - `runId` (string): Run ID from LangS... | 0 |
public_repos/langsmith-cookbook | public_repos/langsmith-cookbook/_scripts/test-cookbooks.py | import argparse
import contextlib
import os
import glob
import re
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
from langsmith import Client
filter_list = [
"llm_run_etl.ipynb",
"lilac.ipynb",
"fine-tuning-on-chat-runs.ipynb",
]
API_KEY_REGEX = r'os\.environ\["LANGCHAIN_API_KEY"\... | 0 |
public_repos/langsmith-cookbook | public_repos/langsmith-cookbook/_scripts/requirements.txt | nbformat
nbconvert
pandas
langchain
textstat
langsmith
langchainhub
anthropic
chromadb
tiktoken
html2text
tabulate
jupyter
openai | 0 |
public_repos/langsmith-cookbook | public_repos/langsmith-cookbook/feedback-examples/README.md | ---
sidebar_label: Feedback
sidebar_position: 6
---
# Feedback
Harness user [feedback](https://docs.smith.langchain.com/evaluation/capturing-feedback), ai-assisted feedback, and other signals to improve, monitor, and personalize your applications:
- [Streamlit Chat App](./streamlit/README.md): a minimal chat app tha... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/streamlit/expression_chain.py | from datetime import datetime
from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain.schema.runnable import Runnable, RunnableMap
from langchain.memory import ConversationBufferMemory
def get_expression_chain(
system_prompt: str, memory: ... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/streamlit/vanilla_chain.py | from datetime import datetime
from langchain import LLMChain
from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain.memory import ConversationBufferMemory
def get_llm_chain(system_prompt: str, memory: ConversationBufferMemory) -> LLMChain:
... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/streamlit/main.py | import streamlit as st
from langchain.callbacks.manager import collect_runs
from langchain import memory as lc_memory
from langsmith import Client
from streamlit_feedback import streamlit_feedback
from expression_chain import get_expression_chain
client = Client()
st.set_page_config(
page_title="Capturing User Fe... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/streamlit/requirements.txt | langchain>=0.0.321
streamlit>=1.27
langsmith>=0.0.49
openai
anthropic
| 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/streamlit/README.md | # Collect User Feedback in Streamlit
[](https://github.com/langchain-ai/langsmith-cookbook/tree/main/./feedback-examples/streamlit/README.md)
In this example, you will create a ChatGPT-like web app in Streamlit that supports streaming, cus... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/streamlit-agent/main.py | """Example implementation of a LangChain Agent."""
import logging
from datetime import datetime
from functools import partial
import streamlit as st
from langchain.agents import AgentExecutor
from langchain.agents.format_scratchpad import format_to_openai_functions
from langchain.agents.output_parsers.openai_functions... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/streamlit-agent/requirements.txt | langchain>=0.0.331
streamlit>=1.27
langsmith>=0.0.60
streamlit-feedback==0.1.2
openai
# For the retriever
duckduckgo-search
| 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/streamlit-agent/README.md | # LangChain Agents with LangSmith
[](https://github.com/langchain-ai/langsmith-cookbook/tree/main/./feedback-examples/streamlit-agent/README.md)
This streamlit walkthrough shows how to instrument a LangChain agent with tracing and feedback... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/algorithmic-feedback/algorithmic_feedback.ipynb | import os
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" # Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key
os.environ["LANGCHAIN_HUB_API_URL"] = "https://api.hub.langchain.com" # Update with your API URL... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/streamlit-realtime-feedback/main.py | import logging
from typing import Optional
import streamlit as st
st.set_page_config(
page_title="Realtime Evaluation of Production Runs",
page_icon="🦜️️🛠️",
)
from chain import MEMORY, get_chain
from langchain.callbacks import tracing_v2_enabled
from langchain.callbacks.tracers.evaluation import Evaluator... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/streamlit-realtime-feedback/requirements.txt | langchain>=0.0.321
streamlit>=1.27
langsmith>=0.0.49
openai
anthropic
# For the retriever
tiktoken
html2text
chromadb
bs4
| 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/streamlit-realtime-feedback/README.md | # Real-time RAG Chat Bot Evaluation
[](https://github.com/langchain-ai/langsmith-cookbook/tree/main/./feedback-examples/streamlit-realtime-feedback/README.md)
This tutorial shows how to catch model hallucinations in production using a cust... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/streamlit-realtime-feedback/chain.py | import uuid
from operator import itemgetter
import streamlit as st
from langchain.chat_models import ChatAnthropic
from langchain.document_loaders import RecursiveUrlLoader
from langchain.document_transformers import Html2TextTransformer
from langchain.embeddings import OpenAIEmbeddings
from langchain.memory import Co... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/realtime-algorithmic-feedback/realtime_feedback.ipynb | %pip install -U langchain openai --quietimport os
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" # Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key
os.environ["... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/nextjs/yarn.lock | # This file is generated by running "yarn install" inside your project.
# Manual changes might be lost - proceed with caution!
__metadata:
version: 6
cacheKey: 8
"@aashutoshrathi/word-wrap@npm:^1.2.3":
version: 1.2.6
resolution: "@aashutoshrathi/word-wrap@npm:1.2.6"
checksum: ada901b9e7c680d190f1d012c84217c... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/nextjs/.eslintrc.json | {
"extends": "next/core-web-vitals"
}
| 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/nextjs/tailwind.config.ts | import type { Config } from 'tailwindcss'
const config: Config = {
content: [
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/nextjs/tsconfig.json | {
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"re... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/nextjs/postcss.config.js | module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
| 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/nextjs/.env.example | LANGCHAIN_TRACING_V2="true"
LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
LANGCHAIN_API_KEY="YOUR_LANGSMITH_API_KEY_HERE"
LANGCHAIN_PROJECT="YOUR_PROJECT_HERE"
OPENAI_API_KEY="YOUR_OPENAI_API_KEY_HERE" | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/nextjs/next.config.js | /** @type {import('next').NextConfig} */
const nextConfig = {}
module.exports = nextConfig
| 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/nextjs/README.md | # LangSmith Next.js Chat UI Example
[](https://github.com/langchain-ai/langsmith-cookbook/tree/main/./feedback-examples/nextjs/README.md)
[](https://vercel.com/new/clone?repository-url=https%... | 0 |
public_repos/langsmith-cookbook/feedback-examples | public_repos/langsmith-cookbook/feedback-examples/nextjs/package.json | {
"name": "nextjs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"format": "prettier --write \"app\""
},
"dependencies": {
"@types/node": "20.5.0",
"@types/react": "18.2.20",
"@types/re... | 0 |
public_repos/langsmith-cookbook/feedback-examples/nextjs | public_repos/langsmith-cookbook/feedback-examples/nextjs/app/layout.tsx | import "./globals.css";
import { Public_Sans } from "next/font/google";
const publicSans = Public_Sans({ subsets: ["latin"] });
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<head>
<title>LangSmith Feedback Example</title>
... | 0 |
public_repos/langsmith-cookbook/feedback-examples/nextjs | public_repos/langsmith-cookbook/feedback-examples/nextjs/app/page.tsx | import { ChatWindow } from "@/components/ChatWindow";
export default function Home() {
const InfoCard = (
<div className="p-4 md:p-8 rounded bg-[#25252d] w-full max-h-[85%] overflow-hidden">
<h1 className="text-3xl md:text-4xl mb-4">
⚒️ LangSmith + Next.js Feedback Example 🦜🔗
</h1>
<u... | 0 |
public_repos/langsmith-cookbook/feedback-examples/nextjs | public_repos/langsmith-cookbook/feedback-examples/nextjs/app/globals.css | @tailwind base;
@tailwind components;
@tailwind utilities;
body {
color: #f8f8f8;
background: #131318;
}
body input,
body textarea {
color: black;
}
a {
color: #2d7bd4;
}
a:hover {
border-bottom: 1px solid;
}
p {
margin: 8px 0;
}
code {
color: #ffa500;
}
code a {
color: #ffa500;
}
li {
padding... | 0 |
public_repos/langsmith-cookbook/feedback-examples/nextjs/app/api | public_repos/langsmith-cookbook/feedback-examples/nextjs/app/api/feedback/route.ts | import { NextRequest, NextResponse } from "next/server";
import { Client } from "langsmith";
export const runtime = "edge";
const langsmithClient = new Client();
/**
* This handler creates feedback for a LangSmith trace.
*/
export async function POST(req: NextRequest) {
try {
const body = await req.json();
... | 0 |
public_repos/langsmith-cookbook/feedback-examples/nextjs/app/api | public_repos/langsmith-cookbook/feedback-examples/nextjs/app/api/trace/route.ts | import { NextRequest, NextResponse } from "next/server";
import { Client } from "langsmith";
export const runtime = "edge";
const langsmithClient = new Client();
/**
* This handler retrieves a LangSmith trace URL for the given run.
* It isn't used by default, but if you'd like to turn it on, set
* "showTraceUrls... | 0 |
public_repos/langsmith-cookbook/feedback-examples/nextjs/app/api | public_repos/langsmith-cookbook/feedback-examples/nextjs/app/api/chat/route.ts | import { NextRequest, NextResponse } from "next/server";
import { ChatWindowMessage } from "@/schema/ChatWindowMessage";
import { ChatOpenAI } from "langchain/chat_models/openai";
import { BytesOutputParser } from "langchain/schema/output_parser";
import { PromptTemplate } from "langchain/prompts";
export const runti... | 0 |
public_repos/langsmith-cookbook/feedback-examples/nextjs | public_repos/langsmith-cookbook/feedback-examples/nextjs/components/ChatMessageBubble.tsx | "use client";
import { toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { ChatWindowMessage } from '@/schema/ChatWindowMessage';
import { useState, type FormEvent } from "react";
import { Feedback } from 'langsmith';
export function ChatMessageBubble(props: { message: ChatWindow... | 0 |
public_repos/langsmith-cookbook/feedback-examples/nextjs | public_repos/langsmith-cookbook/feedback-examples/nextjs/components/ChatWindow.tsx | "use client";
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { useRef, ReactElement, useState } from "react";
import type { FormEvent } from "react";
import { ChatMessageBubble } from "@/components/ChatMessageBubble";
import { ChatWindowMessage } from '... | 0 |
public_repos/langsmith-cookbook/feedback-examples/nextjs | public_repos/langsmith-cookbook/feedback-examples/nextjs/schema/ChatWindowMessage.ts | export type ChatWindowMessage = {
content: string;
role: "human" | "ai";
runId?: string;
traceUrl?: string;
}
| 0 |
public_repos/langsmith-cookbook | public_repos/langsmith-cookbook/tracing-examples/README.md | ---
sidebar_label: Tracing
sidebar_position: 2
---
# Tracing your code
Tracing allows for seamless debugging and improvement of your LLM applications. Here's how:
- [Tracing without LangChain](./traceable/tracing_without_langchain.ipynb): learn to trace applications independent of LangChain using the Python SDK's @t... | 0 |
public_repos/langsmith-cookbook/tracing-examples | public_repos/langsmith-cookbook/tracing-examples/traceable/tracing_without_langchain.ipynb | # %pip install -U langsmith > /dev/null
# %pip install -U openai > /dev/nullimport os
# Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com"
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key
os.environ["LANGCHA... | 0 |
public_repos/langsmith-cookbook/tracing-examples | public_repos/langsmith-cookbook/tracing-examples/rest/rest.ipynb | import os
# Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com"
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key
project_name = "YOUR PROJECT NAME" # Update with your project nameimport datetime
import uuid
... | 0 |
public_repos/langsmith-cookbook/tracing-examples | public_repos/langsmith-cookbook/tracing-examples/runnable-naming/run-naming.ipynb | # %pip install -U langchain --quietimport os
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" # Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key
os.environ["LANGCHAIN_TRACING_V2"] = "true"
project_name = "Y... | 0 |
public_repos/langsmith-cookbook/tracing-examples | public_repos/langsmith-cookbook/tracing-examples/show-trace-url-streamlit/main.py | import logging
import langsmith
import streamlit as st
from langchain import callbacks, chat_models
from langchain.prompts import ChatPromptTemplate
logging.basicConfig(level=logging.INFO)
st.set_page_config(
page_title="LangSmith Trace Tutor",
page_icon="🦜",
initial_sidebar_state="collapsed",
)
"""# Us... | 0 |
public_repos/langsmith-cookbook/tracing-examples | public_repos/langsmith-cookbook/tracing-examples/show-trace-url-streamlit/requirements.txt | langchain>=0.0.321
streamlit>=1.27
langsmith>=0.0.49
anthropic
| 0 |
public_repos/langsmith-cookbook/tracing-examples | public_repos/langsmith-cookbook/tracing-examples/show-trace-url-streamlit/README.md | # Display Trace Links
[](https://github.com/langchain-ai/langsmith-cookbook/tree/main/./tracing-examples/show-trace-url-streamlit/README.md)
When developing, adding a trace link in your UI can help you save time debugging.
In this walkthr... | 0 |
public_repos/langsmith-cookbook/tracing-examples | public_repos/langsmith-cookbook/tracing-examples/nesting-tools/nest_runs_within_tools.ipynb | %pip install -U langchain openaiimport os
os.environ["LANGCHAIN_API_KEY"] = "<your api key>"
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["OPENAI_API_KEY"] = "<your openai api key>"import uuid
import requests
from langchain.callbacks.manager import Callbacks
from langchain.chat_models import ChatOpenAI
from... | 0 |
public_repos/langsmith-cookbook | public_repos/langsmith-cookbook/fine-tuning-examples/README.md | ---
sidebar_label: Fine-tuning
sidebar_position: 8
---
# Fine-tuning
Fine-tune an LLM on collected run data using these recipes:
- [OpenAI Fine-Tuning](./export-to-openai/fine-tuning-on-chat-runs.ipynb): list LLM runs and convert them to OpenAI's fine-tuning format efficiently.
- [Lilac Dataset Curation](./lilac/lil... | 0 |
public_repos/langsmith-cookbook/fine-tuning-examples | public_repos/langsmith-cookbook/fine-tuning-examples/lilac/lilac.ipynb | # %pip install -U "lilac[pii]" langdetect openai langchain --quietimport uuid
import os
# os.environ["LANGCHAIN_API_KEY"] = "<YOUR-API-KEY>"
unique_id = uuid.uuid4().hex[:8]from langsmith import Client
client = Client()
dataset_name = f"langsmith-prompt-runs-{unique_id}"
ds = client.create_dataset(dataset_name)import... | 0 |
public_repos/langsmith-cookbook/fine-tuning-examples | public_repos/langsmith-cookbook/fine-tuning-examples/lilac/rag.jsonl | {"inputs": {"context": "\"<doc id='0'>With the EmbeddingsRedundantFilter we can identify similar documents and\\nfilter out redundancies. With integrations like doctran we can do things like\\ntranslate documents from one language to another, extract desired properties\\nand add them to metadata, and convert conversati... | 0 |
public_repos/langsmith-cookbook/fine-tuning-examples | public_repos/langsmith-cookbook/fine-tuning-examples/export-to-openai/fine-tuning-on-chat-runs.ipynb | from langsmith import Client
client = Client()import datetime
project_name = "default"
run_type = "llm"
end_time = datetime.datetime.now()
runs = client.list_runs(
project_name=project_name,
run_type=run_type,
error=False,
)from langchain import chains, chat_models, prompts, schema, callbacks... | 0 |
public_repos/langsmith-cookbook | public_repos/langsmith-cookbook/hub-examples/README.md | ---
sidebar_label: Hub
sidebar_position: 3
---
# LangChain Hub
Efficiently manage your LLM components with the [LangChain Hub](https://smith.langchain.com/hub). For dedicated documentation, please see the [hub docs](https://docs.smith.langchain.com/category/hub).
- [RetrievalQA Chain](./retrieval-qa-chain/retrieval-q... | 0 |
public_repos/langsmith-cookbook/hub-examples | public_repos/langsmith-cookbook/hub-examples/retrieval-qa-chain/retrieval-qa.ipynb | %pip install -U langchain langchainhub --quietimport os
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" # Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key
os.environ["LANGCHAIN_HUB_API_URL"] = "https://api... | 0 |
public_repos/langsmith-cookbook/hub-examples | public_repos/langsmith-cookbook/hub-examples/retrieval-qa-chain-versioned/prompt-versioning.ipynb | # %pip install -U langchain langchainhub --quietimport os
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" # Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key
os.environ["LANGCHAIN_HUB_API_URL"] = "https://a... | 0 |
public_repos/langsmith-cookbook/hub-examples | public_repos/langsmith-cookbook/hub-examples/runnable-prompt/edit-in-playground.ipynb | # %pip install -U langchain langchainhub --quietimport os
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" # Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key
os.environ["LANGCHAIN_HUB_API_URL"] = "https://a... | 0 |
public_repos/langsmith-cookbook | public_repos/langsmith-cookbook/testing-examples/README.md | ---
sidebar_label: Testing & Evaluation
sidebar_position: 4
---
# Testing & Evaluation Recipes
- [Q&A System Correctness](./qa-correctness/qa-correctness.ipynb): evaluate your retrieval-augmented Q&A pipeline on a dataset. Iterate, improve, and keep testing.
- [Evaluating Q&A Systems with Dynamic Data](./dynamic-data... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/using-fixed-sources/using_fixed_sources.ipynb | %pip install -U langchain openai anthropicimport os
import uuid
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" # Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key
uid = uuid.uuid4()# A simple example datas... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/download-feedback-and-examples/download_example.ipynb | # %pip install -U langsmith langchain anthropic pandas --quietimport os
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" # Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key
project_name = "YOUR PROJECT NAME"... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/qa-correctness/qa-correctness.ipynb | import os
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" # Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key
project_name = "YOUR PROJECT NAME" # Update with your project name# %pip install -U "langchain[o... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/agent_steps/evaluating_agents.ipynb | %pip install -U langchain openaiimport os
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY"
os.environ["OPENAI_API_KEY"] = "YOUR OPENAI API KEY"import uuid
from langsmith import Client
client = Client()
questions = [
(
"Why was was a $10 calculator app one of the best-rated Nintendo Switch games?",
... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/dynamic-data/testing_dynamic_data.ipynb | import os
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" # Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key# %pip install -U "langchain[openai]" > /dev/null
# %pip install pandas > /dev/null
# %env OPENAI... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/naming-test-projects/naming-test-projects.md | # Want to name your test runs? Here's how!
You can easily name LangSmith test projects by setting the `project_name` parameter. We recommend including a string identifier for the model/variant you are testing, along with a time-based component so that you can easily tell your test runs apart, e.g."\<prompt-123\> {time... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/pytest-ut/requirements.txt | pytest
pytest-asyncio
anthropic
openai
langchain
langsmith
GitPython | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/pytest-ut/utils.py | import asyncio
import uuid
from typing import Any, Callable, Optional
import git
import langsmith
import pytest
from langchain.callbacks import manager, tracers
from langchain.callbacks.tracers import run_collector
from langsmith import schemas
try:
repo = git.Repo(search_parent_directories=True)
_GITHASH = r... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/pytest-ut/_prepare_data.py | from typing import Optional
import langsmith
_CLIENT = langsmith.Client()
def create_dataset(
dataset_name: str, descriptions: list, labels: Optional[list] = None
):
ds = _CLIENT.create_dataset(dataset_name=dataset_name)
labels_ = labels or [None] * len(descriptions)
for desc, label in zip(descriptio... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/pytest-ut/README.md | # Unit Testing with Pytest
[](https://github.com/langchain-ai/langsmith-cookbook/tree/main/./testing-examples/pytest-ut/README.md)
This tutorial shows how to use LangSmith datasets to write unit tests directly in your pytest test suite. Th... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/pytest-ut/test_model.py | import pytest
from langchain import chat_models, prompts
from langchain.schema import output_parser, runnable
from langsmith import schemas as langsmith_schemas
from utils import langsmith_unit_test
@pytest.fixture
def classification_chain() -> runnable.Runnable:
# Defines the chain you want to run.
prompt = ... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/comparing-runs/comparing-qa.ipynb | import os
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" # Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key# %pip install -U "langchain[openai]" --quiet
# %pip install chromadb --quiet
# %pip install lxml... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/chat-single-turn/chat_evaluation_single_turn.ipynb | %pip install -U langchain openaiimport os
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY"
os.environ["OPENAI_API_KEY"] = "YOUR API KEY"import uuid
from langsmith import Client
uid = uuid.uuid4()
client = Client()examples = [
{
"inputs": {
"question": "How does that apply?",
"chat... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/evaluate-existing-test-project/evaluate_runs.ipynb | import os
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" # Update with your API URL if using a hosted instance of Langsmith.
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY" # Update with your API key
project_name = "YOUR PROJECT NAME" # Update with your project namefrom langsmith import Client
... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/data-extraction/contract-extraction.ipynb | %pip install -U --quiet langchain langsmith langchain_experimental anthropic jsonschemaimport os
import uuid
uid = uuid.uuid4()
os.environ["LANGCHAIN_API_KEY"] = "YOUR API KEY"
os.environ["ANTHROPIC_API_KEY"] = "sk-ant-***"from langsmith import Client
share_token = "08ab7912-006e-4c00-a973-0f833e74907b"
dataset_name ... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/pytest/requirements.txt | pytest
pytest-asyncio
anthropic
openai
langchain
langsmith
GitPython | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/pytest/_prepare_data.py | from typing import Optional
import langsmith
_CLIENT = langsmith.Client()
def create_dataset(
dataset_name: str, descriptions: list, labels: Optional[list] = None
):
ds = _CLIENT.create_dataset(dataset_name=dataset_name)
labels_ = labels or [None] * len(descriptions)
for desc, label in zip(descriptio... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/pytest/README.md | # LangSmith in Pytest
[](https://github.com/langchain-ai/langsmith-cookbook/tree/main/./testing-examples/pytest/README.md)
This tutorial shows how to integrate LangSmith within your pytest test suite. You can test _a lot_ of functionality ... | 0 |
public_repos/langsmith-cookbook/testing-examples | public_repos/langsmith-cookbook/testing-examples/pytest/test_model.py | import langsmith
import pytest
from langchain import chat_models, prompts, smith
from langchain.schema import output_parser, runnable
@pytest.fixture
def classification_chain() -> runnable.Runnable:
# Defines the chain you want to run.
prompt = prompts.ChatPromptTemplate.from_messages(
[
... | 0 |
public_repos/langsmith-cookbook | public_repos/langsmith-cookbook/exploratory-data-analysis/README.md | ---
sidebar_label: EDA
sidebar_position: 7
---
# Exploratory Data Analysis
Turn your trace data into actionable insights:
- [Exporting LLM Runs and Feedback](./exporting-llm-runs-and-feedback/llm_run_etl.ipynb): extract and interpret LangSmith LLM run data, making them ready for various analytical platforms.
- [Lil... | 0 |
public_repos/langsmith-cookbook/exploratory-data-analysis | public_repos/langsmith-cookbook/exploratory-data-analysis/lilac/lilac.ipynb | %pip install -U "lilac[pii]" langdetect sentence-transformers langsmith --quiet# We'll start by fetching the root traces from a project
from langsmith import Client
from datetime import datetime, timedelta
client = Client()
project_name = "<YOUR PROJECT NAME>"
start_time = datetime.now() - timedelta(days=7)
runs = l... | 0 |
public_repos/langsmith-cookbook/exploratory-data-analysis | public_repos/langsmith-cookbook/exploratory-data-analysis/exporting-llm-runs-and-feedback/llm_run_etl.ipynb | # %pip install -U langchain langsmith pandas seaborn --quiet# %env LANGCHAIN_API_KEY=""from langsmith import Client
client = Client()from datetime import datetime, timedelta
start_time = datetime.utcnow() - timedelta(days=7)
runs = list(client.list_runs(
project_name="YOUR PROJECT NAME",
run_type="llm",
... | 0 |
public_repos | public_repos/pandas-benchmarks/README.md | # pandas benchmark
## Set up instructions
Install the compilers needed to build pandas in the system:
```shell
apt install gcc g++
```
Create a user to run the benchmarks, and clone this repository in its home.
Install [pixi](https://prefix.dev), which we use to manage the environment that runs
asv. Note that the ... | 0 |
public_repos | public_repos/pandas-benchmarks/pixi.toml | [project]
name = "pandas-benchmarks"
version = "0.1.0"
description = "Environment to run the pandas benchmarks suite"
channels = ["conda-forge"]
platforms = ["linux-64"]
[tasks]
# NOTE: pandas.pydata.org needs to be added to /etc/hosts or ~/.ssh/config, since the DNS resolves to our CDN.
bench = "cd pandas/asv_bench &... | 0 |
public_repos | public_repos/neps/nep-0049.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 49 — Data allocation strategies — NumPy Enhancement Proposals</title>
... | 0 |
public_repos | public_repos/neps/nep-0032-remove-financial-functions.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 32 — Remove the financial functions from NumPy — NumPy Enhancement Proposal... | 0 |
public_repos | public_repos/neps/nep-0045-c_style_guide.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 45 — C style guide — NumPy Enhancement Proposals</title>
<script... | 0 |
public_repos | public_repos/neps/nep-0004-datetime-proposal3.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 4 — A (third) proposal for implementing some date/time types in NumPy — Num... | 0 |
public_repos | public_repos/neps/accepted.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Accepted NEPs (implementation in progress) — NumPy Enhancement Proposals</title... | 0 |
public_repos | public_repos/neps/.buildinfo | # Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 1589991dee8d74acba5abd46a4c91fc2
tags: 645f666f9bcd5a90fca523b33c5a78b7
| 0 |
public_repos | public_repos/neps/nep-0012-missing-data.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 12 — Missing data functionality in NumPy — NumPy Enhancement Proposals</tit... | 0 |
public_repos | public_repos/neps/nep-0023-backwards-compatibility.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 23 — Backwards compatibility and deprecation policy — NumPy Enhancement Pro... | 0 |
public_repos | public_repos/neps/nep-0048-spending-project-funds.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 48 — Spending NumPy project funds — NumPy Enhancement Proposals</title>
... | 0 |
public_repos | public_repos/neps/nep-0051-scalar-representation.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 51 — Changing the representation of NumPy scalars — NumPy Enhancement Propo... | 0 |
public_repos | public_repos/neps/nep-0042-new-dtypes.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 42 — New and extensible DTypes — NumPy Enhancement Proposals</title>
... | 0 |
public_repos | public_repos/neps/genindex.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index — NumPy Enhancement Proposals</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem(... | 0 |
public_repos | public_repos/neps/nep-0019-rng-policy.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 19 — Random number generator policy — NumPy Enhancement Proposals</title>
... | 0 |
public_repos | public_repos/neps/nep-0035-array-creation-dispatch-with-array-function.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 35 — Array creation dispatching with __array_function__ — NumPy Enhancement... | 0 |
public_repos | public_repos/neps/nep-0036-fair-play.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 36 — Fair play — NumPy Enhancement Proposals</title>
<script dat... | 0 |
public_repos | public_repos/neps/open.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Open NEPs (under consideration) — NumPy Enhancement Proposals</title>
... | 0 |
public_repos | public_repos/neps/nep-0053-c-abi-evolution.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 53 — Evolving the NumPy C-API for NumPy 2.0 — NumPy Enhancement Proposals</... | 0 |
public_repos | public_repos/neps/nep-0034-infer-dtype-is-object.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 34 — Disallow inferring dtype=object from sequences — NumPy Enhancement Pro... | 0 |
public_repos | public_repos/neps/nep-0014-dropping-python2.7-proposal.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 14 — Plan for dropping Python 2.7 support — NumPy Enhancement Proposals</ti... | 0 |
public_repos | public_repos/neps/nep-0029-deprecation_policy.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 29 — Recommend Python and NumPy version support as a community policy standard &#... | 0 |
public_repos | public_repos/neps/nep-0028-website-redesign.html |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NEP 28 — numpy.org website redesign — NumPy Enhancement Proposals</title>
... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.