text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# candle-jina-bert Jina-Bert is a general large language model with a context size of 8192, [model card](https://huggingface.co/jinaai/jina-embeddings-v2-base-en). In this example it can be used for two different tasks: - Compute sentence embeddings for a prompt. - Compute similarities between a set of sentences. ##...
candle/candle-examples/examples/jina-bert/README.md/0
{ "file_path": "candle/candle-examples/examples/jina-bert/README.md", "repo_id": "candle", "token_count": 663 }
41
from typing import Dict MISTRALAI_MODELS: Dict[str, int] = { "mistral-tiny": 32000, "mistral-small": 32000, "mistral-medium": 32000, } def mistralai_modelname_to_contextsize(modelname: str) -> int: if modelname not in MISTRALAI_MODELS: raise ValueError( f"Unknown model: {modelname...
llama_index/llama-index-legacy/llama_index/legacy/llms/mistralai_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/mistralai_utils.py", "repo_id": "llama_index", "token_count": 209 }
1,735
python_sources()
llama_index/llama-index-integrations/indices/llama-index-indices-managed-google/llama_index/indices/managed/google/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-google/llama_index/indices/managed/google/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,270
<jupyter_start><jupyter_text>Training PEFT models with new tokens being added to the embedding layers and tokenizerIn this example, we will learn how to train a LoRA model when adding new tokens to the tokenizer and model. This is a common usecase when doing the following:1. Instruction finetuning with new tokens beind...
peft/examples/causal_language_modeling/peft_lora_clm_with_additional_tokens.ipynb/0
{ "file_path": "peft/examples/causal_language_modeling/peft_lora_clm_with_additional_tokens.ipynb", "repo_id": "peft", "token_count": 4571 }
297
// 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_span.cpp/0
{ "file_path": "milvus/internal/core/unittest/test_span.cpp", "repo_id": "milvus", "token_count": 1265 }
1,686
## Running Whisper Examples Here, we provide two examples of how to run Whisper using a Candle-compiled WASM binary and runtimes. ### Pure Rust UI To build and test the UI made in Rust you will need [Trunk](https://trunkrs.dev/#install) From the `candle-wasm-examples/whisper` directory run: Download assets: ```bas...
candle/candle-wasm-examples/whisper/README.md/0
{ "file_path": "candle/candle-wasm-examples/whisper/README.md", "repo_id": "candle", "token_count": 1023 }
79
// 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/datanode/compaction_executor.go/0
{ "file_path": "milvus/internal/datanode/compaction_executor.go", "repo_id": "milvus", "token_count": 2087 }
1,835
# Examples of using peft with trl to finetune 8-bit models with Low Rank Adaption (LoRA) The notebooks and scripts in this examples show how to use Low Rank Adaptation (LoRA) to fine-tune models in a memory efficient manner. Most of PEFT methods supported in peft library but note that some PEFT methods such as Prompt ...
trl/docs/source/lora_tuning_peft.mdx/0
{ "file_path": "trl/docs/source/lora_tuning_peft.mdx", "repo_id": "trl", "token_count": 2080 }
778
import { expect, test } from "@jest/globals"; import { ChromaClient } from "../src/ChromaClient"; import chroma from "./initClient"; test("it should create the client connection", async () => { expect(chroma).toBeDefined(); expect(chroma).toBeInstanceOf(ChromaClient); }); test("it should get the version", asy...
chroma/clients/js/test/client.test.ts/0
{ "file_path": "chroma/clients/js/test/client.test.ts", "repo_id": "chroma", "token_count": 2943 }
34
# coding=utf-8 # Copyright 2021 ASAPP Inc. 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...
transformers/src/transformers/models/sew/configuration_sew.py/0
{ "file_path": "transformers/src/transformers/models/sew/configuration_sew.py", "repo_id": "transformers", "token_count": 5652 }
741
from langchain_community.embeddings.cloudflare_workersai import ( CloudflareWorkersAIEmbeddings, ) __all__ = ["CloudflareWorkersAIEmbeddings"]
langchain/libs/langchain/langchain/embeddings/cloudflare_workersai.py/0
{ "file_path": "langchain/libs/langchain/langchain/embeddings/cloudflare_workersai.py", "repo_id": "langchain", "token_count": 54 }
544
<!--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 applicable law or agreed...
transformers/docs/source/zh/custom_models.md/0
{ "file_path": "transformers/docs/source/zh/custom_models.md", "repo_id": "transformers", "token_count": 7975 }
569
""" The EfficientNet Family in PyTorch An implementation of EfficienNet that covers variety of related models with efficient architectures: * EfficientNet-V2 - `EfficientNetV2: Smaller Models and Faster Training` - https://arxiv.org/abs/2104.00298 * EfficientNet (B0-B8, L2 + Tensorflow pretrained AutoAug/RandAug/A...
pytorch-image-models/timm/models/efficientnet.py/0
{ "file_path": "pytorch-image-models/timm/models/efficientnet.py", "repo_id": "pytorch-image-models", "token_count": 47473 }
353
python_sources()
llama_index/llama-index-cli/llama_index/cli/new_package/templates/BUILD/0
{ "file_path": "llama_index/llama-index-cli/llama_index/cli/new_package/templates/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,157
import { BasePromptTemplate } from "@langchain/core/prompts"; import { loadFromHub } from "../util/hub.js"; import { FileLoader, loadFromFile } from "../util/load.js"; import { parseFileConfig } from "../util/parse.js"; const loadPromptFromFile: FileLoader<BasePromptTemplate> = (text, path) => BasePromptTemplate.des...
langchainjs/langchain/src/prompts/load.ts/0
{ "file_path": "langchainjs/langchain/src/prompts/load.ts", "repo_id": "langchainjs", "token_count": 396 }
1,006
<!--- 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 applicable law or ...
transformers/docs/source/ko/pr_checks.md/0
{ "file_path": "transformers/docs/source/ko/pr_checks.md", "repo_id": "transformers", "token_count": 9042 }
497
# 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/stable_diffusion/pipeline_stable_unclip_img2img.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_stable_unclip_img2img.py", "repo_id": "diffusers", "token_count": 17509 }
244
# if true, only log to stdout --logtostdout=true --logtostderr=false --alsologtostderr=false # `INFO``, ``WARNING``, ``ERROR``, and ``FATAL`` are 0, 1, 2, and 3 --minloglevel=0 --log_dir=/var/lib/milvus/logs/ # using vlog to implement debug and trace log # if set vmodule to 5, open debug level # if set vmodule to 6, op...
milvus/configs/glog.conf/0
{ "file_path": "milvus/configs/glog.conf", "repo_id": "milvus", "token_count": 169 }
1,760
<jupyter_start><jupyter_text>Chat Engine with a Personality ✨ If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>!pip install llama-index<jupyter_output><empty_output><jupyter_text>Default<jupyter_code>from llama_index.core.chat_engine import SimpleChatEngine chat_e...
llama_index/docs/examples/chat_engine/chat_engine_personality.ipynb/0
{ "file_path": "llama_index/docs/examples/chat_engine/chat_engine_personality.ipynb", "repo_id": "llama_index", "token_count": 793 }
1,045
import { ScrollArea, Spoiler, Table, Text } from "@mantine/core"; import { Result } from "../../utils/types"; import renderPassFail from "../../utils/renderPassFail"; const ExperimentResultsTable = ({ results, isFastGradingPrompt, }: { results: any[]; isFastGradingPrompt: boolean; }) => { return ( <Scrol...
auto-evaluator/nextjs/components/tables/ExperimentResultTable.tsx/0
{ "file_path": "auto-evaluator/nextjs/components/tables/ExperimentResultTable.tsx", "repo_id": "auto-evaluator", "token_count": 1683 }
2
# Create an image dataset There are two methods for creating and sharing an image dataset. This guide will show you how to: * Create an image dataset with `ImageFolder` and some metadata. This is a no-code solution for quickly creating an image dataset with several thousand images. * Create an image dataset by writin...
datasets/docs/source/image_dataset.mdx/0
{ "file_path": "datasets/docs/source/image_dataset.mdx", "repo_id": "datasets", "token_count": 5724 }
121
from langchain_community.utilities.openapi import HTTPVerb, OpenAPISpec __all__ = ["HTTPVerb", "OpenAPISpec"]
langchain/libs/langchain/langchain/utilities/openapi.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/openapi.py", "repo_id": "langchain", "token_count": 38 }
576
# Async Website Loader This loader is an asynchronous web scraper that fetches the text from static websites by converting the HTML to text. ## Usage To use this loader, you need to pass in an array of URLs. ```python from llama_index.readers.web.async_web.base import AsyncWebPageReader # for jupyter notebooks unc...
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/async_web/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/async_web/README.md", "repo_id": "llama_index", "token_count": 363 }
1,465
import base64 from abc import ABC from datetime import datetime from typing import Callable, Dict, Iterator, List, Literal, Optional, Union import requests from langchain_core.documents import Document from langchain_core.pydantic_v1 import BaseModel, root_validator, validator from langchain_core.utils import get_from...
langchain/libs/community/langchain_community/document_loaders/github.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/github.py", "repo_id": "langchain", "token_count": 4446 }
251
# Documents and Nodes ##### FAQ 1. [What is the default `chunk_size` of a Node object?](#1-what-is-the-default-chunk_size-of-a-node-object) 2. [How to add information like name, url in a `Document` object?](#2-how-to-add-information-like-name-url-in-a-document-object) 3. [How to update existing document in an Index?]...
llama_index/docs/community/faq/documents_and_nodes.md/0
{ "file_path": "llama_index/docs/community/faq/documents_and_nodes.md", "repo_id": "llama_index", "token_count": 368 }
1,098
// 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/Util.h/0
{ "file_path": "milvus/internal/core/src/storage/Util.h", "repo_id": "milvus", "token_count": 2457 }
1,895
from langchain_community.utils.openai import is_openai_v1 __all__ = ["is_openai_v1"]
langchain/libs/langchain/langchain/utils/openai.py/0
{ "file_path": "langchain/libs/langchain/langchain/utils/openai.py", "repo_id": "langchain", "token_count": 34 }
601
from llama_index.readers.airtable.base import AirtableReader __all__ = ["AirtableReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-airtable/llama_index/readers/airtable/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airtable/llama_index/readers/airtable/__init__.py", "repo_id": "llama_index", "token_count": 31 }
1,261
from langchain_community.tools.edenai.ocr_identityparser import EdenAiParsingIDTool __all__ = ["EdenAiParsingIDTool"]
langchain/libs/langchain/langchain/tools/edenai/ocr_identityparser.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/edenai/ocr_identityparser.py", "repo_id": "langchain", "token_count": 43 }
573
# Routers ## Concept Routers are modules that take in a user query and a set of "choices" (defined by metadata), and returns one or more selected choices. They can be used on their own (as "selector modules"), or used as a query engine or retriever (e.g. on top of other query engines/retrievers). They are simple bu...
llama_index/docs/module_guides/querying/router/root.md/0
{ "file_path": "llama_index/docs/module_guides/querying/router/root.md", "repo_id": "llama_index", "token_count": 1879 }
1,231
{ "embedding_dict": {}, "text_id_to_ref_doc_id": {}, "metadata_dict": {} }
llama_index/llama-index-core/storage/image__vector_store.json/0
{ "file_path": "llama_index/llama-index-core/storage/image__vector_store.json", "repo_id": "llama_index", "token_count": 32 }
1,256
import os import argparse from tqdm import tqdm import chromadb from chromadb.utils import embedding_functions import google.generativeai as genai def main( documents_directory: str = "documents", collection_name: str = "documents_collection", persist_directory: str = ".", ) -> None: # Read all file...
chroma/examples/gemini/load_data.py/0
{ "file_path": "chroma/examples/gemini/load_data.py", "repo_id": "chroma", "token_count": 1369 }
41
from llama_index.core.vector_stores.types import VectorStore from llama_index.vector_stores.milvus import MilvusVectorStore def test_class(): names_of_base_classes = [b.__name__ for b in MilvusVectorStore.__mro__] assert VectorStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-milvus/tests/test_vector_stores_milvus.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-milvus/tests/test_vector_stores_milvus.py", "repo_id": "llama_index", "token_count": 95 }
1,563
from typing import List def _list_indices(database, include_indices=None, ignore_indices=None) -> List[str]: all_indices = [index["index"] for index in database.cat.indices(format="json")] if include_indices: all_indices = [i for i in all_indices if i in include_indices] if ignore_indices: ...
langchain/templates/elastic-query-generator/elastic_query_generator/elastic_index_info.py/0
{ "file_path": "langchain/templates/elastic-query-generator/elastic_query_generator/elastic_index_info.py", "repo_id": "langchain", "token_count": 603 }
647
import argparse import inspect import os from pathlib import Path import black INDENT = " " * 4 GENERATED_COMMENT = "# Generated content DO NOT EDIT\n" def do_indent(text: str, indent: str): return text.replace("\n", f"\n{indent}") def function(obj, indent, text_signature=None): if text_signature is None...
tokenizers/bindings/python/stub.py/0
{ "file_path": "tokenizers/bindings/python/stub.py", "repo_id": "tokenizers", "token_count": 2385 }
446
from argparse import Namespace, _SubParsersAction from .configuration import load_config, save_config def init_cli(args: Namespace) -> None: """Handle subcommand "init".""" config = load_config(args.directory) save_config(config, args.directory) def register_init_cli(subparsers: _SubParsersAction) -> N...
llama_index/experimental/cli/cli_init.py/0
{ "file_path": "llama_index/experimental/cli/cli_init.py", "repo_id": "llama_index", "token_count": 220 }
1,156
from elasticsearch import Elasticsearch from langchain.output_parsers.json import SimpleJsonOutputParser from langchain_community.chat_models import ChatOpenAI from langchain_core.pydantic_v1 import BaseModel from .elastic_index_info import get_indices_infos from .prompts import DSL_PROMPT # Setup Elasticsearch # Thi...
langchain/templates/elastic-query-generator/elastic_query_generator/chain.py/0
{ "file_path": "langchain/templates/elastic-query-generator/elastic_query_generator/chain.py", "repo_id": "langchain", "token_count": 521 }
662
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-huggingface-fs/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-huggingface-fs/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,314
// 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/datanode/compactor_test.go/0
{ "file_path": "milvus/internal/datanode/compactor_test.go", "repo_id": "milvus", "token_count": 16144 }
1,773
""" Bring-Your-Own-Blocks Network A flexible network w/ dataclass based config for stacking those NN blocks. This model is currently used to implement the following networks: GPU Efficient (ResNets) - gernet_l/m/s (original versions called genet, but this was already used (by SENet author)). Paper: `Neural Architect...
pytorch-image-models/timm/models/byobnet.py/0
{ "file_path": "pytorch-image-models/timm/models/byobnet.py", "repo_id": "pytorch-image-models", "token_count": 42793 }
351
<jupyter_start><jupyter_text>SageMaker Tracking>[Amazon SageMaker](https://aws.amazon.com/sagemaker/) is a fully managed service that is used to quickly and easily build, train and deploy machine learning (ML) models. >[Amazon SageMaker Experiments](https://docs.aws.amazon.com/sagemaker/latest/dg/experiments.html) is a...
langchain/docs/docs/integrations/callbacks/sagemaker_tracking.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/callbacks/sagemaker_tracking.ipynb", "repo_id": "langchain", "token_count": 2041 }
98
<jupyter_start><jupyter_text>Chroma Vector Store If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-vector-stores-chroma !pip install llama-index<jupyter_output><empty_output><jupyter_text>Creating a Chroma Index<jupyter_code>import logging i...
llama_index/docs/examples/vector_stores/chroma_metadata_filter.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/chroma_metadata_filter.ipynb", "repo_id": "llama_index", "token_count": 2001 }
1,094
import pytest @pytest.fixture(scope="module") def neox_handle(launcher): with launcher( "stabilityai/stablelm-tuned-alpha-3b", num_shard=1, use_flash_attention=False ) as handle: yield handle @pytest.fixture(scope="module") async def neox(neox_handle): await neox_handle.health(300) r...
text-generation-inference/integration-tests/models/test_neox.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_neox.py", "repo_id": "text-generation-inference", "token_count": 499 }
413
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/prompts/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/prompts/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,601
syntax = "proto3"; package milvus.proto.index; option go_package = "github.com/milvus-io/milvus/internal/proto/indexpb"; import "common.proto"; import "internal.proto"; import "milvus.proto"; import "schema.proto"; service IndexCoord { rpc GetComponentStates(milvus.GetComponentStatesRequest) returns (milvus.Compo...
milvus/internal/proto/index_coord.proto/0
{ "file_path": "milvus/internal/proto/index_coord.proto", "repo_id": "milvus", "token_count": 3266 }
1,809
// 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/querynodev2/cluster/worker.go/0
{ "file_path": "milvus/internal/querynodev2/cluster/worker.go", "repo_id": "milvus", "token_count": 2037 }
1,903
from llama_index.core.llms.base import BaseLLM from llama_index.llms.xinference import Xinference def test_embedding_class(): names_of_base_classes = [b.__name__ for b in Xinference.__mro__] assert BaseLLM.__name__ in names_of_base_classes
llama_index/llama-index-integrations/llms/llama-index-llms-xinference/tests/test_llms_xinference.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-xinference/tests/test_llms_xinference.py", "repo_id": "llama_index", "token_count": 92 }
1,251
<!--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/using-diffusers/kandinsky.md/0
{ "file_path": "diffusers/docs/source/en/using-diffusers/kandinsky.md", "repo_id": "diffusers", "token_count": 10810 }
188
import type { basename as BasenameT } from "node:path"; import type { readFile as ReadFileT, stat as StatT } from "node:fs/promises"; import yaml from "js-yaml"; import { Document } from "@langchain/core/documents"; import { getEnv } from "@langchain/core/utils/env"; import { DirectoryLoader, UnknownHandling } from "./...
langchainjs/langchain/src/document_loaders/fs/obsidian.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/fs/obsidian.ts", "repo_id": "langchainjs", "token_count": 2880 }
902
from typing import Any, Callable, Dict, List, Optional, Sequence, Set import numpy as np import numpy.typing as npt from chromadb.types import ( EmbeddingRecord, VectorEmbeddingRecord, VectorQuery, VectorQueryResult, ) from chromadb.utils import distance_functions import logging logger = logging.getLo...
chroma/chromadb/segment/impl/vector/brute_force_index.py/0
{ "file_path": "chroma/chromadb/segment/impl/vector/brute_force_index.py", "repo_id": "chroma", "token_count": 2782 }
18
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-papers/llama_index/readers/papers/pubmed/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-papers/llama_index/readers/papers/pubmed/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,533
locust_mix_performance: collections: - milvus: db_config.primary_path: /test/milvus/db_data_011/cluster/locust_mix suffix_path: true cache_config.insert_buffer_size: 2GB engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_...
milvus/tests/benchmark/milvus_benchmark/suites/cluster_locust_mix.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/cluster_locust_mix.yaml", "repo_id": "milvus", "token_count": 679 }
2,150
# 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/roformer/test_modeling_tf_roformer.py/0
{ "file_path": "transformers/tests/models/roformer/test_modeling_tf_roformer.py", "repo_id": "transformers", "token_count": 7807 }
838
"""Prompt for the router chain in the multi-retrieval qa chain.""" MULTI_RETRIEVAL_ROUTER_TEMPLATE = """\ Given a query to a question answering system select the system best suited \ for the input. You will be given the names of the available systems and a description \ of what questions the system is best suited for....
langchain/libs/langchain/langchain/chains/router/multi_retrieval_prompt.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/router/multi_retrieval_prompt.py", "repo_id": "langchain", "token_count": 297 }
469
import json import os from typing import Optional, Type from llama_index.core.download.integration import download_integration from llama_index.core.download.pack import ( LLAMA_PACKS_CONTENTS_URL, download_llama_pack_template, track_download, ) from llama_index.core.llama_pack.base import BaseLlamaPack ...
llama_index/llama-index-core/llama_index/core/llama_pack/download.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/llama_pack/download.py", "repo_id": "llama_index", "token_count": 1028 }
1,187
# Response Synthesis Modules Detailed inputs/outputs for each response synthesizer are found below. ## API Example The following shows the setup for utilizing all kwargs. - `response_mode` specifies which response synthesizer to use - `service_context` defines the LLM and related settings for synthesis - `text_qa_t...
llama_index/docs/module_guides/querying/response_synthesizers/response_synthesizers.md/0
{ "file_path": "llama_index/docs/module_guides/querying/response_synthesizers/response_synthesizers.md", "repo_id": "llama_index", "token_count": 766 }
1,148
from typing import List, Union import pytest from test_utils import MockEncoder import langchain_experimental.rl_chain.base as base encoded_keyword = "[encoded]" @pytest.mark.requires("vowpal_wabbit_next") def test_simple_context_str_no_emb() -> None: expected = [{"a_namespace": "test"}] assert base.embed(...
langchain/libs/experimental/tests/unit_tests/rl_chain/test_rl_chain_base_embedder.py/0
{ "file_path": "langchain/libs/experimental/tests/unit_tests/rl_chain/test_rl_chain_base_embedder.py", "repo_id": "langchain", "token_count": 6465 }
432
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export4.dtd"> <en-export export-date="20230611T011239Z" application="Evernote" version="10.56.9"> <note> <content> I only have content, no metadata </content> </note> </en-export>
langchain/libs/community/tests/unit_tests/document_loaders/sample_documents/sample_notebook_missingmetadata.enex/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/sample_documents/sample_notebook_missingmetadata.enex", "repo_id": "langchain", "token_count": 142 }
388
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 589, "logprob": null, "text": "def" }, { "id": 1459, "logprob": -5.6289062, "text": " print" }, { "id"...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder/test_flash_starcoder.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder/test_flash_starcoder.json", "repo_id": "text-generation-inference", "token_count": 1111 }
395
from langchain_community.chat_loaders.facebook_messenger import ( FolderFacebookMessengerChatLoader, SingleFileFacebookMessengerChatLoader, ) __all__ = ["SingleFileFacebookMessengerChatLoader", "FolderFacebookMessengerChatLoader"]
langchain/libs/langchain/langchain/chat_loaders/facebook_messenger.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_loaders/facebook_messenger.py", "repo_id": "langchain", "token_count": 66 }
492
python_sources()
llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-dynamodb/llama_index/storage/kvstore/dynamodb/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-dynamodb/llama_index/storage/kvstore/dynamodb/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,465
<jupyter_start><jupyter_text>SingleStoreDB>[SingleStoreDB](https://singlestore.com/) is a high-performance distributed SQL database that supports deployment both in the [cloud](https://www.singlestore.com/cloud/) and on-premises. It provides vector storage, and vector functions including [dot_product](https://docs.sing...
langchain/docs/docs/integrations/retrievers/singlestoredb.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/singlestoredb.ipynb", "repo_id": "langchain", "token_count": 683 }
159
<!--- Copyright 2021 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 ...
transformers/examples/pytorch/speech-recognition/README.md/0
{ "file_path": "transformers/examples/pytorch/speech-recognition/README.md", "repo_id": "transformers", "token_count": 14260 }
526
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-joplin/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-joplin/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,321
package writebuffer import ( "context" "testing" "time" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-...
milvus/internal/datanode/writebuffer/manager_test.go/0
{ "file_path": "milvus/internal/datanode/writebuffer/manager_test.go", "repo_id": "milvus", "token_count": 2816 }
1,711
"""Zapier Toolkit."""
langchain/libs/langchain/langchain/agents/agent_toolkits/zapier/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/zapier/__init__.py", "repo_id": "langchain", "token_count": 9 }
439
from __future__ import annotations from typing import Any, Dict, List, Literal, Optional from langchain_core.load import Serializable from langchain_core.utils._merge import merge_dicts class Generation(Serializable): """A single text generation output.""" text: str """Generated text output.""" ge...
langchain/libs/core/langchain_core/outputs/generation.py/0
{ "file_path": "langchain/libs/core/langchain_core/outputs/generation.py", "repo_id": "langchain", "token_count": 696 }
419
use std::collections::HashMap; use candle::quantized::QTensor; use candle::quantized::{ggml_file, gguf_file}; use candle::{DType, Device, IndexOp, Result, Tensor, D}; use candle_nn::{Embedding, Module}; pub const MAX_SEQ_LEN: usize = 4096; #[derive(Debug, Clone)] struct RmsNorm { inner: candle_nn::LayerNorm, ...
candle/candle-transformers/src/models/quantized_llama.rs/0
{ "file_path": "candle/candle-transformers/src/models/quantized_llama.rs", "repo_id": "candle", "token_count": 11687 }
67
<!--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/it/quicktour.md/0
{ "file_path": "transformers/docs/source/it/quicktour.md", "repo_id": "transformers", "token_count": 6490 }
487
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-mongodb/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-mongodb/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,526
insert_build_performance: collections: - milvus: db_config.primary_path: /test/milvus/db_data_011/sift_1m_128_128_l2_pq cache_config.cpu_cache_capacity: 32 engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: true ...
milvus/tests/benchmark/milvus_benchmark/suites/2_insert_build.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/2_insert_build.yaml", "repo_id": "milvus", "token_count": 345 }
1,948
# coding=utf-8 # Copyright 2023 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/models/xmod/convert_xmod_original_pytorch_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/xmod/convert_xmod_original_pytorch_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 4107 }
745
// 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/mmap/Utils.h/0
{ "file_path": "milvus/internal/core/src/mmap/Utils.h", "repo_id": "milvus", "token_count": 2434 }
1,731
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-apify/llama_index/readers/apify/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-apify/llama_index/readers/apify/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,403
import email import logging from typing import Dict, List, Union from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) class MHTMLLoader(BaseLoader): """Parse `MHTML` files with `BeautifulSoup`.""" def __init__( ...
langchain/libs/community/langchain_community/document_loaders/mhtml.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/mhtml.py", "repo_id": "langchain", "token_count": 1241 }
253
import fs from "fs/promises"; import { ensureAuthOptionScopes, GoogleAbstractedClient, GoogleAbstractedClientOps, } from "../auth.js"; import { JsonStream } from "../utils/stream.js"; import { GoogleAIBaseLLMInput } from "../types.js"; export function mockId(): string { return `mock-id-${Date.now()}`; } expor...
langchainjs/libs/langchain-google-common/src/tests/mock.ts/0
{ "file_path": "langchainjs/libs/langchain-google-common/src/tests/mock.ts", "repo_id": "langchainjs", "token_count": 1051 }
1,006
import pytest @pytest.fixture(scope="module") def bloom_560_handle(launcher): with launcher("bigscience/bloom-560m") as handle: yield handle @pytest.fixture(scope="module") async def bloom_560(bloom_560_handle): await bloom_560_handle.health(240) return bloom_560_handle.client @pytest.mark.asy...
text-generation-inference/integration-tests/models/test_bloom_560m.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_bloom_560m.py", "repo_id": "text-generation-inference", "token_count": 752 }
368
from llama_index.core.readers.base import BaseReader from llama_index.readers.file import ( DocxReader, EpubReader, FlatReader, HWPReader, ImageCaptionReader, ImageReader, ImageVisionLLMReader, IPYNBReader, MarkdownReader, MboxReader, PandasCSVReader, PDFReader, PptxR...
llama_index/llama-index-integrations/readers/llama-index-readers-file/tests/test_readers_file.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/tests/test_readers_file.py", "repo_id": "llama_index", "token_count": 901 }
1,496
# Susceptible to arbitrary code execution: https://github.com/langchain-ai/langchain/issues/4849 import importlib.util import json from pathlib import Path from typing import Union import yaml from langchain.prompts.loading import load_prompt_from_config, try_load_from_hub from langchain_core.prompts import BasePrompt...
langchain/libs/experimental/langchain_experimental/prompts/load.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/prompts/load.py", "repo_id": "langchain", "token_count": 771 }
423
<jupyter_start><jupyter_text>Guideline Evaluator This notebook shows how to use `GuidelineEvaluator` to evaluate a question answer system given user specified guidelines. If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-llms-openai !pip ins...
llama_index/docs/examples/evaluation/guideline_eval.ipynb/0
{ "file_path": "llama_index/docs/examples/evaluation/guideline_eval.ipynb", "repo_id": "llama_index", "token_count": 1036 }
1,061
python_sources()
llama_index/llama-index-packs/llama-index-packs-multi-tenancy-rag/llama_index/packs/multi_tenancy_rag/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-multi-tenancy-rag/llama_index/packs/multi_tenancy_rag/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,711
<!--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/model_doc/llama.md/0
{ "file_path": "transformers/docs/source/ko/model_doc/llama.md", "repo_id": "transformers", "token_count": 4406 }
558
# 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/mask2former/test_modeling_mask2former.py/0
{ "file_path": "transformers/tests/models/mask2former/test_modeling_mask2former.py", "repo_id": "transformers", "token_count": 7761 }
755
// Code generated by mockery v2.32.4. DO NOT EDIT. package writebuffer import ( context "context" metacache "github.com/milvus-io/milvus/internal/datanode/metacache" mock "github.com/stretchr/testify/mock" msgpb "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" msgstream "github.com/milvus-io/milvus/pkg/mq/...
milvus/internal/datanode/writebuffer/mock_mananger.go/0
{ "file_path": "milvus/internal/datanode/writebuffer/mock_mananger.go", "repo_id": "milvus", "token_count": 5556 }
1,705
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-hatena-blog/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hatena-blog/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,375
from typing import Any, Mapping, Optional from llama_index.readers.airbyte_cdk.base import AirbyteCDKReader, RecordHandler class AirbyteZendeskSupportReader(AirbyteCDKReader): """AirbyteZendeskSupportReader reader. Retrieve documents from ZendeskSupport Args: config: The config object for the z...
llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-zendesk-support/llama_index/readers/airbyte_zendesk_support/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-zendesk-support/llama_index/readers/airbyte_zendesk_support/base.py", "repo_id": "llama_index", "token_count": 305 }
1,373
# coding=utf-8 # Copyright 2023 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/llava/modeling_llava.py/0
{ "file_path": "transformers/src/transformers/models/llava/modeling_llava.py", "repo_id": "transformers", "token_count": 11976 }
706
// 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/indexnode/service.go/0
{ "file_path": "milvus/internal/distributed/indexnode/service.go", "repo_id": "milvus", "token_count": 3529 }
1,797
# Cost Analysis ## Concept Each call to an LLM will cost some amount of money - for instance, OpenAI's gpt-3.5-turbo costs $0.002 / 1k tokens. The cost of building an index and querying depends on - the type of LLM used - the type of data structure used - parameters used during building - parameters used during quer...
llama_index/docs/understanding/evaluating/cost_analysis/root.md/0
{ "file_path": "llama_index/docs/understanding/evaluating/cost_analysis/root.md", "repo_id": "llama_index", "token_count": 1049 }
1,129
import re from typing import Any, List from langchain.evaluation.schema import StringEvaluator class RegexMatchStringEvaluator(StringEvaluator): """Compute a regex match between the prediction and the reference. Examples ---------- >>> evaluator = RegexMatchStringEvaluator(flags=re.IGNORECASE) >...
langchain/libs/langchain/langchain/evaluation/regex_match/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/evaluation/regex_match/base.py", "repo_id": "langchain", "token_count": 1023 }
529
import os from langchain.retrievers.multi_query import MultiQueryRetriever from langchain_community.chat_models import ChatOpenAI from langchain_community.embeddings import OpenAIEmbeddings from langchain_community.vectorstores import Pinecone from langchain_core.output_parsers import StrOutputParser from langchain_co...
langchain/templates/rag-pinecone-multi-query/rag_pinecone_multi_query/chain.py/0
{ "file_path": "langchain/templates/rag-pinecone-multi-query/rag_pinecone_multi_query/chain.py", "repo_id": "langchain", "token_count": 716 }
725
<jupyter_start><jupyter_text>AutoGPT example finding Winning Marathon Times* Implementation of https://github.com/Significant-Gravitas/Auto-GPT * With LangChain primitives (LLMs, PromptTemplates, VectorStores, Embeddings, Tools)<jupyter_code># !pip install bs4 # !pip install nest_asyncio # General import asyncio import...
langchain/cookbook/autogpt/marathon_times.ipynb/0
{ "file_path": "langchain/cookbook/autogpt/marathon_times.ipynb", "repo_id": "langchain", "token_count": 3184 }
75
import { collections } from "$lib/server/database"; import { z } from "zod"; import { authCondition } from "$lib/server/auth"; import { DEFAULT_SETTINGS } from "$lib/types/Settings"; export async function POST({ request, locals }) { const body = await request.json(); const { ethicsModalAccepted, ...settings } = z ...
chat-ui/src/routes/settings/+server.ts/0
{ "file_path": "chat-ui/src/routes/settings/+server.ts", "repo_id": "chat-ui", "token_count": 401 }
115
from llama_index.core.indices.managed.base import BaseManagedIndex from llama_index.indices.managed.zilliz import ZillizCloudPipelineIndex def test_class(): names_of_base_classes = [b.__name__ for b in ZillizCloudPipelineIndex.__mro__] assert BaseManagedIndex.__name__ in names_of_base_classes
llama_index/llama-index-integrations/indices/llama-index-indices-managed-zilliz/tests/test_indices_managed_zilliz.py/0
{ "file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-zilliz/tests/test_indices_managed_zilliz.py", "repo_id": "llama_index", "token_count": 107 }
1,273
<jupyter_start><jupyter_text>Redis Docstore+Index Store DemoThis guide shows you how to directly use our `DocumentStore` abstraction and `IndexStore` abstraction backed by Redis. By putting nodes in the docstore, this allows you to define multiple indices over the same underlying docstore, instead of duplicating data a...
llama_index/docs/examples/docstore/RedisDocstoreIndexStoreDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/docstore/RedisDocstoreIndexStoreDemo.ipynb", "repo_id": "llama_index", "token_count": 1943 }
1,132
from langchain_community.callbacks.openai_info import OpenAICallbackHandler __all__ = ["OpenAICallbackHandler"]
langchain/libs/langchain/langchain/callbacks/openai_info.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/openai_info.py", "repo_id": "langchain", "token_count": 35 }
494
from llama_index.core.vector_stores.types import BasePydanticVectorStore from llama_index.vector_stores.astra.base import AstraDBVectorStore def test_class(): names_of_base_classes = [b.__name__ for b in AstraDBVectorStore.__mro__] assert BasePydanticVectorStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-astra/tests/test_vector_stores_astra.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-astra/tests/test_vector_stores_astra.py", "repo_id": "llama_index", "token_count": 104 }
1,511
// 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/pkg/util/ratelimitutil/rate_collector_test.go/0
{ "file_path": "milvus/pkg/util/ratelimitutil/rate_collector_test.go", "repo_id": "milvus", "token_count": 1627 }
1,841
<jupyter_start><jupyter_text>Knowledge Graph Construction w/ WikiData FilteringIn this notebook, we compare using [REBEL](https://huggingface.co/Babelscape/rebel-large) for knowledge graph construction with and without filtering from wikidata.This is a simplified version, find out more about using wikipedia for filteri...
llama_index/docs/examples/index_structs/knowledge_graph/knowledge_graph2.ipynb/0
{ "file_path": "llama_index/docs/examples/index_structs/knowledge_graph/knowledge_graph2.ipynb", "repo_id": "llama_index", "token_count": 2715 }
1,189
import pytest @pytest.fixture(scope="module") def mpt_sharded_handle(launcher): with launcher("mosaicml/mpt-7b", num_shard=2) as handle: yield handle @pytest.fixture(scope="module") async def mpt_sharded(mpt_sharded_handle): await mpt_sharded_handle.health(300) return mpt_sharded_handle.client ...
text-generation-inference/integration-tests/models/test_mpt.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_mpt.py", "repo_id": "text-generation-inference", "token_count": 525 }
431