text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
#!/usr/bin/env python """Example LangChain server exposes a conversational retrieval chain. Follow the reference here: https://python.langchain.com/docs/expression_language/cookbook/retrieval#conversational-retrieval-chain To run this example, you will need to install the following packages: pip install langchain op...
langserve/examples/conversational_retrieval_chain/server.py/0
{ "file_path": "langserve/examples/conversational_retrieval_chain/server.py", "repo_id": "langserve", "token_count": 1171 }
1,125
import type { EmbeddingsInterface } from "@langchain/core/embeddings"; import type { MongoClient, Collection, Document as MongoDocument, } from "mongodb"; import { Document } from "@langchain/core/documents"; import { VectorStore } from "@langchain/core/vectorstores"; /** @deprecated use `MongoDBAtlasVectorSearc...
langchainjs/langchain/src/vectorstores/mongo.ts/0
{ "file_path": "langchainjs/langchain/src/vectorstores/mongo.ts", "repo_id": "langchainjs", "token_count": 2312 }
982
syntax = "proto3"; package milvus.proto.legacy; option go_package = "github.com/milvus-io/milvus/internal/proto/legacypb"; import "common.proto"; import "schema.proto"; /********************************** Index Build Meta Before Version 220 ***************************************/ message BuildIndexRequest { int...
milvus/cmd/tools/migration/legacy/legacy.proto/0
{ "file_path": "milvus/cmd/tools/migration/legacy/legacy.proto", "repo_id": "milvus", "token_count": 302 }
1,632
from langchain_experimental.utilities.python import PythonREPL __all__ = ["PythonREPL"]
langchain/libs/experimental/langchain_experimental/utilities/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/utilities/__init__.py", "repo_id": "langchain", "token_count": 27 }
450
<p align="center"> <a href="https://trychroma.com"><img src="https://user-images.githubusercontent.com/891664/227103090-6624bf7d-9524-4e05-9d2c-c28d5d451481.png" alt="Chroma logo"></a> </p> <p align="center"> <b>Chroma - the open-source embedding database</b>. <br /> This package is for the the Python HTTP c...
chroma/clients/python/README.md/0
{ "file_path": "chroma/clients/python/README.md", "repo_id": "chroma", "token_count": 503 }
35
/* eslint-disable no-process-env */ import { test, expect } from "@jest/globals"; import { Client } from "@opensearch-project/opensearch"; import { OpenAIEmbeddings } from "@langchain/openai"; import { Document } from "@langchain/core/documents"; import { OpenSearchVectorStore } from "../opensearch.js"; test.skip("Ope...
langchainjs/libs/langchain-community/src/vectorstores/tests/opensearch.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/opensearch.int.test.ts", "repo_id": "langchainjs", "token_count": 445 }
973
from langchain_community.document_loaders.discord import DiscordChatLoader __all__ = ["DiscordChatLoader"]
langchain/libs/langchain/langchain/document_loaders/discord.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/discord.py", "repo_id": "langchain", "token_count": 30 }
479
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-xinference/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-xinference/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,285
package common import "reflect" type ByteSlice []byte func (s ByteSlice) Clone() ByteSlice { clone := make(ByteSlice, len(s)) copy(clone, s) return clone } func (s ByteSlice) Equal(other ByteSlice) bool { return reflect.DeepEqual(s, other) } func CloneByteSlice(s ByteSlice) ByteSlice { return s.Clone() }
milvus/pkg/common/byte_slice.go/0
{ "file_path": "milvus/pkg/common/byte_slice.go", "repo_id": "milvus", "token_count": 120 }
1,805
python_sources() python_tests( name="tests0", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azurecosmosmongo/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azurecosmosmongo/tests/BUILD", "repo_id": "llama_index", "token_count": 23 }
1,648
cmake_build .git .docker
milvus/.dockerignore/0
{ "file_path": "milvus/.dockerignore", "repo_id": "milvus", "token_count": 10 }
1,831
from typing import Any, Dict, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class KnowledgeBaseWebReader(BaseReader): """Knowledge base reader. Crawls and reads articles from a knowledge base/help center with Playwright. Tested on Zendes...
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/knowledge_base/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/knowledge_base/base.py", "repo_id": "llama_index", "token_count": 2573 }
1,455
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,303
from propositional_retrieval.chain import chain from propositional_retrieval.proposal_chain import proposition_chain __all__ = ["chain", "proposition_chain"]
langchain/templates/propositional-retrieval/propositional_retrieval/__init__.py/0
{ "file_path": "langchain/templates/propositional-retrieval/propositional_retrieval/__init__.py", "repo_id": "langchain", "token_count": 44 }
648
"""Util that calls Google Finance Search.""" from typing import Any, Dict, Optional, cast from langchain_core.pydantic_v1 import BaseModel, Extra, SecretStr, root_validator from langchain_core.utils import convert_to_secret_str, get_from_dict_or_env class GoogleFinanceAPIWrapper(BaseModel): """Wrapper for SerpAp...
langchain/libs/community/langchain_community/utilities/google_finance.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/google_finance.py", "repo_id": "langchain", "token_count": 1534 }
300
# Recursively split by character This text splitter is the recommended one for generic text. It is parameterized by a list of characters. It tries to split on them in order until the chunks are small enough. The default list of separators is `["\n\n", "\n", " ", ""]`. This has the effect of trying to keep all paragrap...
langchainjs/docs/core_docs/docs/modules/data_connection/document_transformers/recursive_text_splitter.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/document_transformers/recursive_text_splitter.mdx", "repo_id": "langchainjs", "token_count": 683 }
756
[tool.poetry] name = "python-lint" version = "0.0.1" description = "Python code-writing agent whose work is checked by black, ruff, and mypy." authors = ["Joshua Sundance Bailey"] readme = "README.md" [tool.poetry.dependencies] ruff = ">=0.1.8" black = ">=23.12.0" mypy = ">=1.7.1" python = ">=3.8.1,<4.0" langchain = "...
langchain/templates/python-lint/pyproject.toml/0
{ "file_path": "langchain/templates/python-lint/pyproject.toml", "repo_id": "langchain", "token_count": 323 }
679
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration SPEED_TEST_N_EXAMPLES = 500_000 RESULTS_BASEPATH, RESULTS_FILENAME = os.path.split(__file__) RESULTS_FILE_PATH = os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py...
datasets/benchmarks/benchmark_map_filter.py/0
{ "file_path": "datasets/benchmarks/benchmark_map_filter.py", "repo_id": "datasets", "token_count": 996 }
127
// 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/querycoordv2/task/task_test.go/0
{ "file_path": "milvus/internal/querycoordv2/task/task_test.go", "repo_id": "milvus", "token_count": 18147 }
1,901
# constants for old pymilvus API test import utils.util_pymilvus as utils default_fields = utils.gen_default_fields() default_binary_fields = utils.gen_binary_default_fields() default_entity = utils.gen_entities(1) default_raw_binary_vector, default_binary_entity = utils.gen_binary_entities(1) default_entity_row = ...
milvus/tests/python_client/common/constants.py/0
{ "file_path": "milvus/tests/python_client/common/constants.py", "repo_id": "milvus", "token_count": 339 }
1,896
# Contributing to Milvus Contributions to Milvus are welcome from everyone. We strive to make the contribution process simple and straightforward. Up-to-date information can be found at [milvus.io](https://milvus.io/). The following are a set of guidelines for contributing to Milvus. Following these guidelines makes ...
milvus/CONTRIBUTING.md/0
{ "file_path": "milvus/CONTRIBUTING.md", "repo_id": "milvus", "token_count": 4340 }
1,832
// 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/exec/expression/BinaryRangeExpr.cpp/0
{ "file_path": "milvus/internal/core/src/exec/expression/BinaryRangeExpr.cpp", "repo_id": "milvus", "token_count": 7731 }
1,924
<jupyter_start><jupyter_text>Run TemplateIn `server.py`, set -```add_routes(app, chain_rag_timescale_conv, path="/rag_timescale_conversation")```<jupyter_code>from langserve.client import RemoteRunnable rag_app = RemoteRunnable("http://0.0.0.0:8000/rag_timescale_conversation")<jupyter_output><empty_output><jupyter_tex...
langchain/templates/rag-timescale-conversation/rag_conversation.ipynb/0
{ "file_path": "langchain/templates/rag-timescale-conversation/rag_conversation.ipynb", "repo_id": "langchain", "token_count": 756 }
691
import logging import pytest import functools import socket import common.common_type as ct import common.common_func as cf from utils.util_log import test_log as log from common.common_func import param_info from check.param_check import ip_check, number_check from config.log_config import log_config from utils.util...
milvus/tests/python_client/conftest.py/0
{ "file_path": "milvus/tests/python_client/conftest.py", "repo_id": "milvus", "token_count": 6243 }
1,974
# Full-Stack Web Application LlamaIndex can be integrated into a downstream full-stack web application. It can be used in a backend server (such as Flask), packaged into a Docker container, and/or directly used in a framework such as Streamlit. We provide tutorials and resources to help you get started in this area: ...
llama_index/docs/understanding/putting_it_all_together/apps.md/0
{ "file_path": "llama_index/docs/understanding/putting_it_all_together/apps.md", "repo_id": "llama_index", "token_count": 311 }
1,152
import logging import time import pytest from pymilvus import DataType import numpy as np from pathlib import Path from base.client_base import TestcaseBase from common import common_func as cf from common import common_type as ct from common.milvus_sys import MilvusSys from common.common_type import CaseLabel, CheckTa...
milvus/tests/python_client/testcases/test_bulk_insert.py/0
{ "file_path": "milvus/tests/python_client/testcases/test_bulk_insert.py", "repo_id": "milvus", "token_count": 37274 }
2,006
//! 2D UNet Denoising Models //! //! The 2D Unet models take as input a noisy sample and the current diffusion //! timestep and return a denoised version of the input. use super::embeddings::{TimestepEmbedding, Timesteps}; use super::unet_2d_blocks::*; use crate::models::with_tracing::{conv2d, Conv2d}; use candle::{Res...
candle/candle-transformers/src/models/stable_diffusion/unet_2d.rs/0
{ "file_path": "candle/candle-transformers/src/models/stable_diffusion/unet_2d.rs", "repo_id": "candle", "token_count": 8419 }
78
committers: - congqixia - czs007 - scsven - xiaofan-luan - yanliang567 - jiaoew1991 - yhmo - matrixji - LoveEachDay - XuanYang-cn - JackLCL - bigsheeper
milvus/COMMITTERS/0
{ "file_path": "milvus/COMMITTERS", "repo_id": "milvus", "token_count": 86 }
1,883
// 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/storage/azure-blob-storage/AzureBlobChunkManager.h/0
{ "file_path": "milvus/internal/core/src/storage/azure-blob-storage/AzureBlobChunkManager.h", "repo_id": "milvus", "token_count": 1250 }
1,776
python_sources()
llama_index/llama-index-core/llama_index/core/llms/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/llms/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,137
# These kubernetes manifests are UNDER ACTIVE DEVELOPMENT and are not yet ready for production use. # They will be used for the upcoming distributed version of chroma. They are not even ready # for testing yet. Please do not use them unless you are working on the distributed version of chroma. apiVersion: v1 kind: Se...
chroma/k8s/test/pulsar_service.yaml/0
{ "file_path": "chroma/k8s/test/pulsar_service.yaml", "repo_id": "chroma", "token_count": 186 }
58
// 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/datacoord/segment_allocation_policy.go/0
{ "file_path": "milvus/internal/datacoord/segment_allocation_policy.go", "repo_id": "milvus", "token_count": 2422 }
1,831
<jupyter_start><jupyter_text>Tavily Search API[Tavily's Search API](https://tavily.com) is a search engine built specifically for AI agents (LLMs), delivering real-time, accurate, and factual results at speed.We can use this as a [retriever](/docs/modules/data_connection/retrievers). It will show functionality specific...
langchain/docs/docs/integrations/retrievers/tavily.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/tavily.ipynb", "repo_id": "langchain", "token_count": 682 }
171
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/evaluation/tonic_validate/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/evaluation/tonic_validate/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,652
{ "modelname": "BrandNewBERT", "uppercase_modelname": "BRAND_NEW_BERT", "lowercase_modelname": "brand_new_bert", "camelcase_modelname": "BrandNewBert", "has_slow_class": ["True", "False"], "has_fast_class": ["True", "False"], "slow_tokenizer_use_sentencepiece": ["True", "False"], "authors": "The Hugging...
transformers/templates/adding_a_missing_tokenization_test/cookiecutter.json/0
{ "file_path": "transformers/templates/adding_a_missing_tokenization_test/cookiecutter.json", "repo_id": "transformers", "token_count": 129 }
719
--- - name: Install Packages yum: name={{ item }} state=latest update_cache=yes with_items: - ntp - tcpdump - python3 - wget - openssl - curl - python3-pip when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' - name: Install Packages apt: nam...
milvus/deployments/docker/cluster-distributed-deployment/roles/install-modules/tasks/main.yml/0
{ "file_path": "milvus/deployments/docker/cluster-distributed-deployment/roles/install-modules/tasks/main.yml", "repo_id": "milvus", "token_count": 218 }
1,625
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-auto-merging-retriever/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-auto-merging-retriever/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,693
import { SqlDatabase } from "langchain/sql_db"; import { DataSource } from "typeorm"; const datasource = new DataSource({ type: "sqlite", database: "../../../../Chinook.db", }); const db = await SqlDatabase.fromDataSourceParams({ appDataSource: datasource, }); console.log(db.allTables.map((t) => t.tableName)); /...
langchainjs/examples/src/use_cases/sql/db_check.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/sql/db_check.ts", "repo_id": "langchainjs", "token_count": 190 }
919
# coding=utf-8 # Copyright 2020 Microsoft and the Hugging Face 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 require...
transformers/src/transformers/models/deberta_v2/modeling_deberta_v2.py/0
{ "file_path": "transformers/src/transformers/models/deberta_v2/modeling_deberta_v2.py", "repo_id": "transformers", "token_count": 29893 }
587
<jupyter_start><jupyter_text>Few-shot examples for chat modelsThis notebook covers how to use few-shot examples in chat models. There does not appear to be solid consensus on how best to do few-shot prompting, and the optimal prompt compilation will likely vary by model. Because of this, we provide few-shot prompt temp...
langchain/docs/docs/modules/model_io/prompts/few_shot_examples_chat.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/prompts/few_shot_examples_chat.ipynb", "repo_id": "langchain", "token_count": 2368 }
210
<jupyter_start><jupyter_text>FastEmbed by Qdrant>[FastEmbed](https://qdrant.github.io/fastembed/) from [Qdrant](https://qdrant.tech) is a lightweight, fast, Python library built for embedding generation. >>- Quantized model weights>- ONNX Runtime, no PyTorch dependency>- CPU-first design>- Data-parallelism for encoding...
langchain/docs/docs/integrations/text_embedding/fastembed.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/fastembed.ipynb", "repo_id": "langchain", "token_count": 609 }
173
to a snake Moses' assistant Egyptian royal court let his rod turn in to a snake The Pokémon Company Nintendo world's top-selling toy brand, the top-selling trading card game over 20 seasons
transformers/examples/research_projects/rag-end2end-retriever/test_run/dummy-train-data/test.target/0
{ "file_path": "transformers/examples/research_projects/rag-end2end-retriever/test_run/dummy-train-data/test.target", "repo_id": "transformers", "token_count": 49 }
597
import os from typing import Any, List, Optional from llama_index.core.bridge.pydantic import Field, PrivateAttr from llama_index.core.callbacks import CBEventType, EventPayload from llama_index.core.postprocessor.types import BaseNodePostprocessor from llama_index.core.schema import NodeWithScore, QueryBundle class...
llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-cohere-rerank/llama_index/postprocessor/cohere_rerank/base.py/0
{ "file_path": "llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-cohere-rerank/llama_index/postprocessor/cohere_rerank/base.py", "repo_id": "llama_index", "token_count": 1256 }
1,327
python_tests( name="tests", )
llama_index/llama-index-core/tests/memory/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/memory/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,210
import asyncio import logging from typing import Dict, List, Optional from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) class MongodbLoader(BaseLoader): """Load MongoDB documents.""" def __init__( sel...
langchain/libs/community/langchain_community/document_loaders/mongodb.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/mongodb.py", "repo_id": "langchain", "token_count": 1022 }
251
from langchain_ibm import __all__ EXPECTED_ALL = ["WatsonxLLM"] def test_all_imports() -> None: assert sorted(EXPECTED_ALL) == sorted(__all__)
langchain/libs/partners/ibm/tests/unit_tests/test_imports.py/0
{ "file_path": "langchain/libs/partners/ibm/tests/unit_tests/test_imports.py", "repo_id": "langchain", "token_count": 59 }
626
data "external_schema" "gorm" { program = [ "go", "run", "-mod=mod", "ariga.io/atlas-provider-gorm", "load", "--path", "./internal/metastore/db/dbmodel", "--dialect", "postgres", ] } env "gorm" { src = data.external_schema.gorm.url dev = "postgres://localhost:5432/dev?sslmode=disabl...
chroma/go/coordinator/atlas.hcl/0
{ "file_path": "chroma/go/coordinator/atlas.hcl", "repo_id": "chroma", "token_count": 206 }
43
# coding=utf-8 # Copyright 2021 The Eleuther AI and 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-...
transformers/src/transformers/models/gpt_neo/modeling_gpt_neo.py/0
{ "file_path": "transformers/src/transformers/models/gpt_neo/modeling_gpt_neo.py", "repo_id": "transformers", "token_count": 25688 }
613
import os import pkgutil from copy import deepcopy from torch import nn as nn from timm.layers import Conv2dSame, BatchNormAct2d, Linear __all__ = ['extract_layer', 'set_layer', 'adapt_model_from_string', 'adapt_model_from_file'] def extract_layer(model, layer): layer = layer.split('.') module = model ...
pytorch-image-models/timm/models/_prune.py/0
{ "file_path": "pytorch-image-models/timm/models/_prune.py", "repo_id": "pytorch-image-models", "token_count": 2021 }
339
<jupyter_start><jupyter_text>Aphrodite Engine[Aphrodite](https://github.com/PygmalionAI/aphrodite-engine) is the open-source large-scale inference engine designed to serve thousands of users on the [PygmalionAI](https://pygmalion.chat) website.* Attention mechanism by vLLM for fast throughput and low latencies * Suppor...
langchain/docs/docs/integrations/llms/aphrodite.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/aphrodite.ipynb", "repo_id": "langchain", "token_count": 1209 }
115
from langchain_community.llms import HuggingFaceTextGenInference def test_invocation_params_stop_sequences() -> None: llm = HuggingFaceTextGenInference() assert llm._default_params["stop_sequences"] == [] runtime_stop = None assert llm._invocation_params(runtime_stop)["stop_sequences"] == [] asse...
langchain/libs/community/tests/integration_tests/llms/test_huggingface_text_gen_inference.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_huggingface_text_gen_inference.py", "repo_id": "langchain", "token_count": 263 }
371
import { Document } from "@langchain/core/documents"; /** * Splits a list of documents into sublists based on a maximum token limit. * * @param {Document[]} docs - The list of documents to be split. * @param {Function} lengthFunc - A function that calculates the number of tokens in a list of documents. * @param {...
langchainjs/langchain/src/chains/combine_documents/reduce.ts/0
{ "file_path": "langchainjs/langchain/src/chains/combine_documents/reduce.ts", "repo_id": "langchainjs", "token_count": 977 }
953
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast logger = datasets.utils.logging.get_logger(__name__) @dataclass class ParquetConfig(datasets.BuilderConfig): """BuilderCo...
datasets/src/datasets/packaged_modules/parquet/parquet.py/0
{ "file_path": "datasets/src/datasets/packaged_modules/parquet/parquet.py", "repo_id": "datasets", "token_count": 2068 }
137
# coding=utf-8 # Copyright 2022 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...
transformers/src/transformers/processing_utils.py/0
{ "file_path": "transformers/src/transformers/processing_utils.py", "repo_id": "transformers", "token_count": 9681 }
702
// 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/proxy/task_index_test.go/0
{ "file_path": "milvus/internal/proxy/task_index_test.go", "repo_id": "milvus", "token_count": 10479 }
1,833
<!--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/en/model_sharing.md/0
{ "file_path": "transformers/docs/source/en/model_sharing.md", "repo_id": "transformers", "token_count": 2963 }
493
import re from typing import List, Optional, Tuple import math import torch from text_generation_server.pb import generate_pb2 from text_generation_server.pb.generate_pb2 import FinishReason, GrammarType from text_generation_server.utils.logits_process import ( FrequencyPenaltyLogitsProcessor, GrammarLogitProc...
text-generation-inference/server/text_generation_server/utils/tokens.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/tokens.py", "repo_id": "text-generation-inference", "token_count": 10876 }
451
# Retry Query Engine This LlamaPack inserts your data into [Weaviate](https://weaviate.io/developers/weaviate) and uses the [Retry Query Engine](https://gpt-index.readthedocs.io/en/latest/examples/evaluation/RetryQuery.html) for your RAG application. ## CLI Usage You can download llamapacks directly using `llamainde...
llama_index/llama-index-packs/llama-index-packs-retry-engine-weaviate/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-retry-engine-weaviate/README.md", "repo_id": "llama_index", "token_count": 739 }
1,868
python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/storage/docstore/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/storage/docstore/BUILD", "repo_id": "llama_index", "token_count": 25 }
1,818
# coding=utf-8 # Copyright 2021 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 # # Unless r...
transformers/tests/models/visual_bert/test_modeling_visual_bert.py/0
{ "file_path": "transformers/tests/models/visual_bert/test_modeling_visual_bert.py", "repo_id": "transformers", "token_count": 14046 }
743
# 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/pipelines/deprecated/stable_diffusion_variants/pipeline_cycle_diffusion.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_cycle_diffusion.py", "repo_id": "diffusers", "token_count": 21263 }
257
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 // - protoc v4.23.4 // source: chromadb/proto/chroma.proto package coordinatorpb import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grp...
chroma/go/coordinator/internal/proto/coordinatorpb/chroma_grpc.pb.go/0
{ "file_path": "chroma/go/coordinator/internal/proto/coordinatorpb/chroma_grpc.pb.go", "repo_id": "chroma", "token_count": 1791 }
50
<jupyter_start><jupyter_text>**Fine-tuning for Audio Classification with 🤗 Transformers** This notebook shows how to fine-tune multi-lingual pretrained speech models for Automatic Speech Recognition. This notebook is built to run on the **Keyword Spotting** subset of the [SUPERB dataset](https://huggingface.co/dataset...
notebooks/examples/audio_classification.ipynb/0
{ "file_path": "notebooks/examples/audio_classification.ipynb", "repo_id": "notebooks", "token_count": 4362 }
305
# AWS SageMakerEndpoint LangChain.js supports integration with AWS SageMaker-hosted endpoints. Check [Amazon SageMaker JumpStart](https://aws.amazon.com/sagemaker/jumpstart/) for a list of available models, and how to deploy your own. ## Setup You'll need to install the official SageMaker SDK as a peer dependency: ...
langchainjs/docs/core_docs/docs/integrations/llms/aws_sagemaker.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/llms/aws_sagemaker.mdx", "repo_id": "langchainjs", "token_count": 240 }
762
"""Vectara RAG Pack.""" from typing import Any, Dict, List, Optional from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.schema import TextNode from llama_index.indices.managed.vectara import VectaraIndex class VectaraRagPack(BaseLlamaPack): """Vectara RAG pack.""" def __init_...
llama_index/llama-index-packs/llama-index-packs-vectara-rag/llama_index/packs/vectara_rag/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-vectara-rag/llama_index/packs/vectara_rag/base.py", "repo_id": "llama_index", "token_count": 562 }
1,685
# LlamaIndex Kvstore Integration: Postgres
llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-postgres/README.md/0
{ "file_path": "llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-postgres/README.md", "repo_id": "llama_index", "token_count": 12 }
1,425
"""DeepLake multimodal Retrieval Pack.""" from typing import Any, Dict, List, Optional from llama_index.core.indices.multi_modal import MultiModalVectorStoreIndex from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.query_engine import SimpleMultiModalQueryEngine from llama_index.core.sch...
llama_index/llama-index-packs/llama-index-packs-deeplake-multimodal-retrieval/llama_index/packs/deeplake_multimodal_retrieval/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-deeplake-multimodal-retrieval/llama_index/packs/deeplake_multimodal_retrieval/base.py", "repo_id": "llama_index", "token_count": 1365 }
1,650
package msgstream import ( "context" "math/rand" "reflect" "runtime" "sync" "testing" "time" "github.com/stretchr/testify/assert" "go.uber.org/zap" "github.com/milvus-io/milvus/pkg/log" "github.com/milvus-io/milvus/pkg/mq/msgstream/mqwrapper" "github.com/milvus-io/milvus/pkg/util/funcutil" ) func testSt...
milvus/pkg/mq/msgstream/stream_test.go/0
{ "file_path": "milvus/pkg/mq/msgstream/stream_test.go", "repo_id": "milvus", "token_count": 2943 }
1,903
from langchain_core.callbacks import __all__ EXPECTED_ALL = [ "RetrieverManagerMixin", "LLMManagerMixin", "ChainManagerMixin", "ToolManagerMixin", "Callbacks", "CallbackManagerMixin", "RunManagerMixin", "BaseCallbackHandler", "AsyncCallbackHandler", "BaseCallbackManager", "B...
langchain/libs/core/tests/unit_tests/callbacks/test_imports.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/callbacks/test_imports.py", "repo_id": "langchain", "token_count": 362 }
428
# coding=utf-8 # Copyright 2022 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 # # Unless r...
transformers/tests/models/vit_msn/test_modeling_vit_msn.py/0
{ "file_path": "transformers/tests/models/vit_msn/test_modeling_vit_msn.py", "repo_id": "transformers", "token_count": 3549 }
794
python_sources()
llama_index/llama-index-packs/llama-index-packs-rag-evaluator/examples/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-rag-evaluator/examples/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,862
from typing import Any from packaging import version def _import_pinecone() -> Any: """ Try to import pinecone module. If it's not already installed, instruct user how to install. """ try: import pinecone except ImportError as e: raise ImportError( "Could not import pi...
llama_index/llama-index-legacy/llama_index/legacy/vector_stores/pinecone_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/vector_stores/pinecone_utils.py", "repo_id": "llama_index", "token_count": 317 }
1,611
# coding=utf-8 # Copyright 2022 KAIST 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 # ...
transformers/src/transformers/models/glpn/modeling_glpn.py/0
{ "file_path": "transformers/src/transformers/models/glpn/modeling_glpn.py", "repo_id": "transformers", "token_count": 13224 }
622
"""Class for a VectorStore-backed memory object.""" from typing import Any, Dict, List, Optional, Sequence, Union from langchain_core.documents import Document from langchain_core.pydantic_v1 import Field from langchain_core.vectorstores import VectorStoreRetriever from langchain.memory.chat_memory import BaseMemory...
langchain/libs/langchain/langchain/memory/vectorstore.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/vectorstore.py", "repo_id": "langchain", "token_count": 1126 }
549
# coding=utf-8 # Copyright 2021 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...
transformers/utils/update_metadata.py/0
{ "file_path": "transformers/utils/update_metadata.py", "repo_id": "transformers", "token_count": 5884 }
859
// Code generated by mockery v2.32.4. DO NOT EDIT. package datacoord import ( context "context" mock "github.com/stretchr/testify/mock" ) // NMockAllocator is an autogenerated mock type for the allocator type type NMockAllocator struct { mock.Mock } type NMockAllocator_Expecter struct { mock *mock.Mock } func...
milvus/internal/datacoord/mock_allocator_test.go/0
{ "file_path": "milvus/internal/datacoord/mock_allocator_test.go", "repo_id": "milvus", "token_count": 1536 }
1,776
import random import string from langchain_core.documents import Document from langchain_community.document_loaders.pyspark_dataframe import ( PySparkDataFrameLoader, ) def test_pyspark_loader_load_valid_data() -> None: from pyspark.sql import SparkSession # Requires a session to be set up spark = ...
langchain/libs/community/tests/integration_tests/document_loaders/test_pyspark_dataframe_loader.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_pyspark_dataframe_loader.py", "repo_id": "langchain", "token_count": 456 }
326
import datetime from typing import Any, List, Optional from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.outputs import LLMResult from langchain_community.llms.openai import OpenAI, OpenAIChat class PromptLayerOpenAI(OpenAI): """PromptL...
langchain/libs/community/langchain_community/llms/promptlayer_openai.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/promptlayer_openai.py", "repo_id": "langchain", "token_count": 4125 }
281
from __future__ import annotations import logging from typing import Any, Dict, List, Optional, Tuple, Type, Union from langchain.base_language import BaseLanguageModel from langchain.callbacks.manager import CallbackManagerForChainRun from langchain.chains.llm import LLMChain from langchain.prompts import BasePrompt...
langchain/libs/experimental/langchain_experimental/rl_chain/pick_best_chain.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/rl_chain/pick_best_chain.py", "repo_id": "langchain", "token_count": 7219 }
454
base_job_name: accelerate-sagemaker-1 compute_environment: AMAZON_SAGEMAKER distributed_type: DATA_PARALLEL ec2_instance_type: ml.p3.16xlarge iam_role_name: xxxxx image_uri: null mixed_precision: fp16 num_machines: 1 profile: xxxxx py_version: py38 pytorch_version: 1.10.2 region: us-east-1 sagemaker_inputs_file: sagema...
notebooks/sagemaker/22_accelerate_sagemaker_examples/src/text-classification/accelerate_config.yaml/0
{ "file_path": "notebooks/sagemaker/22_accelerate_sagemaker_examples/src/text-classification/accelerate_config.yaml", "repo_id": "notebooks", "token_count": 177 }
290
<!--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 applicable law or agreed...
diffusers/docs/source/en/api/pipelines/stable_diffusion/upscale.md/0
{ "file_path": "diffusers/docs/source/en/api/pipelines/stable_diffusion/upscale.md", "repo_id": "diffusers", "token_count": 475 }
187
# Quickstart In this quickstart we'll show you how to: - Get setup with LangChain and LangSmith - Use the most basic and common components of LangChain: prompt templates, models, and output parsers - Use LangChain Expression Language, the protocol that LangChain is built on and which facilitates component chaining - ...
langchainjs/docs/core_docs/docs/get_started/quickstart.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/get_started/quickstart.mdx", "repo_id": "langchainjs", "token_count": 7408 }
770
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 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/LI...
diffusers/examples/controlnet/train_controlnet.py/0
{ "file_path": "diffusers/examples/controlnet/train_controlnet.py", "repo_id": "diffusers", "token_count": 19970 }
208
# coding=utf-8 # Copyright 2022 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 # # Unless r...
transformers/src/transformers/models/groupvit/configuration_groupvit.py/0
{ "file_path": "transformers/src/transformers/models/groupvit/configuration_groupvit.py", "repo_id": "transformers", "token_count": 8505 }
649
syntax = "proto3"; package milvus.proto.eventlog; option go_package = "github.com/milvus-io/milvus/pkg/eventlog"; service EventLogService { rpc Listen(ListenRequest) returns(stream Event) {} } message ListenRequest { } message Event { Level level = 1; int32 type = 2; bytes data = 3; int64 ts = 4...
milvus/pkg/eventlog/event_log.proto/0
{ "file_path": "milvus/pkg/eventlog/event_log.proto", "repo_id": "milvus", "token_count": 175 }
1,816
"""Cohere Reranker Finetuning Engine.""" import importlib.util import os from typing import Optional from llama_index.finetuning.types import BaseCohereRerankerFinetuningEngine from llama_index.postprocessor.cohere_rerank import CohereRerank class CohereRerankerFinetuneEngine(BaseCohereRerankerFinetuningEngine): ...
llama_index/llama-index-finetuning/llama_index/finetuning/rerankers/cohere_reranker.py/0
{ "file_path": "llama_index/llama-index-finetuning/llama_index/finetuning/rerankers/cohere_reranker.py", "repo_id": "llama_index", "token_count": 1279 }
1,336
apiVersion: chaos-mesh.org/v1alpha1 kind: PodChaos metadata: name: test-indexnode-pod-failure namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: app.kubernetes.io/instance: milvus-chaos component: indexnode mode: fixed value: "1" action: pod-failur...
milvus/tests/python_client/chaos/chaos_objects/pod_failure/chaos_indexnode_pod_failure.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/pod_failure/chaos_indexnode_pod_failure.yaml", "repo_id": "milvus", "token_count": 142 }
2,025
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-arxiv/llama_index/tools/arxiv/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-arxiv/llama_index/tools/arxiv/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,429
from langchain.callbacks.base import BaseCallbackHandler from langchain.schema import ChatMessage from langchain_openai import ChatOpenAI import streamlit as st class StreamHandler(BaseCallbackHandler): def __init__(self, container, initial_text=""): self.container = container self.text = initial_...
streamlit-agent/streamlit_agent/basic_streaming.py/0
{ "file_path": "streamlit-agent/streamlit_agent/basic_streaming.py", "repo_id": "streamlit-agent", "token_count": 503 }
1,992
--- sidebar_class_name: hidden --- # Adding memory (state) Chains can be initialized with a Memory object, which will persist data across calls to the chain. This makes a Chain stateful. ## Get started import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <IntegrationInstallToolt...
langchainjs/docs/core_docs/docs/modules/chains/how_to/memory.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/chains/how_to/memory.mdx", "repo_id": "langchainjs", "token_count": 403 }
738
<jupyter_start><jupyter_text>RankGPT Reranker Demonstration (Van Gogh Wiki)This demo integrates [RankGPT](https://github.com/sunnweiwei/RankGPT) into LlamaIndex as a reranker.Paper: [Is ChatGPT Good at Search? Investigating Large Language Models as Re-Ranking Agents](https://arxiv.org/abs/2304.09542)the idea of `RankGP...
llama_index/docs/examples/node_postprocessor/rankGPT.ipynb/0
{ "file_path": "llama_index/docs/examples/node_postprocessor/rankGPT.ipynb", "repo_id": "llama_index", "token_count": 2739 }
1,098
package indexparamcheck import ( "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" ) func TestCheckIndexValid(t *testing.T) { assert.NoError(t, CheckIndexValid(schemapb.DataType_Int64, "inverted_index", nil)) }
milvus/pkg/util/indexparamcheck/scalar_index_checker_test.go/0
{ "file_path": "milvus/pkg/util/indexparamcheck/scalar_index_checker_test.go", "repo_id": "milvus", "token_count": 113 }
1,972
# Metric Card for TER ## Metric Description TER (Translation Edit Rate, also called Translation Error Rate) is a metric to quantify the edit operations that a hypothesis requires to match a reference translation. We use the implementation that is already present in [sacrebleu](https://github.com/mjpost/sacreBLEU#ter),...
datasets/metrics/ter/README.md/0
{ "file_path": "datasets/metrics/ter/README.md", "repo_id": "datasets", "token_count": 2596 }
126
# coding=utf-8 # Copyright 2021 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 # # Unless r...
transformers/tests/models/layoutlmv2/test_modeling_layoutlmv2.py/0
{ "file_path": "transformers/tests/models/layoutlmv2/test_modeling_layoutlmv2.py", "repo_id": "transformers", "token_count": 9928 }
752
import builtins import unittest from typing import Any, Callable, Type from unittest.mock import patch import pytest from llama_index.legacy.vector_stores.pinecone import ( PineconeVectorStore, ) class MockPineconePods: __version__ = "2.2.4" @staticmethod def init(api_key: str, environment: str) -> ...
llama_index/llama-index-legacy/tests/vector_stores/test_pinecone.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/vector_stores/test_pinecone.py", "repo_id": "llama_index", "token_count": 1393 }
1,825
# Rust builder FROM lukemathwalker/cargo-chef:latest-rust-1.75 AS chef WORKDIR /usr/src ARG CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse FROM chef as planner COPY Cargo.toml Cargo.toml COPY rust-toolchain.toml rust-toolchain.toml COPY proto proto COPY benchmark benchmark COPY router router COPY launcher launcher RUN ca...
text-generation-inference/Dockerfile_amd/0
{ "file_path": "text-generation-inference/Dockerfile_amd", "repo_id": "text-generation-inference", "token_count": 2127 }
356
# Copyright 2020 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...
transformers/src/transformers/commands/env.py/0
{ "file_path": "transformers/src/transformers/commands/env.py", "repo_id": "transformers", "token_count": 2227 }
557
<jupyter_start><jupyter_text>KuzuQAChainThis notebook shows how to use LLMs to provide a natural language interface to [Kùzu](https://kuzudb.com) database. [Kùzu](https://kuzudb.com) is an in-process property graph database management system. You can simply install it with `pip`:```bashpip install kuzu```Once installed...
langchain/docs/docs/use_cases/graph/graph_kuzu_qa.ipynb/0
{ "file_path": "langchain/docs/docs/use_cases/graph/graph_kuzu_qa.ipynb", "repo_id": "langchain", "token_count": 1297 }
193
""" Transformer in Transformer (TNT) in PyTorch A PyTorch implement of TNT as described in 'Transformer in Transformer' - https://arxiv.org/abs/2103.00112 The official mindspore code is released and available at https://gitee.com/mindspore/mindspore/tree/master/model_zoo/research/cv/TNT """ import math import torch ...
pytorch-image-models/timm/models/tnt.py/0
{ "file_path": "pytorch-image-models/timm/models/tnt.py", "repo_id": "pytorch-image-models", "token_count": 6715 }
378
# Kaltura eSearch Loader This loader reads Kaltura Entries from [Kaltura](https://corp.kaltura.com) based on a Kaltura eSearch API call. Search queries can be passed as a pre-defined object of KalturaESearchEntryParams, or through a simple free text query. The result is a list of documents containing the Kaltura Entri...
llama_index/llama-index-integrations/readers/llama-index-readers-kaltura/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-kaltura/README.md", "repo_id": "llama_index", "token_count": 3257 }
1,372