text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
<jupyter_start><jupyter_text>If you're opening this Notebook on colab, you will probably need to install 🤗 Transformers and 🤗 Datasets. Uncomment the following cell and run it.<jupyter_code>#! pip install datasets transformers[sentencepiece] sacrebleu<jupyter_output><empty_output><jupyter_text>If you're opening this ...
notebooks/examples/translation.ipynb/0
{ "file_path": "notebooks/examples/translation.ipynb", "repo_id": "notebooks", "token_count": 5285 }
327
# coding=utf-8 # 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 requir...
transformers/tests/models/luke/test_tokenization_luke.py/0
{ "file_path": "transformers/tests/models/luke/test_tokenization_luke.py", "repo_id": "transformers", "token_count": 14108 }
823
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-guru/llama_index/readers/guru/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-guru/llama_index/readers/guru/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,412
<jupyter_start><jupyter_text>Human-in-the-loop Tool ValidationThis walkthrough demonstrates how to add human validation to any Tool. We'll do this using the `HumanApprovalCallbackhandler`.Let's suppose we need to make use of the `ShellTool`. Adding this tool to an automated flow poses obvious risks. Let's see how we co...
langchain/cookbook/human_approval.ipynb/0
{ "file_path": "langchain/cookbook/human_approval.ipynb", "repo_id": "langchain", "token_count": 844 }
76
// 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/metrics_info.go/0
{ "file_path": "milvus/internal/datacoord/metrics_info.go", "repo_id": "milvus", "token_count": 2756 }
1,829
--- YAML tags (full spec here: https://github.com/huggingface/hub-docs/blob/main/datasetcard.md?plain=1): - copy-paste the tags obtained with the online tagging app: https://huggingface.co/spaces/huggingface/datasets-tagging --- # Dataset Card Creation Guide ## Table of Contents - [Dataset Card Creation Guide](#datas...
datasets/templates/README_guide.md/0
{ "file_path": "datasets/templates/README_guide.md", "repo_id": "datasets", "token_count": 3254 }
143
# LangServe Playground 🦜️🔗
langserve/libs/langserve-playground/README.md/0
{ "file_path": "langserve/libs/langserve-playground/README.md", "repo_id": "langserve", "token_count": 14 }
1,133
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/tools/llama-index-tools-shopify/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-shopify/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,437
from typing import List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document import asana class AsanaReader(BaseReader): """Asana reader. Reads data from an Asana workspace. Args: asana_token (str): Asana token. """ def __init__(self, ...
llama_index/llama-index-integrations/readers/llama-index-readers-asana/llama_index/readers/asana/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-asana/llama_index/readers/asana/base.py", "repo_id": "llama_index", "token_count": 2008 }
1,321
#[cfg(feature = "accelerate")] extern crate accelerate_src; #[cfg(feature = "mkl")] extern crate intel_mkl_src; use candle_transformers::models::stable_diffusion; use anyhow::{Error as E, Result}; use candle::{DType, Device, IndexOp, Module, Tensor, D}; use clap::Parser; use tokenizers::Tokenizer; #[derive(Parser)]...
candle/candle-examples/examples/stable-diffusion/main.rs/0
{ "file_path": "candle/candle-examples/examples/stable-diffusion/main.rs", "repo_id": "candle", "token_count": 9476 }
50
# rewrite_retrieve_read This template implemenets a method for query transformation (re-writing) in the paper [Query Rewriting for Retrieval-Augmented Large Language Models](https://arxiv.org/pdf/2305.14283.pdf) to optimize for RAG. ## Environment Setup Set the `OPENAI_API_KEY` environment variable to access the O...
langchain/templates/rewrite-retrieve-read/README.md/0
{ "file_path": "langchain/templates/rewrite-retrieve-read/README.md", "repo_id": "langchain", "token_count": 644 }
687
// 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/tsafe/tsafe.go/0
{ "file_path": "milvus/internal/querynodev2/tsafe/tsafe.go", "repo_id": "milvus", "token_count": 433 }
1,780
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-timescalevector/llama_index/vector_stores/timescalevector/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-timescalevector/llama_index/vector_stores/timescalevector/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,538
<!--- 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/examples/pytorch/multiple-choice/README.md/0
{ "file_path": "transformers/examples/pytorch/multiple-choice/README.md", "repo_id": "transformers", "token_count": 1161 }
587
<!--- Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/docs/source/ja/installation.md/0
{ "file_path": "transformers/docs/source/ja/installation.md", "repo_id": "transformers", "token_count": 4798 }
514
"""Utils for keyword table.""" import re from typing import Optional, Set import pandas as pd from llama_index.legacy.indices.utils import expand_tokens_with_subtokens from llama_index.legacy.utils import globals_helper def simple_extract_keywords( text_chunk: str, max_keywords: Optional[int] = None, filter_st...
llama_index/llama-index-legacy/llama_index/legacy/indices/keyword_table/utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/keyword_table/utils.py", "repo_id": "llama_index", "token_count": 936 }
1,599
import { insecureHash } from "@langchain/core/utils/hash"; import { type EmbeddingsInterface, Embeddings, } from "@langchain/core/embeddings"; import { BaseStore } from "@langchain/core/stores"; import { AsyncCallerParams } from "@langchain/core/utils/async_caller"; import { EncoderBackedStore } from "../storage/e...
langchainjs/langchain/src/embeddings/cache_backed.ts/0
{ "file_path": "langchainjs/langchain/src/embeddings/cache_backed.ts", "repo_id": "langchainjs", "token_count": 1814 }
887
# Supporting Modules We have two configuration modules that can be configured separately and passed to individual indexes, or set globally. - The [Settings](settings.md) includes the LLM you're using, the embedding model, your node parser, your callback manager and more. - The `StorageContext` lets you specify where ...
llama_index/docs/module_guides/supporting_modules/supporting_modules.md/0
{ "file_path": "llama_index/docs/module_guides/supporting_modules/supporting_modules.md", "repo_id": "llama_index", "token_count": 143 }
1,100
<!--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/ko/custom_models.md/0
{ "file_path": "transformers/docs/source/ko/custom_models.md", "repo_id": "transformers", "token_count": 10729 }
501
import os from contextlib import contextmanager from typing import Generator from unittest.mock import Mock import pytest from ai21 import AI21Client from ai21.models import ( ChatOutput, ChatResponse, Completion, CompletionData, CompletionFinishReason, CompletionsResponse, FinishReason, ...
langchain/libs/partners/ai21/tests/unit_tests/conftest.py/0
{ "file_path": "langchain/libs/partners/ai21/tests/unit_tests/conftest.py", "repo_id": "langchain", "token_count": 956 }
659
<jupyter_start><jupyter_text>Volc EngineThis notebook provides you with a guide on how to load the Volcano Embedding class. API InitializationTo use the LLM services based on [VolcEngine](https://www.volcengine.com/docs/82379/1099455), you have to initialize these parameters:You could either choose to init the AK,SK in...
langchain/docs/docs/integrations/text_embedding/volcengine.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/volcengine.ipynb", "repo_id": "langchain", "token_count": 386 }
176
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base"; import { BaseRetriever, type BaseRetrieverInput, type BaseRetrieverInterface, } from "@langchain/core/retrievers"; import { Document } from "@langchain/core/documents"; import { BaseOutputParser } from "@langchain/core/output_...
langchainjs/langchain/src/retrievers/multi_query.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/multi_query.ts", "repo_id": "langchainjs", "token_count": 1807 }
916
import pickle import numpy as np import pytest from tokenizers import AddedToken, Encoding, Tokenizer from tokenizers.implementations import BertWordPieceTokenizer from tokenizers.models import BPE, Model, WordPiece, Unigram from tokenizers.normalizers import Lowercase from tokenizers.pre_tokenizers import ByteLevel ...
tokenizers/bindings/python/tests/bindings/test_tokenizer.py/0
{ "file_path": "tokenizers/bindings/python/tests/bindings/test_tokenizer.py", "repo_id": "tokenizers", "token_count": 8984 }
408
#![allow(dead_code)] use crate::op::{BinaryOpT, CmpOp, ReduceOp, UnaryOpT}; use crate::{CpuStorage, DType, Error, Layout, Result, Shape}; #[derive(Debug, Clone)] pub struct CudaDevice; #[derive(Debug)] pub struct CudaStorage; macro_rules! fail { () => { unimplemented!("cuda support has not been enabled, ...
candle/candle-core/src/dummy_cuda_backend.rs/0
{ "file_path": "candle/candle-core/src/dummy_cuda_backend.rs", "repo_id": "candle", "token_count": 2634 }
30
import logging from typing import Any, List import requests from llama_index.core.base.embeddings.base import BaseEmbedding from requests.adapters import HTTPAdapter, Retry logger = logging.getLogger(__name__) class LLMRailsEmbedding(BaseEmbedding): """LLMRails embedding models. This class provides an inte...
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-llm-rails/llama_index/embeddings/llm_rails/base.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-llm-rails/llama_index/embeddings/llm_rails/base.py", "repo_id": "llama_index", "token_count": 1678 }
1,280
from __future__ import annotations from concurrent.futures import Executor from typing import Any, ClassVar, Dict, Iterator, List, Optional, Union import vertexai # type: ignore[import-untyped] from google.api_core.client_options import ClientOptions from google.cloud.aiplatform.gapic import ( PredictionServiceA...
langchain/libs/partners/google-vertexai/langchain_google_vertexai/llms.py/0
{ "file_path": "langchain/libs/partners/google-vertexai/langchain_google_vertexai/llms.py", "repo_id": "langchain", "token_count": 9066 }
629
from llama_index.readers.snscrape_twitter.base import SnscrapeTwitterReader __all__ = ["SnscrapeTwitterReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-snscrape-twitter/llama_index/readers/snscrape_twitter/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-snscrape-twitter/llama_index/readers/snscrape_twitter/__init__.py", "repo_id": "llama_index", "token_count": 36 }
1,421
import csv import os import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.csv import CsvDatasetReader, CsvDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def _check_csv_dataset(dataset, expected_features): ass...
datasets/tests/io/test_csv.py/0
{ "file_path": "datasets/tests/io/test_csv.py", "repo_id": "datasets", "token_count": 2815 }
140
python_sources()
llama_index/llama-index-packs/llama-index-packs-fusion-retriever/llama_index/packs/fusion_retriever/query_rewrite/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-fusion-retriever/llama_index/packs/fusion_retriever/query_rewrite/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,702
"""Chain of table. All prompts adapted from original paper by Wang et al.: https://arxiv.org/pdf/2401.04398v1.pdf """ import re from abc import abstractmethod from typing import Any, Callable, Dict, List, Optional, Tuple import pandas as pd from llama_index.core.base.query_pipeline.query import QueryComponent from ...
llama_index/llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/chain_of_table/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/chain_of_table/base.py", "repo_id": "llama_index", "token_count": 10091 }
1,689
<jupyter_start><jupyter_text>Evaluating Multi-Modal RAGIn this notebook guide, we'll demonstrate how to evaluate a Multi-Modal RAG system. As in the text-only case, we will consider the evaluation of Retrievers and Generators separately. As we alluded in our [blog](https://fix-me.link) on the topic of Evaluating Multi-...
llama_index/docs/examples/evaluation/multi_modal/multi_modal_rag_evaluation.ipynb/0
{ "file_path": "llama_index/docs/examples/evaluation/multi_modal/multi_modal_rag_evaluation.ipynb", "repo_id": "llama_index", "token_count": 10057 }
1,137
import { test, expect } from "@jest/globals"; import { YandexGPTEmbeddings } from "../embeddings.js"; test("Test YandexGPTEmbeddings.embedQuery", async () => { const embeddings = new YandexGPTEmbeddings({ maxRetries: 1, }); const res = await embeddings.embedQuery("Hello world"); expect(typeof res[0]).toBe(...
langchainjs/libs/langchain-yandex/src/tests/embeddings.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-yandex/src/tests/embeddings.int.test.ts", "repo_id": "langchainjs", "token_count": 240 }
1,014
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ /** * Any CSS included here will be global. The classic template * bundles Infima by default. Infima is a CSS fr...
langchainjs/docs/core_docs/src/css/custom.css/0
{ "file_path": "langchainjs/docs/core_docs/src/css/custom.css", "repo_id": "langchainjs", "token_count": 2347 }
802
# 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/data/data_collator.py/0
{ "file_path": "transformers/src/transformers/data/data_collator.py", "repo_id": "transformers", "token_count": 32221 }
551
package console type ErrorCode = int const ( NormalCode ErrorCode = 0 FailWithBackupUnfinished ErrorCode = 1 FailButBackupFinished ErrorCode = 2 Unexpected ErrorCode = 100 )
milvus/cmd/tools/migration/console/code.go/0
{ "file_path": "milvus/cmd/tools/migration/console/code.go", "repo_id": "milvus", "token_count": 87 }
1,618
"""Init file."""
llama_index/llama-index-legacy/tests/indices/keyword_table/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/keyword_table/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,734
import uuid from collections import defaultdict from typing import Any, Dict, List, Optional from unittest.mock import Mock class MockMongoCollection: def __init__(self) -> None: self._data: Dict[str, dict] = {} def find_one(self, filter: dict) -> Optional[dict]: for data in self._data.values...
llama_index/llama-index-legacy/tests/storage/kvstore/mock_mongodb.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/storage/kvstore/mock_mongodb.py", "repo_id": "llama_index", "token_count": 1282 }
1,568
# DenseNet **DenseNet** is a type of convolutional neural network that utilises dense connections between layers, through [Dense Blocks](http://www.paperswithcode.com/method/dense-block), where we connect *all layers* (with matching feature-map sizes) directly with each other. To preserve the feed-forward nature, each...
pytorch-image-models/hfdocs/source/models/densenet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/densenet.mdx", "repo_id": "pytorch-image-models", "token_count": 4188 }
376
# coding=utf-8 # Copyright 2023 Authors of "A Watermark for Large Language Models" # available at https://arxiv.org/abs/2301.10226 # # 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...
text-generation-inference/server/text_generation_server/utils/watermark.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/watermark.py", "repo_id": "text-generation-inference", "token_count": 1489 }
447
""" Test of Astra DB document loader class `AstraDBLoader` Required to run this test: - a recent `astrapy` Python package available - an Astra DB instance; - the two environment variables set: export ASTRA_DB_API_ENDPOINT="https://<DB-ID>-us-east1.apps.astra.datastax.com" export ASTRA_DB_AP...
langchain/libs/community/tests/integration_tests/document_loaders/test_astradb.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_astradb.py", "repo_id": "langchain", "token_count": 2817 }
339
# ResNeSt A **ResNeSt** is a variant on a [ResNet](https://paperswithcode.com/method/resnet), which instead stacks [Split-Attention blocks](https://paperswithcode.com/method/split-attention). The cardinal group representations are then concatenated along the channel dimension: $V = \text{Concat}${$V^{1},V^{2},\cdots{V...
pytorch-image-models/docs/models/.templates/models/resnest.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/resnest.md", "repo_id": "pytorch-image-models", "token_count": 4643 }
318
import argparse import safetensors.torch from diffusers import AutoencoderTiny """ Example - From the diffusers root directory: Download the weights: ```sh $ wget -q https://huggingface.co/madebyollin/taesd/resolve/main/taesd_encoder.safetensors $ wget -q https://huggingface.co/madebyollin/taesd/resolve/main/taesd...
diffusers/scripts/convert_tiny_autoencoder_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_tiny_autoencoder_to_diffusers.py", "repo_id": "diffusers", "token_count": 990 }
229
from __future__ import annotations import json import logging from typing import Any, List, Optional, Tuple from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.vectorstores import VectorStore logger = logging.getLogger(__name__) class Jaguar(VectorStor...
langchain/libs/community/langchain_community/vectorstores/jaguar.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/jaguar.py", "repo_id": "langchain", "token_count": 7505 }
309
import argparse import logging import os import sys import time import tensorflow as tf from datasets import load_dataset from tqdm import tqdm from transformers import AutoTokenizer, TFAutoModelForSequenceClassification from transformers.modeling_tf_utils import keras from transformers.utils import is_sagemaker_dp_e...
transformers/tests/sagemaker/scripts/tensorflow/run_tf_dist.py/0
{ "file_path": "transformers/tests/sagemaker/scripts/tensorflow/run_tf_dist.py", "repo_id": "transformers", "token_count": 3191 }
835
"""Load question answering chains.""" from typing import Any, Mapping, Optional, Protocol from langchain_core.callbacks import BaseCallbackManager, Callbacks from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import BasePromptTemplate from langchain.chains import ReduceDocumentsC...
langchain/libs/langchain/langchain/chains/question_answering/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/question_answering/__init__.py", "repo_id": "langchain", "token_count": 3530 }
473
# coding=utf-8 # Copyright 2021 Facebook AI Research (FAIR), Ross Wightman, 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....
transformers/src/transformers/models/deit/modeling_deit.py/0
{ "file_path": "transformers/src/transformers/models/deit/modeling_deit.py", "repo_id": "transformers", "token_count": 15850 }
656
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-kibela/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-kibela/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,468
//! EfficientNet implementation. //! //! https://arxiv.org/abs/1905.11946 #[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use candle::{DType, IndexOp, D}; use candle_nn::{Module, VarBuilder}; use candle_transformers::models::efficientnet::{EfficientNet,...
candle/candle-examples/examples/efficientnet/main.rs/0
{ "file_path": "candle/candle-examples/examples/efficientnet/main.rs", "repo_id": "candle", "token_count": 1414 }
41
python_sources()
llama_index/llama-index-integrations/agent/llama-index-agent-openai/llama_index/agent/openai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/agent/llama-index-agent-openai/llama_index/agent/openai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,178
# LlamaIndex Embeddings Integration: Huggingface
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/README.md/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/README.md", "repo_id": "llama_index", "token_count": 13 }
1,244
import { GoogleGenerativeAI, GenerativeModel } from "@google/generative-ai"; import type { TaskType, EmbedContentRequest } from "@google/generative-ai"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { Embeddings, EmbeddingsParams } from "@langchain/core/embeddings"; import { chunkArray } fr...
langchainjs/libs/langchain-google-genai/src/embeddings.ts/0
{ "file_path": "langchainjs/libs/langchain-google-genai/src/embeddings.ts", "repo_id": "langchainjs", "token_count": 1813 }
1,061
import logging from .constants import * _logger = logging.getLogger(__name__) def resolve_data_config( args=None, pretrained_cfg=None, model=None, use_test_size=False, verbose=False ): assert model or args or pretrained_cfg, "At least one of model, args, or pretrained_cfg...
pytorch-image-models/timm/data/config.py/0
{ "file_path": "pytorch-image-models/timm/data/config.py", "repo_id": "pytorch-image-models", "token_count": 1927 }
326
<jupyter_start><jupyter_code>import chromadb from chromadb.utils import embedding_functions sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(model_name="all-MiniLM-L6-v2") client = chromadb.Client() # client.heartbeat() # client.reset() collection = client.get_or_create_collection(...
chroma/examples/basic_functionality/in_not_in_filtering.ipynb/0
{ "file_path": "chroma/examples/basic_functionality/in_not_in_filtering.ipynb", "repo_id": "chroma", "token_count": 553 }
36
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/util/wrappers/qn_wrapper_test.go/0
{ "file_path": "milvus/internal/util/wrappers/qn_wrapper_test.go", "repo_id": "milvus", "token_count": 3648 }
1,888
# coding=utf-8 # Copyright 2020 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/tokenization_utils_base.py/0
{ "file_path": "transformers/src/transformers/tokenization_utils_base.py", "repo_id": "transformers", "token_count": 84984 }
782
# flake8: noqa ENDPOINT_DESCRIPTION = "Solve math word problems" ENDPOINT_NAME = "math-problems" INPUT_NAME = "input" OUTPUT_KEY = "output" NAME_FOR_MODEL = "MathWordProblems" NAME_FOR_HUMAN = "Math Problems Solver" DESCRIPTION_FOR_MODEL = "This plugin provides access to a LangChain Agent hooked up to a calculator, so ...
langchain-aiplugin/agent/constants.py/0
{ "file_path": "langchain-aiplugin/agent/constants.py", "repo_id": "langchain-aiplugin", "token_count": 140 }
60
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-cassandra/llama_index/vector_stores/cassandra/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-cassandra/llama_index/vector_stores/cassandra/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,512
import { GoogleAuthOptions } from "google-auth-library"; import { BaseChatGoogleVertexAI, GoogleVertexAIChatInput } from "./common.js"; import { GoogleVertexAILLMConnection } from "../../utils/googlevertexai-connection.js"; import { GAuthClient } from "../../utils/googlevertexai-gauth.js"; /** * Enables calls to the ...
langchainjs/libs/langchain-community/src/chat_models/googlevertexai/index.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/chat_models/googlevertexai/index.ts", "repo_id": "langchainjs", "token_count": 640 }
992
<jupyter_start><jupyter_text>ModelScope>[ModelScope](https://www.modelscope.cn/home) is big repository of the models and datasets.Let's load the ModelScope Embedding class.<jupyter_code>from langchain_community.embeddings import ModelScopeEmbeddings model_id = "damo/nlp_corom_sentence-embedding_english-base" embeddings...
langchain/docs/docs/integrations/text_embedding/modelscope_hub.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/modelscope_hub.ipynb", "repo_id": "langchain", "token_count": 173 }
177
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use std::str::FromStr; use anyhow::Result; use candle_core::{Device, Tensor}; fn cos_sin(n: usize, device: &Device) -> Result<Tensor> { let thetas: Vec<_> = (0..n).map(|i| (i as f32 / n as f32)).colle...
candle/candle-core/examples/cuda_sum_benchmark.rs/0
{ "file_path": "candle/candle-core/examples/cuda_sum_benchmark.rs", "repo_id": "candle", "token_count": 827 }
33
from langchain.utilities import DuckDuckGoSearchAPIWrapper from langchain_community.chat_models import ChatOpenAI from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langchain_core.pydantic_v1 import BaseModel from langchain_core.runnables import Runnable...
langchain/templates/rewrite-retrieve-read/rewrite_retrieve_read/chain.py/0
{ "file_path": "langchain/templates/rewrite-retrieve-read/rewrite_retrieve_read/chain.py", "repo_id": "langchain", "token_count": 441 }
730
"""Tracers that record execution of LangChain runs.""" from langchain_core.tracers.langchain import LangChainTracer from langchain_core.tracers.langchain_v1 import LangChainTracerV1 from langchain_core.tracers.stdout import ( ConsoleCallbackHandler, FunctionCallbackHandler, ) from langchain_community.callback...
langchain/libs/community/langchain_community/callbacks/tracers/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/callbacks/tracers/__init__.py", "repo_id": "langchain", "token_count": 169 }
237
"""Util that calls WolframAlpha.""" from typing import Any, Dict, Optional from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator from langchain_core.utils import get_from_dict_or_env class WolframAlphaAPIWrapper(BaseModel): """Wrapper for Wolfram Alpha. Docs for using: 1. Go to wolfra...
langchain/libs/community/langchain_community/utilities/wolfram_alpha.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/wolfram_alpha.py", "repo_id": "langchain", "token_count": 818 }
304
import fs from "fs"; export async function isWriteable(directory: string): Promise<boolean> { try { await fs.promises.access(directory, (fs.constants || fs).W_OK); return true; } catch (err) { return false; } }
langchainjs/libs/create-langchain-integration/helpers/is-writeable.ts/0
{ "file_path": "langchainjs/libs/create-langchain-integration/helpers/is-writeable.ts", "repo_id": "langchainjs", "token_count": 83 }
954
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/tests/integration/minicluster_v2.go/0
{ "file_path": "milvus/tests/integration/minicluster_v2.go", "repo_id": "milvus", "token_count": 3934 }
1,959
<!--⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer. --> # Traduction en cours.
transformers/docs/source/fr/in_translation.md/0
{ "file_path": "transformers/docs/source/fr/in_translation.md", "repo_id": "transformers", "token_count": 54 }
517
package memberlist_manager import ( "errors" "sync" "time" "github.com/chroma/chroma-coordinator/internal/common" "github.com/pingcap/log" "go.uber.org/zap" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/informers" "k8s.io/client-go/...
chroma/go/coordinator/internal/memberlist_manager/node_watcher.go/0
{ "file_path": "chroma/go/coordinator/internal/memberlist_manager/node_watcher.go", "repo_id": "chroma", "token_count": 1861 }
44
import { ChatOpenAI } from "@langchain/openai"; import { HumanMessage } from "@langchain/core/messages"; // See https://cookbook.openai.com/examples/using_logprobs for details const model = new ChatOpenAI({ logprobs: true, // topLogprobs: 5, }); const generations = await model.generate([[new HumanMessage("Hi ther...
langchainjs/examples/src/models/chat/integration_openai_generation_info.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/integration_openai_generation_info.ts", "repo_id": "langchainjs", "token_count": 1321 }
868
// Code generated by mockery v2.32.4. DO NOT EDIT. package session import ( context "context" commonpb "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" milvuspb "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" mock "github.com/stretchr/testify/mock" querypb "github.com/milvus-io/milvus/internal/p...
milvus/internal/querycoordv2/session/mock_cluster.go/0
{ "file_path": "milvus/internal/querycoordv2/session/mock_cluster.go", "repo_id": "milvus", "token_count": 9052 }
1,982
"""ArangoDB client.""" from typing import Any, Dict, Iterator, List, Optional, Union, cast from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class SimpleArangoDBReader(BaseReader): """Simple arangodb reader. Concatenates each ArangoDB doc into Document used by...
llama_index/llama-index-integrations/readers/llama-index-readers-arango-db/llama_index/readers/arango_db/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-arango-db/llama_index/readers/arango_db/base.py", "repo_id": "llama_index", "token_count": 2506 }
1,290
<jupyter_start><jupyter_text>Program-aided language model (PAL) chainImplements Program-Aided Language Models, as in https://arxiv.org/pdf/2211.10435.pdf.<jupyter_code>from langchain_experimental.pal_chain import PALChain from langchain_openai import OpenAI llm = OpenAI(temperature=0, max_tokens=512)<jupyter_output><em...
langchain/cookbook/program_aided_language_model.ipynb/0
{ "file_path": "langchain/cookbook/program_aided_language_model.ipynb", "repo_id": "langchain", "token_count": 825 }
79
import getpass import os from langchain.text_splitter import CharacterTextSplitter from langchain_community.document_loaders import PyPDFLoader from langchain_community.vectorstores import Milvus from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langch...
langchain/templates/nvidia-rag-canonical/nvidia_rag_canonical/chain.py/0
{ "file_path": "langchain/templates/nvidia-rag-canonical/nvidia_rag_canonical/chain.py", "repo_id": "langchain", "token_count": 983 }
702
from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class CustomTokenizerFast(BertTokenizerFast): slow_tokenizer_class = CustomTokenizer pass
transformers/utils/test_module/custom_tokenization_fast.py/0
{ "file_path": "transformers/utils/test_module/custom_tokenization_fast.py", "repo_id": "transformers", "token_count": 54 }
779
[build-system] requires = [ "setuptools>=57.4.0", "wheel>=0.37.0", "transformers>=4.9.2" ] build-backend = "setuptools.build_meta"
transformers/examples/research_projects/fsner/pyproject.toml/0
{ "file_path": "transformers/examples/research_projects/fsner/pyproject.toml", "repo_id": "transformers", "token_count": 71 }
542
# coding=utf-8 # 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 requir...
transformers/tests/models/auto/test_modeling_tf_pytorch.py/0
{ "file_path": "transformers/tests/models/auto/test_modeling_tf_pytorch.py", "repo_id": "transformers", "token_count": 4447 }
767
"""Test AI21 llm""" from typing import cast from langchain_core.pydantic_v1 import SecretStr from pytest import CaptureFixture, MonkeyPatch from langchain_community.llms.ai21 import AI21 def test_api_key_is_secret_string() -> None: llm = AI21(ai21_api_key="secret-api-key") assert isinstance(llm.ai21_api_ke...
langchain/libs/community/tests/unit_tests/llms/test_ai21.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/llms/test_ai21.py", "repo_id": "langchain", "token_count": 496 }
376
from unittest.mock import MagicMock, patch from llama_index.core.graph_stores.types import GraphStore from llama_index.graph_stores.nebula import NebulaGraphStore @patch("llama_index.graph_stores.nebula.NebulaGraphStore") def test_kuzu_graph_store(MockNebulaGraphStore: MagicMock): instance: NebulaGraphStore = Mo...
llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-nebula/tests/test_graph_stores_nebula.py/0
{ "file_path": "llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-nebula/tests/test_graph_stores_nebula.py", "repo_id": "llama_index", "token_count": 132 }
1,207
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/extractors/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/extractors/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,592
# coding=utf-8 # 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 requir...
transformers/tests/models/gptj/test_modeling_tf_gptj.py/0
{ "file_path": "transformers/tests/models/gptj/test_modeling_tf_gptj.py", "repo_id": "transformers", "token_count": 8856 }
749
"""Test agent functionality."""
langchain/libs/langchain/tests/unit_tests/agents/__init__.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/agents/__init__.py", "repo_id": "langchain", "token_count": 7 }
628
from langchain_community.utilities.dataforseo_api_search import DataForSeoAPIWrapper __all__ = ["DataForSeoAPIWrapper"]
langchain/libs/langchain/langchain/utilities/dataforseo_api_search.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/dataforseo_api_search.py", "repo_id": "langchain", "token_count": 41 }
616
# 🦜️🧑‍🤝‍🧑 LangChain Community [![Downloads](https://static.pepy.tech/badge/langchain_community/month)](https://pepy.tech/project/langchain_community) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ## Quick Install ```bash pip install langchain-communit...
langchain/libs/community/README.md/0
{ "file_path": "langchain/libs/community/README.md", "repo_id": "langchain", "token_count": 371 }
217
# Lilac reader [Lilac](https://lilacml.com/) is an open-source product that helps you analyze, enrich, and clean unstructured data with AI. It can be used to analyze, clean, structure, and label data that can be used in downstream LlamaIndex and LangChain applications. ## Lilac projects This assumes you've already ...
llama_index/llama-index-integrations/readers/llama-index-readers-lilac/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-lilac/README.md", "repo_id": "llama_index", "token_count": 765 }
1,514
cff-version: 1.2.0 message: "If you use this software, please cite it as below." title: "huggingface/datasets" authors: - family-names: Lhoest given-names: Quentin - family-names: Villanova del Moral given-names: Albert orcid: "https://orcid.org/0000-0003-1727-1045" - family-names: von Platen given-names: Patri...
datasets/CITATION.cff/0
{ "file_path": "datasets/CITATION.cff", "repo_id": "datasets", "token_count": 1428 }
116
from abc import abstractmethod from typing import Any, Dict, List, Optional, Sequence, get_args from llama_index.legacy.bridge.pydantic import BaseModel, Field from llama_index.legacy.constants import ( DEFAULT_CONTEXT_WINDOW, DEFAULT_NUM_INPUT_FILES, DEFAULT_NUM_OUTPUTS, ) from llama_index.legacy.core.llm...
llama_index/llama-index-legacy/llama_index/legacy/multi_modal_llms/base.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/multi_modal_llms/base.py", "repo_id": "llama_index", "token_count": 3146 }
1,582
<!--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_doc/owlvit.md/0
{ "file_path": "transformers/docs/source/en/model_doc/owlvit.md", "repo_id": "transformers", "token_count": 1986 }
450
# Testing the notion markdownloader # 🦜️🔗 LangChain.js ⚡ Building applications with LLMs through composability ⚡ **Production Support:** As you move your LangChains into production, we'd love to offer more comprehensive support. Please fill out [this form](https://forms.gle/57d8AmXBYp8PP8tZA) and we'll set up a de...
langchainjs/examples/src/document_loaders/example_data/notion.md/0
{ "file_path": "langchainjs/examples/src/document_loaders/example_data/notion.md", "repo_id": "langchainjs", "token_count": 471 }
827
# 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/donut/image_processing_donut.py/0
{ "file_path": "transformers/src/transformers/models/donut/image_processing_donut.py", "repo_id": "transformers", "token_count": 9138 }
597
from langchain_core.prompts import PromptTemplate REFINE_PROMPT_TMPL = """\ Your job is to produce a final summary. We have provided an existing summary up to a certain point: {existing_answer} We have the opportunity to refine the existing summary (only if needed) with some more context below. ------------ {text} ---...
langchain/libs/langchain/langchain/chains/summarize/refine_prompts.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/summarize/refine_prompts.py", "repo_id": "langchain", "token_count": 192 }
467
"""JSON Reader.""" import json import re from typing import Any, Generator, List, Optional from llama_index.legacy.readers.base import BaseReader from llama_index.legacy.schema import Document def _depth_first_yield( json_data: Any, levels_back: int, collapse_length: Optional[int], path: List[str], ...
llama_index/llama-index-legacy/llama_index/legacy/readers/json.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/json.py", "repo_id": "llama_index", "token_count": 2239 }
1,705
# the proper usage is documented in the README, you need to specify data_dir, output_dir and model_name_or_path # run ./finetune.sh --help to see all the possible options python finetune.py \ --learning_rate=3e-5 \ --fp16 \ --gpus 1 \ --do_train \ --do_predict \ --n_val 1000 \ --val_check_in...
transformers/examples/research_projects/seq2seq-distillation/finetune.sh/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/finetune.sh", "repo_id": "transformers", "token_count": 138 }
602
"""Awadb reader.""" from typing import Any, List import numpy as np from llama_index.legacy.readers.base import BaseReader from llama_index.legacy.schema import Document class AwadbReader(BaseReader): """Awadb reader. Retrieves documents through an existing awadb client. These documents can then be us...
llama_index/llama-index-legacy/llama_index/legacy/readers/awadb.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/awadb.py", "repo_id": "llama_index", "token_count": 892 }
1,701
<jupyter_start><jupyter_text>MilvusReader If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-readers-milvus !pip install llama-index import logging import sys import random # Uncomment to see debug logs # logging.basicConfig(stream=sys.stdou...
llama_index/docs/examples/data_connectors/MilvusReaderDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/data_connectors/MilvusReaderDemo.ipynb", "repo_id": "llama_index", "token_count": 253 }
1,074
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.azure_speech import AzureSpeechToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in AzureSpeechToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-azure-speech/tests/test_tools_azure_speech.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-azure-speech/tests/test_tools_azure_speech.py", "repo_id": "llama_index", "token_count": 98 }
1,505
from abc import abstractmethod from typing import Any from langchain.callbacks.manager import Callbacks from langchain.chains.base import Chain from langchain_experimental.plan_and_execute.schema import StepResponse from langchain_experimental.pydantic_v1 import BaseModel class BaseExecutor(BaseModel): """Base ...
langchain/libs/experimental/langchain_experimental/plan_and_execute/executors/base.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/plan_and_execute/executors/base.py", "repo_id": "langchain", "token_count": 462 }
422
import { PortkeyChat } from "@langchain/community/chat_models/portkey"; import { SystemMessage } from "@langchain/core/messages"; export const run = async () => { const model = new PortkeyChat({ mode: "single", llms: [ { provider: "openai", virtual_key: "open-ai-key-1234", model...
langchainjs/examples/src/llms/portkey-chat.ts/0
{ "file_path": "langchainjs/examples/src/llms/portkey-chat.ts", "repo_id": "langchainjs", "token_count": 343 }
823
"""Test the server and client together.""" import asyncio import datetime import json from asyncio import AbstractEventLoop from contextlib import asynccontextmanager, contextmanager from dataclasses import dataclass from enum import Enum from itertools import cycle from typing import ( Any, Dict, Iterable,...
langserve/tests/unit_tests/test_server_client.py/0
{ "file_path": "langserve/tests/unit_tests/test_server_client.py", "repo_id": "langserve", "token_count": 44314 }
1,007
from langchain.schema.storage import __all__ EXPECTED_ALL = ["BaseStore", "K", "V"] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
langchain/libs/langchain/tests/unit_tests/schema/test_storage.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/schema/test_storage.py", "repo_id": "langchain", "token_count": 64 }
673
"""Base embeddings file.""" import asyncio from abc import abstractmethod from typing import Coroutine, List, Tuple from llama_index.core.base.embeddings.base import ( BaseEmbedding, Embedding, ) from llama_index.core.callbacks.schema import CBEventType, EventPayload from llama_index.core.schema import ImageT...
llama_index/llama-index-core/llama_index/core/embeddings/multi_modal_base.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/embeddings/multi_modal_base.py", "repo_id": "llama_index", "token_count": 3409 }
1,207
// 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/storage/event_writer.go/0
{ "file_path": "milvus/internal/storage/event_writer.go", "repo_id": "milvus", "token_count": 3858 }
1,870