text stringlengths 3 1.68M | id stringlengths 13 169 | metadata dict | __index_level_0__ int64 0 2.21k |
|---|---|---|---|
# flake8: noqa
import time
from sys import platform
from typing import (
TYPE_CHECKING,
Any,
Dict,
Iterable,
List,
Optional,
Set,
Tuple,
TypedDict,
Union,
)
if TYPE_CHECKING:
from playwright.sync_api import Browser, CDPSession, Page, sync_playwright
black_listed_elements: S... | langchain/libs/langchain/langchain/chains/natbot/crawler.py/0 | {
"file_path": "langchain/libs/langchain/langchain/chains/natbot/crawler.py",
"repo_id": "langchain",
"token_count": 8044
} | 461 |
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable l... | milvus/internal/core/unittest/test_relational.cpp/0 | {
"file_path": "milvus/internal/core/unittest/test_relational.cpp",
"repo_id": "milvus",
"token_count": 2287
} | 1,758 |
# Metric Card for CER
## Metric description
Character error rate (CER) is a common metric of the performance of an automatic speech recognition (ASR) system. CER is similar to Word Error Rate (WER), but operates on character instead of word.
Character error rate can be computed as:
`CER = (S + D + I) / N = (S + D... | datasets/metrics/cer/README.md/0 | {
"file_path": "datasets/metrics/cer/README.md",
"repo_id": "datasets",
"token_count": 1192
} | 117 |
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable l... | milvus/internal/core/unittest/test_query.cpp/0 | {
"file_path": "milvus/internal/core/unittest/test_query.cpp",
"repo_id": "milvus",
"token_count": 17455
} | 1,678 |
python_sources()
| llama_index/llama-index-legacy/llama_index/legacy/core/query_pipeline/BUILD/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/core/query_pipeline/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,555 |
<jupyter_start><jupyter_text>If you're opening this Notebook on colab, you will probably need to install 🤗 Transformers and 🤗 Datasets as well as other dependencies. Uncomment the following cell and run it.<jupyter_code>#! pip install datasets evaluate transformers rouge-score nltk<jupyter_output><empty_output><jupyt... | notebooks/examples/summarization.ipynb/0 | {
"file_path": "notebooks/examples/summarization.ipynb",
"repo_id": "notebooks",
"token_count": 5127
} | 322 |
import os
from git import Repo
from langchain.text_splitter import Language, RecursiveCharacterTextSplitter
from langchain_community.document_loaders.generic import GenericLoader
from langchain_community.document_loaders.parsers import LanguageParser
from langchain_community.embeddings import GPT4AllEmbeddings
from la... | langchain/templates/rag-codellama-fireworks/rag_codellama_fireworks/chain.py/0 | {
"file_path": "langchain/templates/rag-codellama-fireworks/rag_codellama_fireworks/chain.py",
"repo_id": "langchain",
"token_count": 707
} | 678 |
from llama_index.core.tools.tool_spec.base import BaseToolSpec
import yfinance as yf
import pandas as pd
class YahooFinanceToolSpec(BaseToolSpec):
"""Yahoo Finance tool spec."""
spec_functions = [
"balance_sheet",
"income_statement",
"cash_flow",
"stock_basic_info",
"s... | llama_index/llama-index-integrations/tools/llama-index-tools-yahoo-finance/llama_index/tools/yahoo_finance/base.py/0 | {
"file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-yahoo-finance/llama_index/tools/yahoo_finance/base.py",
"repo_id": "llama_index",
"token_count": 1132
} | 1,467 |
poetry_requirements(
name="poetry",
)
| llama_index/llama-index-integrations/indices/llama-index-indices-managed-vectara/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-vectara/BUILD",
"repo_id": "llama_index",
"token_count": 18
} | 1,286 |
[virtualenvs]
in-project = true
| langchain/libs/cli/poetry.toml/0 | {
"file_path": "langchain/libs/cli/poetry.toml",
"repo_id": "langchain",
"token_count": 12
} | 210 |
<jupyter_start><jupyter_text>Cohere RAG retrieverThis notebook covers how to get started with Cohere RAG retriever. This allows you to leverage the ability to search documents over various connectors or by supplying your own.<jupyter_code>from langchain.retrievers import CohereRagRetriever
from langchain_community.chat... | langchain/docs/docs/integrations/retrievers/cohere.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/retrievers/cohere.ipynb",
"repo_id": "langchain",
"token_count": 395
} | 166 |
import gc
import random
import traceback
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import (
CLIPImageProcessor,
CLIPTextModel,
CLIPTokenizer,
CLIPVisionModelWithProjection,
GPT2Tokenizer,
)
from diffusers import (
AutoencoderKL,
DPMSolverMultis... | diffusers/tests/pipelines/unidiffuser/test_unidiffuser.py/0 | {
"file_path": "diffusers/tests/pipelines/unidiffuser/test_unidiffuser.py",
"repo_id": "diffusers",
"token_count": 14379
} | 279 |
<!--Copyright 2023 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | accelerate/docs/source/concept_guides/low_precision_training.md/0 | {
"file_path": "accelerate/docs/source/concept_guides/low_precision_training.md",
"repo_id": "accelerate",
"token_count": 1465
} | 2 |
from __future__ import annotations
import warnings
from abc import ABC, abstractmethod
from inspect import signature
from typing import TYPE_CHECKING, Any, Dict, List, Optional
from langchain_core.documents import Document
from langchain_core.load.dump import dumpd
from langchain_core.runnables import (
Runnable,... | langchain/libs/core/langchain_core/retrievers.py/0 | {
"file_path": "langchain/libs/core/langchain_core/retrievers.py",
"repo_id": "langchain",
"token_count": 4781
} | 395 |
<jupyter_start><jupyter_text>Pathway Retriever > [Pathway](https://pathway.com/) is an open data processing framework. It allows you to easily develop data transformation pipelines and Machine Learning applications that work with live data sources and changing data.This notebook demonstrates how to set up a live data i... | llama_index/docs/examples/retrievers/pathway_retriever.ipynb/0 | {
"file_path": "llama_index/docs/examples/retrievers/pathway_retriever.ipynb",
"repo_id": "llama_index",
"token_count": 1873
} | 1,162 |
# rag-pinecone-multi-query
This template performs RAG using Pinecone and OpenAI with a multi-query retriever.
It uses an LLM to generate multiple queries from different perspectives based on the user's input query.
For each query, it retrieves a set of relevant documents and takes the unique union across all quer... | langchain/templates/rag-pinecone-multi-query/README.md/0 | {
"file_path": "langchain/templates/rag-pinecone-multi-query/README.md",
"repo_id": "langchain",
"token_count": 692
} | 683 |
"""Test for Serializable base class"""
import pytest
from langchain_community.llms.openai import OpenAI as CommunityOpenAI
from langchain_core.load.dump import dumpd, dumps
from langchain_core.load.load import load, loads
from langchain_core.prompts.prompt import PromptTemplate
from langchain.chains.llm import LLMCha... | langchain/libs/langchain/tests/unit_tests/load/test_load.py/0 | {
"file_path": "langchain/libs/langchain/tests/unit_tests/load/test_load.py",
"repo_id": "langchain",
"token_count": 1965
} | 607 |
/** @type {import('tailwindcss').Config} */
module.exports = {
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-stop... | langchain-nextjs-template/tailwind.config.js/0 | {
"file_path": "langchain-nextjs-template/tailwind.config.js",
"repo_id": "langchain-nextjs-template",
"token_count": 230
} | 71 |
poetry_requirements(
name="poetry",
)
python_sources(
interpreter_constraints=["==3.10.*"],
)
| llama_index/llama-index-integrations/readers/llama-index-readers-pathway/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-pathway/BUILD",
"repo_id": "llama_index",
"token_count": 48
} | 1,536 |
from langchain_community.vectorstores.usearch import USearch
__all__ = ["USearch"]
| langchain/libs/langchain/langchain/vectorstores/usearch.py/0 | {
"file_path": "langchain/libs/langchain/langchain/vectorstores/usearch.py",
"repo_id": "langchain",
"token_count": 25
} | 632 |
// Licensed to the LF AI & Data foundation under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use th... | milvus/tests/integration/suite.go/0 | {
"file_path": "milvus/tests/integration/suite.go",
"repo_id": "milvus",
"token_count": 1029
} | 2,159 |
from langchain_community.tools.google_places.tool import (
GooglePlacesSchema,
GooglePlacesTool,
)
__all__ = ["GooglePlacesSchema", "GooglePlacesTool"]
| langchain/libs/langchain/langchain/tools/google_places/tool.py/0 | {
"file_path": "langchain/libs/langchain/langchain/tools/google_places/tool.py",
"repo_id": "langchain",
"token_count": 56
} | 553 |
"""Test PromptLayerChatOpenAI wrapper."""
import pytest
from langchain_core.callbacks import CallbackManager
from langchain_core.messages import BaseMessage, HumanMessage, SystemMessage
from langchain_core.outputs import ChatGeneration, ChatResult, LLMResult
from langchain_community.chat_models.promptlayer_openai imp... | langchain/libs/community/tests/integration_tests/chat_models/test_promptlayer_openai.py/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/chat_models/test_promptlayer_openai.py",
"repo_id": "langchain",
"token_count": 1673
} | 340 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | trl/trl/trainer/utils.py/0 | {
"file_path": "trl/trl/trainer/utils.py",
"repo_id": "trl",
"token_count": 14555
} | 876 |
from langchain_core.utils.env import get_from_dict_or_env, get_from_env
__all__ = ["get_from_dict_or_env", "get_from_env"]
| langchain/libs/langchain/langchain/utils/env.py/0 | {
"file_path": "langchain/libs/langchain/langchain/utils/env.py",
"repo_id": "langchain",
"token_count": 50
} | 622 |
from langchain_community.agent_toolkits.azure_cognitive_services import (
AzureCognitiveServicesToolkit,
)
__all__ = ["AzureCognitiveServicesToolkit"]
| langchain/libs/langchain/langchain/agents/agent_toolkits/azure_cognitive_services.py/0 | {
"file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/azure_cognitive_services.py",
"repo_id": "langchain",
"token_count": 50
} | 433 |
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable l... | milvus/internal/core/src/query/Utils.h/0 | {
"file_path": "milvus/internal/core/src/query/Utils.h",
"repo_id": "milvus",
"token_count": 1788
} | 1,653 |
package funcutil
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_flattenedByteVectorsToByteVectors(t *testing.T) {
flattenedVectors := []byte{0, 1, 2, 3, 4, 5}
dimension := 3
actual := flattenedByteVectorsToByteVectors(flattenedVectors, dimension)
expected := [][]byte{
{0, 1, 2},
{3, 4... | milvus/pkg/util/funcutil/placeholdergroup_test.go/0 | {
"file_path": "milvus/pkg/util/funcutil/placeholdergroup_test.go",
"repo_id": "milvus",
"token_count": 431
} | 1,966 |
from llama_index.core.llama_pack import BaseLlamaPack
from llama_index.packs.redis_ingestion_pipeline import RedisIngestionPipelinePack
def test_class():
names_of_base_classes = [b.__name__ for b in RedisIngestionPipelinePack.__mro__]
assert BaseLlamaPack.__name__ in names_of_base_classes
| llama_index/llama-index-packs/llama-index-packs-redis-ingestion-pipeline/tests/test_packs_redis_ingestion_pipeline.py/0 | {
"file_path": "llama_index/llama-index-packs/llama-index-packs-redis-ingestion-pipeline/tests/test_packs_redis_ingestion_pipeline.py",
"repo_id": "llama_index",
"token_count": 113
} | 1,671 |
from llama_index.core.readers.base import BaseReader
from llama_index.readers.zendesk import ZendeskReader
def test_class():
names_of_base_classes = [b.__name__ for b in ZendeskReader.__mro__]
assert BaseReader.__name__ in names_of_base_classes
| llama_index/llama-index-integrations/readers/llama-index-readers-zendesk/tests/test_readers_zendesk.py/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-zendesk/tests/test_readers_zendesk.py",
"repo_id": "llama_index",
"token_count": 94
} | 1,403 |
from __future__ import annotations
import uuid
from typing import Any, Dict, Iterable, List, Literal, Optional, Tuple, Union
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.vectorstores import VectorStore
class PGVecto_rs(VectorStore):
"""Vector... | langchain/libs/community/langchain_community/vectorstores/pgvecto_rs.py/0 | {
"file_path": "langchain/libs/community/langchain_community/vectorstores/pgvecto_rs.py",
"repo_id": "langchain",
"token_count": 3723
} | 311 |
# Astra DB
> DataStax [Astra DB](https://docs.datastax.com/en/astra/home/astra.html) is a serverless vector-capable database built on Apache Cassandra® and made conveniently available
> through an easy-to-use JSON API.
### Setup
Install the following Python package:
```bash
pip install "astrapy>=0.7.1"
```
## Vect... | langchain/docs/docs/integrations/providers/astradb.mdx/0 | {
"file_path": "langchain/docs/docs/integrations/providers/astradb.mdx",
"repo_id": "langchain",
"token_count": 1047
} | 129 |
---
sidebar_position: 1
hide_table_of_contents: true
---
# Folders with multiple files
This example goes over how to load data from folders with multiple files. The second argument is a map of file extensions to loader factories. Each file will be passed to the matching loader, and the resulting documents will be con... | langchainjs/docs/core_docs/docs/integrations/document_loaders/file_loaders/directory.mdx/0 | {
"file_path": "langchainjs/docs/core_docs/docs/integrations/document_loaders/file_loaders/directory.mdx",
"repo_id": "langchainjs",
"token_count": 372
} | 726 |
python_sources()
| llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-rankgpt-rerank/llama_index/postprocessor/rankgpt_rerank/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-rankgpt-rerank/llama_index/postprocessor/rankgpt_rerank/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,389 |
python_sources()
| llama_index/llama-index-integrations/callbacks/llama-index-callbacks-honeyhive/llama_index/callbacks/honeyhive/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-honeyhive/llama_index/callbacks/honeyhive/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,211 |
<jupyter_start><jupyter_text>Custom Trajectory Evaluator[](https://colab.research.google.com/github/langchain-ai/langchain/blob/master/docs/docs/guides/evaluation/trajectory/custom.ipynb)You can make your own custom trajectory evaluators by inheriting from the [AgentTrajectoryEvaluator](https://api.python.langchain.com... | langchain/docs/docs/guides/evaluation/trajectory/custom.ipynb/0 | {
"file_path": "langchain/docs/docs/guides/evaluation/trajectory/custom.ipynb",
"repo_id": "langchain",
"token_count": 1152
} | 87 |
# Time-weighted vector store retriever
This retriever uses a combination of semantic similarity and a time decay.
The algorithm for scoring them is:
```
semantic_similarity + (1.0 - decay_rate) ^ hours_passed
```
Notably, `hours_passed` refers to the hours passed since the object in the retriever **was last accesse... | langchainjs/docs/core_docs/docs/modules/data_connection/retrievers/time_weighted_vectorstore.mdx/0 | {
"file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/retrievers/time_weighted_vectorstore.mdx",
"repo_id": "langchainjs",
"token_count": 411
} | 743 |
python_sources()
| llama_index/llama-index-legacy/llama_index/legacy/core/BUILD/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/core/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,556 |
# LlamaIndex Extractors Integration: Entity
| llama_index/llama-index-integrations/extractors/llama-index-extractors-entity/README.md/0 | {
"file_path": "llama_index/llama-index-integrations/extractors/llama-index-extractors-entity/README.md",
"repo_id": "llama_index",
"token_count": 10
} | 1,202 |
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | transformers/docs/source/ko/run_scripts.md/0 | {
"file_path": "transformers/docs/source/ko/run_scripts.md",
"repo_id": "transformers",
"token_count": 10775
} | 555 |
package broker
import (
"context"
"testing"
"time"
"github.com/cockroachdb/errors"
"github.com/samber/lo"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
"google.golang.org/grpc"
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
"github.com/milvus-io/milvus-proto/go-api/v2/msgpb... | milvus/internal/datanode/broker/datacoord_test.go/0 | {
"file_path": "milvus/internal/datanode/broker/datacoord_test.go",
"repo_id": "milvus",
"token_count": 4556
} | 1,918 |
python_tests(
name="tests",
skip_tests=True,
)
| llama_index/llama-index-legacy/tests/utilities/BUILD/0 | {
"file_path": "llama_index/llama-index-legacy/tests/utilities/BUILD",
"repo_id": "llama_index",
"token_count": 25
} | 1,634 |
vllm-cuda:
# Clone vllm
pip install -U ninja packaging --no-cache-dir
git clone https://github.com/vllm-project/vllm.git vllm
build-vllm-cuda: vllm-cuda
cd vllm && git fetch && git checkout f8a1e39fae05ca610be8d5a78be9d40f5274e5fc
cd vllm && python setup.py build
install-vllm-cuda: build-vllm-cuda
pip uninst... | text-generation-inference/server/Makefile-vllm/0 | {
"file_path": "text-generation-inference/server/Makefile-vllm",
"repo_id": "text-generation-inference",
"token_count": 332
} | 395 |
// Licensed to the LF AI & Data foundation under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use th... | milvus/internal/util/flowgraph/node_test.go/0 | {
"file_path": "milvus/internal/util/flowgraph/node_test.go",
"repo_id": "milvus",
"token_count": 1400
} | 1,877 |
from llama_index.readers.smart_pdf_loader.base import SmartPDFLoader
__all__ = ["SmartPDFLoader"]
| llama_index/llama-index-integrations/readers/llama-index-readers-smart-pdf-loader/llama_index/readers/smart_pdf_loader/__init__.py/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-smart-pdf-loader/llama_index/readers/smart_pdf_loader/__init__.py",
"repo_id": "llama_index",
"token_count": 36
} | 1,430 |
from llama_index.core.readers.base import BaseReader
from llama_index.readers.azstorage_blob import AzStorageBlobReader
def test_class():
names_of_base_classes = [b.__name__ for b in AzStorageBlobReader.__mro__]
assert BaseReader.__name__ in names_of_base_classes
| llama_index/llama-index-integrations/readers/llama-index-readers-azstorage-blob/tests/test_readers_azstorage_blob.py/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-azstorage-blob/tests/test_readers_azstorage_blob.py",
"repo_id": "llama_index",
"token_count": 95
} | 1,342 |
// Licensed to the LF AI & Data foundation under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use th... | milvus/internal/distributed/querynode/client/client_test.go/0 | {
"file_path": "milvus/internal/distributed/querynode/client/client_test.go",
"repo_id": "milvus",
"token_count": 1676
} | 1,711 |
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<title>Candle Whisper Rust/WASM</title>
</head>
<body></body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
... | candle/candle-wasm-examples/whisper/lib-example.html/0 | {
"file_path": "candle/candle-wasm-examples/whisper/lib-example.html",
"repo_id": "candle",
"token_count": 6488
} | 92 |
from typing import TYPE_CHECKING, Any, Dict, Generator, List, Mapping, Optional, Union
from langchain_core.callbacks import CallbackManagerForLLMRun
from langchain_core.language_models.llms import LLM
if TYPE_CHECKING:
from xinference.client import RESTfulChatModelHandle, RESTfulGenerateModelHandle
from xinfe... | langchain/libs/community/langchain_community/llms/xinference.py/0 | {
"file_path": "langchain/libs/community/langchain_community/llms/xinference.py",
"repo_id": "langchain",
"token_count": 2825
} | 274 |
import importlib
import importlib.metadata
import logging
import os
import platform
from pathlib import Path
from typing import Optional
from packaging import version
logger = logging.getLogger(__name__.split(".", 1)[0]) # to avoid circular import from .utils.logging
# Datasets
S3_DATASETS_BUCKET_PREFIX = "https:/... | datasets/src/datasets/config.py/0 | {
"file_path": "datasets/src/datasets/config.py",
"repo_id": "datasets",
"token_count": 4310
} | 149 |
package proxy
import (
"context"
"testing"
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
"github.com/milvus-io/milvus/pkg/util"
)
func TestDatabaseInterceptor(t *testin... | milvus/internal/proxy/database_interceptor_test.go/0 | {
"file_path": "milvus/internal/proxy/database_interceptor_test.go",
"repo_id": "milvus",
"token_count": 1813
} | 1,742 |
# rag_supabase
This template performs RAG with Supabase.
[Supabase](https://supabase.com/docs) is an open-source Firebase alternative. It is built on top of [PostgreSQL](https://en.wikipedia.org/wiki/PostgreSQL), a free and open-source relational database management system (RDBMS) and uses [pgvector](https://github.... | langchain/templates/rag-supabase/README.md/0 | {
"file_path": "langchain/templates/rag-supabase/README.md",
"repo_id": "langchain",
"token_count": 1381
} | 700 |
from text_generation_server.utils.convert import convert_file, convert_files
from text_generation_server.utils.dist import initialize_torch_distributed
from text_generation_server.utils.weights import Weights
from text_generation_server.utils.peft import download_and_unload_peft
from text_generation_server.utils.hub im... | text-generation-inference/server/text_generation_server/utils/__init__.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 417
} | 427 |
from langchain_core.utils.iter import NoLock, Tee, batch_iterate, tee_peer
__all__ = ["NoLock", "tee_peer", "Tee", "batch_iterate"]
| langchain/libs/langchain/langchain/utils/iter.py/0 | {
"file_path": "langchain/libs/langchain/langchain/utils/iter.py",
"repo_id": "langchain",
"token_count": 50
} | 568 |
// Code generated by mockery v2.32.4. DO NOT EDIT.
package optimizers
import mock "github.com/stretchr/testify/mock"
// MockQueryHook is an autogenerated mock type for the QueryHook type
type MockQueryHook struct {
mock.Mock
}
type MockQueryHook_Expecter struct {
mock *mock.Mock
}
func (_m *MockQueryHook) EXPECT... | milvus/internal/querynodev2/optimizers/mock_query_hook.go/0 | {
"file_path": "milvus/internal/querynodev2/optimizers/mock_query_hook.go",
"repo_id": "milvus",
"token_count": 2213
} | 1,906 |
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | diffusers/src/diffusers/loaders/controlnet.py/0 | {
"file_path": "diffusers/src/diffusers/loaders/controlnet.py",
"repo_id": "diffusers",
"token_count": 3018
} | 224 |
python_tests()
| llama_index/llama-index-packs/llama-index-packs-snowflake-query-engine/tests/BUILD/0 | {
"file_path": "llama_index/llama-index-packs/llama-index-packs-snowflake-query-engine/tests/BUILD",
"repo_id": "llama_index",
"token_count": 5
} | 1,699 |
# coding=utf-8
# Copyright 2018 The Open AI Team Authors and The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | transformers/src/transformers/models/openai/tokenization_openai_fast.py/0 | {
"file_path": "transformers/src/transformers/models/openai/tokenization_openai_fast.py",
"repo_id": "transformers",
"token_count": 1098
} | 723 |
import { getEndpoint, OpenAIEndpointConfig } from "@langchain/openai";
describe("getEndpoint", () => {
it("should return the correct endpoint with azureOpenAIBasePath and azureOpenAIApiDeploymentName", () => {
const config: OpenAIEndpointConfig = {
azureOpenAIApiKey: "API-KEY",
azureOpenAIApiDeployme... | langchainjs/langchain/src/util/tests/azure.test.ts/0 | {
"file_path": "langchainjs/langchain/src/util/tests/azure.test.ts",
"repo_id": "langchainjs",
"token_count": 813
} | 1,001 |
from llama_index.readers.zendesk.base import ZendeskReader
__all__ = ["ZendeskReader"]
| llama_index/llama-index-integrations/readers/llama-index-readers-zendesk/llama_index/readers/zendesk/__init__.py/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-zendesk/llama_index/readers/zendesk/__init__.py",
"repo_id": "llama_index",
"token_count": 35
} | 1,398 |
from pathlib import Path
from typing import List
from llama_index.legacy.indices.composability.graph import ComposableGraph
from llama_index.legacy.indices.list.base import SummaryIndex
from llama_index.legacy.indices.loading import load_graph_from_storage
from llama_index.legacy.indices.vector_store.base import Vecto... | llama_index/llama-index-legacy/tests/indices/test_loading_graph.py/0 | {
"file_path": "llama_index/llama-index-legacy/tests/indices/test_loading_graph.py",
"repo_id": "llama_index",
"token_count": 812
} | 1,532 |
export { type RouterInput, RouterRunnable } from "@langchain/core/runnables";
| langchainjs/langchain/src/schema/runnable/router.ts/0 | {
"file_path": "langchainjs/langchain/src/schema/runnable/router.ts",
"repo_id": "langchainjs",
"token_count": 23
} | 949 |
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
import type { BaseRetrieverInterface } from "@langchain/core/retrievers";
import { PromptTemplate } from "@langchain/core/prompts";
import { BaseMessage, HumanMessage, AIMessage } from "@langchain/core/messages";
import { ChainValue... | langchainjs/langchain/src/chains/conversational_retrieval_chain.ts/0 | {
"file_path": "langchainjs/langchain/src/chains/conversational_retrieval_chain.ts",
"repo_id": "langchainjs",
"token_count": 3393
} | 861 |
python_tests()
| llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-chatgpt-plugin/tests/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-chatgpt-plugin/tests/BUILD",
"repo_id": "llama_index",
"token_count": 5
} | 1,475 |
<jupyter_start><jupyter_text>LlamaCPP In this short notebook, we show how to use the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) library with LlamaIndex.In this notebook, we use the [`llama-2-chat-13b-ggml`](https://huggingface.co/TheBloke/Llama-2-13B-chat-GGML) model, along with the proper prompt f... | llama_index/docs/examples/llm/llama_2_llama_cpp.ipynb/0 | {
"file_path": "llama_index/docs/examples/llm/llama_2_llama_cpp.ipynb",
"repo_id": "llama_index",
"token_count": 2568
} | 1,067 |
<jupyter_start><jupyter_text>Llama.cpp[llama-cpp-python](https://github.com/abetlen/llama-cpp-python) is a Python binding for [llama.cpp](https://github.com/ggerganov/llama.cpp).It supports inference for [many LLMs](https://github.com/ggerganov/llama.cppdescription) models, which can be accessed on [Hugging Face](https... | langchain/docs/docs/integrations/llms/llamacpp.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/llms/llamacpp.ipynb",
"repo_id": "langchain",
"token_count": 4513
} | 123 |
import asyncio
import json
import os
from typing import Any, Dict, List, Optional
import numpy as np
from langchain_core.embeddings import Embeddings
from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator
from langchain_core.runnables.config import run_in_executor
class BedrockEmbeddings(BaseModel, ... | langchain/libs/community/langchain_community/embeddings/bedrock.py/0 | {
"file_path": "langchain/libs/community/langchain_community/embeddings/bedrock.py",
"repo_id": "langchain",
"token_count": 3045
} | 250 |
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core"]
[tool.codespell]
check-filenames = true
check-hidden = true
skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb"
[tool.llamahub]
classes = ["RedisVectorStore"]
contains_example = false
import_path = "llama_index.vector_stores.redi... | llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-redis/pyproject.toml/0 | {
"file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-redis/pyproject.toml",
"repo_id": "llama_index",
"token_count": 649
} | 1,675 |
"""Test the WriteFile tool."""
from pathlib import Path
from tempfile import TemporaryDirectory
from langchain_community.tools.file_management.utils import (
INVALID_PATH_TEMPLATE,
)
from langchain_community.tools.file_management.write import WriteFileTool
def test_write_file_with_root_dir() -> None:
"""Tes... | langchain/libs/community/tests/unit_tests/tools/file_management/test_write.py/0 | {
"file_path": "langchain/libs/community/tests/unit_tests/tools/file_management/test_write.py",
"repo_id": "langchain",
"token_count": 566
} | 403 |
# Configuration File for CodeCov
codecov:
require_ci_to_pass: no
notify:
require_ci_to_pass: no
wait_for_ci: false
ci:
- jenkins.milvus.io:18080
coverage:
precision: 2
round: down
range: "70...100"
status:
project:
default:
target: 77%
threshold: 0% #Allow the covera... | milvus/codecov.yml/0 | {
"file_path": "milvus/codecov.yml",
"repo_id": "milvus",
"token_count": 364
} | 1,634 |
import inspect
import time
from pathlib import Path
from typing import Callable, List, Optional, Union
import numpy as np
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
from diffusers import DiffusionPipeline
from diffusers.configuration_utils import FrozenDict
from diffusers.m... | diffusers/examples/community/interpolate_stable_diffusion.py/0 | {
"file_path": "diffusers/examples/community/interpolate_stable_diffusion.py",
"repo_id": "diffusers",
"token_count": 11720
} | 202 |
python_sources()
| llama_index/llama-index-legacy/llama_index/legacy/multi_modal_llms/BUILD/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/multi_modal_llms/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,619 |
# (Tensorflow) EfficientNet CondConv
**EfficientNet** is a convolutional neural network architecture and scaling method that uniformly scales all dimensions of depth/width/resolution using a *compound coefficient*. Unlike conventional practice that arbitrary scales these factors, the EfficientNet scaling method unifo... | pytorch-image-models/docs/models/.templates/models/tf-efficientnet-condconv.md/0 | {
"file_path": "pytorch-image-models/docs/models/.templates/models/tf-efficientnet-condconv.md",
"repo_id": "pytorch-image-models",
"token_count": 2457
} | 341 |
# flake8: noqa
from langchain_core.prompts.prompt import PromptTemplate
web_search_template = """Please write a passage to answer the question
Question: {QUESTION}
Passage:"""
web_search = PromptTemplate(template=web_search_template, input_variables=["QUESTION"])
sci_fact_template = """Please write a scientific paper... | langchain/libs/langchain/langchain/chains/hyde/prompts.py/0 | {
"file_path": "langchain/libs/langchain/langchain/chains/hyde/prompts.py",
"repo_id": "langchain",
"token_count": 630
} | 491 |
import { test, expect } from "@jest/globals";
import { Document, DocumentInterface } from "@langchain/core/documents";
import { SyntheticEmbeddings } from "@langchain/core/utils/testing";
import { similarity } from "ml-distance";
import { MemoryVectorStore } from "../memory.js";
test("MemoryVectorStore with external ... | langchainjs/langchain/src/vectorstores/tests/memory.test.ts/0 | {
"file_path": "langchainjs/langchain/src/vectorstores/tests/memory.test.ts",
"repo_id": "langchainjs",
"token_count": 954
} | 924 |
import { useCallback, useMemo, useState } from "react";
import { InformationCircleIcon } from "@heroicons/react/24/outline";
import { Chat } from "./components/Chat";
import { ChatList } from "./components/ChatList";
import { Layout } from "./components/Layout";
import { NewChat } from "./components/NewChat";
import { ... | opengpts/frontend/src/App.tsx/0 | {
"file_path": "opengpts/frontend/src/App.tsx",
"repo_id": "opengpts",
"token_count": 1789
} | 1,989 |
// Licensed to the LF AI & Data foundation under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use th... | milvus/internal/core/src/index/Utils.cpp/0 | {
"file_path": "milvus/internal/core/src/index/Utils.cpp",
"repo_id": "milvus",
"token_count": 4395
} | 1,788 |
python_tests()
| llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/tests/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/tests/BUILD",
"repo_id": "llama_index",
"token_count": 5
} | 1,473 |
---
sidebar_class_name: hidden
---
# Modules
LangChain provides standard, extendable interfaces and external integrations for the following main modules:
#### [Model I/O](/docs/modules/model_io/)
Interface with language models
#### [Retrieval](/docs/modules/data_connection/)
Interface with application-specific data
... | langchain/docs/docs/modules/index.mdx/0 | {
"file_path": "langchain/docs/docs/modules/index.mdx",
"repo_id": "langchain",
"token_count": 179
} | 201 |
/* eslint-disable no-process-env */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import * as fs from "node:fs";
import * as url from "node:url";
import * as path from "node:path";
import { test } from "@jest/globals";
import {
DatabaseObjectResponse,
NotionAPILoader,
PageObjectResponse,
} from ".... | langchainjs/langchain/src/document_loaders/tests/notionapi.test.ts/0 | {
"file_path": "langchainjs/langchain/src/document_loaders/tests/notionapi.test.ts",
"repo_id": "langchainjs",
"token_count": 1756
} | 944 |
# Copyright 2024 The Qwen Team and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | transformers/src/transformers/models/qwen2/__init__.py/0 | {
"file_path": "transformers/src/transformers/models/qwen2/__init__.py",
"repo_id": "transformers",
"token_count": 894
} | 684 |
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/poly/layer.py/0 | {
"file_path": "peft/src/peft/tuners/poly/layer.py",
"repo_id": "peft",
"token_count": 3322
} | 307 |
extern crate napi_build;
fn main() {
napi_build::setup();
}
| tokenizers/bindings/node/build.rs/0 | {
"file_path": "tokenizers/bindings/node/build.rs",
"repo_id": "tokenizers",
"token_count": 26
} | 437 |
use crate::models::with_tracing::{layer_norm, linear, Embedding, LayerNorm, Linear};
/// Phi model.
/// https://huggingface.co/microsoft/phi-2
/// There is an alternative implementation of the phi model in mixformers.rs.
/// This corresponds to the model update made with the following commit:
/// https://huggingface.co... | candle/candle-transformers/src/models/phi.rs/0 | {
"file_path": "candle/candle-transformers/src/models/phi.rs",
"repo_id": "candle",
"token_count": 6392
} | 72 |
import { BaseEntityStore } from "./base.js";
/**
* An entity store that keeps data in memory. It extends from the
* `BaseEntityStore` class and is used to store and manage entities.
*/
export class InMemoryEntityStore extends BaseEntityStore {
lc_namespace = ["langchain", "stores", "entity", "in_memory"];
priv... | langchainjs/langchain/src/memory/stores/entity/in_memory.ts/0 | {
"file_path": "langchainjs/langchain/src/memory/stores/entity/in_memory.ts",
"repo_id": "langchainjs",
"token_count": 582
} | 999 |
#include <metal_stdlib>
using namespace metal;
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define MIN(x, y) ((x) < (y) ? (x) : (y))
METAL_FUNC uint get_strided_index(
uint idx,
constant size_t &num_dims,
constant size_t *dims,
constant size_t *strides
) {
uint strided_i = 0;
for (uint d = 0; d ... | candle/candle-metal-kernels/src/reduce.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/reduce.metal",
"repo_id": "candle",
"token_count": 8032
} | 61 |
import { Tool } from "@langchain/core/tools";
/**
* Interface for the parameters that can be passed to the
* WikipediaQueryRun constructor.
*/
export interface WikipediaQueryRunParams {
topKResults?: number;
maxDocContentLength?: number;
baseUrl?: string;
}
/**
* Type alias for URL parameters. Represents a ... | langchainjs/libs/langchain-community/src/tools/wikipedia_query_run.ts/0 | {
"file_path": "langchainjs/libs/langchain-community/src/tools/wikipedia_query_run.ts",
"repo_id": "langchainjs",
"token_count": 1650
} | 962 |
import CodeBlock from "@theme/CodeBlock";
import Example from "@examples/agents/connery_mrkl.ts";
import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx";
# Connery Toolkit
Using this toolkit, you can integrate Connery Actions into your LangChain agent.
:::note
If you want to use only... | langchainjs/docs/core_docs/docs/integrations/toolkits/connery.mdx/0 | {
"file_path": "langchainjs/docs/core_docs/docs/integrations/toolkits/connery.mdx",
"repo_id": "langchainjs",
"token_count": 677
} | 739 |
import torch
from diffusers import DDIMInverseScheduler
from .test_schedulers import SchedulerCommonTest
class DDIMInverseSchedulerTest(SchedulerCommonTest):
scheduler_classes = (DDIMInverseScheduler,)
forward_default_kwargs = (("num_inference_steps", 50),)
def get_scheduler_config(self, **kwargs):
... | diffusers/tests/schedulers/test_scheduler_ddim_inverse.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_ddim_inverse.py",
"repo_id": "diffusers",
"token_count": 2258
} | 280 |
import html
import inspect
import re
import urllib.parse as ul
from typing import Any, Callable, Dict, List, Optional, Union
import numpy as np
import PIL.Image
import torch
from transformers import CLIPImageProcessor, T5EncoderModel, T5Tokenizer
from ...loaders import LoraLoaderMixin
from ...models import UNet2DCond... | diffusers/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py",
"repo_id": "diffusers",
"token_count": 21144
} | 250 |
"""Zapier Toolkit."""
| langchain/libs/community/langchain_community/agent_toolkits/zapier/__init__.py/0 | {
"file_path": "langchain/libs/community/langchain_community/agent_toolkits/zapier/__init__.py",
"repo_id": "langchain",
"token_count": 9
} | 211 |
# CIP-4: In and Not In Metadata Filters Proposal
## Status
Current Status: `Under Discussion`
## **Motivation**
Currently, Chroma does not provide a way to filter metadata through `in` and `not in`. This appears to be a frequent ask
from community members.
## **Public Interfaces**
The changes will affect the foll... | chroma/docs/CIP_4_In_Nin_Metadata_Filters.md/0 | {
"file_path": "chroma/docs/CIP_4_In_Nin_Metadata_Filters.md",
"repo_id": "chroma",
"token_count": 552
} | 40 |
"""Embedding utils for LlamaIndex."""
import os
from typing import TYPE_CHECKING, List, Optional, Union
if TYPE_CHECKING:
from llama_index.core.bridge.langchain import Embeddings as LCEmbeddings
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.callbacks import CallbackManager
... | llama_index/llama-index-core/llama_index/core/embeddings/utils.py/0 | {
"file_path": "llama_index/llama-index-core/llama_index/core/embeddings/utils.py",
"repo_id": "llama_index",
"token_count": 2298
} | 1,171 |
# coding=utf-8
# Copyright 2022 NVIDIA The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | transformers/src/transformers/models/segformer/modeling_tf_segformer.py/0 | {
"file_path": "transformers/src/transformers/models/segformer/modeling_tf_segformer.py",
"repo_id": "transformers",
"token_count": 19147
} | 655 |
import srtParser2 from "srt-parser-2";
import { TextLoader } from "./text.js";
/**
* A class that extends the `TextLoader` class. It represents a document
* loader that loads documents from SRT (SubRip) subtitle files. It has a
* constructor that takes a `filePathOrBlob` parameter representing the
* path to the SR... | langchainjs/langchain/src/document_loaders/fs/srt.ts/0 | {
"file_path": "langchainjs/langchain/src/document_loaders/fs/srt.ts",
"repo_id": "langchainjs",
"token_count": 527
} | 863 |
---
sidebar_position: 3
---
# Tool usage
This section will cover how to create conversational agents: chatbots that can interact with other systems and APIs using tools.
Before reading this guide, we recommend you read both [the chatbot quickstart](/docs/use_cases/chatbots/quickstart) in this section and be familiar... | langchainjs/docs/core_docs/docs/use_cases/chatbots/tool_usage.mdx/0 | {
"file_path": "langchainjs/docs/core_docs/docs/use_cases/chatbots/tool_usage.mdx",
"repo_id": "langchainjs",
"token_count": 2521
} | 823 |
# LlamaIndex Readers Integration: ClickHouse
| llama_index/llama-index-integrations/readers/llama-index-readers-clickhouse/README.md/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-clickhouse/README.md",
"repo_id": "llama_index",
"token_count": 10
} | 1,274 |
# flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
# coding=utf-8
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not ... | peft/src/peft/__init__.py/0 | {
"file_path": "peft/src/peft/__init__.py",
"repo_id": "peft",
"token_count": 952
} | 303 |
from langchain_community.retrievers.tavily_search_api import (
SearchDepth,
TavilySearchAPIRetriever,
)
__all__ = ["SearchDepth", "TavilySearchAPIRetriever"]
| langchain/libs/langchain/langchain/retrievers/tavily_search_api.py/0 | {
"file_path": "langchain/libs/langchain/langchain/retrievers/tavily_search_api.py",
"repo_id": "langchain",
"token_count": 63
} | 535 |
from langchain_community.utilities.openweathermap import OpenWeatherMapAPIWrapper
def test_openweathermap_api_wrapper() -> None:
"""Test that OpenWeatherMapAPIWrapper returns correct data for London, GB."""
weather = OpenWeatherMapAPIWrapper()
weather_data = weather.run("London,GB")
assert weather_d... | langchain/libs/community/tests/integration_tests/utilities/test_openweathermap.py/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/utilities/test_openweathermap.py",
"repo_id": "langchain",
"token_count": 273
} | 382 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.