text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
import logging from typing import Any, Callable, Generator, Optional, Sequence, Type, cast from llama_index.legacy.bridge.pydantic import BaseModel, Field, ValidationError from llama_index.legacy.indices.utils import truncate_text from llama_index.legacy.llm_predictor.base import LLMPredictorType from llama_index.lega...
llama_index/llama-index-legacy/llama_index/legacy/response_synthesizers/refine.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/response_synthesizers/refine.py", "repo_id": "llama_index", "token_count": 8559 }
1,537
// 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/common/type_c.h/0
{ "file_path": "milvus/internal/core/src/common/type_c.h", "repo_id": "milvus", "token_count": 1003 }
1,782
kind: StressChaos apiVersion: chaos-mesh.org/v1alpha1 metadata: name: test-datanode-memory-stress namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: release: milvus-chaos app: minio mode: one stressors: cpu: workers: 4 load: 80 me...
milvus/tests/python_client/chaos/chaos_objects/mem_stress/chaos_minio_mem_stress.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/mem_stress/chaos_minio_mem_stress.yaml", "repo_id": "milvus", "token_count": 164 }
2,163
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-supabase/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-supabase/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,538
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querycoordv2/observers/replica_observer_test.go/0
{ "file_path": "milvus/internal/querycoordv2/observers/replica_observer_test.go", "repo_id": "milvus", "token_count": 2303 }
2,034
<jupyter_start><jupyter_text>Portkey**Portkey** is a full-stack LLMOps platform that productionizes your Gen AI app reliably and securely. Key Features of Portkey's Integration with Llamaindex:1. **[🚪 AI Gateway](🔁-implementing-fallbacks-and-retries-with-portkey)**: - **[Automated Fallbacks & Retries](🔁-implemen...
llama_index/docs/examples/llm/portkey.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/portkey.ipynb", "repo_id": "llama_index", "token_count": 5522 }
1,064
<script lang="ts"> import { base } from "$app/paths"; import Logo from "$lib/components/icons/Logo.svelte"; import { switchTheme } from "$lib/switchTheme"; import { isAborted } from "$lib/stores/isAborted"; import { PUBLIC_APP_NAME, PUBLIC_ORIGIN } from "$env/static/public"; import NavConversationItem from "./Na...
chat-ui/src/lib/components/NavMenu.svelte/0
{ "file_path": "chat-ui/src/lib/components/NavMenu.svelte", "repo_id": "chat-ui", "token_count": 1944 }
84
# 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/tests/pipelines/test_pipelines_translation.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_translation.py", "repo_id": "transformers", "token_count": 3092 }
785
// 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/meta_service_test.go/0
{ "file_path": "milvus/internal/datanode/meta_service_test.go", "repo_id": "milvus", "token_count": 1257 }
1,975
# Memory Stress Testcases All-in-one # memory stress # standalone # todo # cluster-1-node # 11 pods(querynode, datanode, indexnode, pulsar, etcd, minio) # cluster-n-nodes # todo Collections: - testcase: name: test_querynode_memory_stress chaos: chaos_querynode_memory_s...
milvus/tests/python_client/chaos/chaos_objects/memory_stress/testcases.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/memory_stress/testcases.yaml", "repo_id": "milvus", "token_count": 366 }
1,988
""" Pooling-based Vision Transformer (PiT) in PyTorch A PyTorch implement of Pooling-based Vision Transformers as described in 'Rethinking Spatial Dimensions of Vision Transformers' - https://arxiv.org/abs/2103.16302 This code was adapted from the original version at https://github.com/naver-ai/pit, original copyrigh...
pytorch-image-models/timm/models/pit.py/0
{ "file_path": "pytorch-image-models/timm/models/pit.py", "repo_id": "pytorch-image-models", "token_count": 7347 }
356
# Build and load Nearly every deep learning workflow begins with loading a dataset, which makes it one of the most important steps. With 🤗 Datasets, there are more than 900 datasets available to help you get started with your NLP task. All you have to do is call: [`load_dataset`] to take your first step. This functio...
datasets/docs/source/about_dataset_load.mdx/0
{ "file_path": "datasets/docs/source/about_dataset_load.mdx", "repo_id": "datasets", "token_count": 2537 }
129
from llama_index.storage.docstore.dynamodb.base import DynamoDBDocumentStore __all__ = ["DynamoDBDocumentStore"]
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-dynamodb/llama_index/storage/docstore/dynamodb/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-dynamodb/llama_index/storage/docstore/dynamodb/__init__.py", "repo_id": "llama_index", "token_count": 37 }
1,452
[package] name = "tokenizers-python" version = "0.15.3-dev.0" authors = ["Anthony MOI <m.anthony.moi@gmail.com>"] edition = "2021" [lib] name = "tokenizers" crate-type = ["cdylib"] [dependencies] rayon = "1.8" serde = { version = "1.0", features = [ "rc", "derive" ]} serde_json = "1.0" libc = "0.2" env_logger = "0.10...
tokenizers/bindings/python/Cargo.toml/0
{ "file_path": "tokenizers/bindings/python/Cargo.toml", "repo_id": "tokenizers", "token_count": 302 }
433
# 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/models/transformers/transformer_2d.py/0
{ "file_path": "diffusers/src/diffusers/models/transformers/transformer_2d.py", "repo_id": "diffusers", "token_count": 10731 }
237
from langchain_community.vectorstores.supabase import SupabaseVectorStore __all__ = ["SupabaseVectorStore"]
langchain/libs/langchain/langchain/vectorstores/supabase.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/supabase.py", "repo_id": "langchain", "token_count": 29 }
618
// Code generated by mockery v2.32.4. DO NOT EDIT. package mocks import ( context "context" commonpb "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" clientv3 "go.etcd.io/etcd/client/v3" internalpb "github.com/milvus-io/milvus/internal/proto/internalpb" milvuspb "github.com/milvus-io/milvus-proto/go-api...
milvus/internal/mocks/mock_querycoord.go/0
{ "file_path": "milvus/internal/mocks/mock_querycoord.go", "repo_id": "milvus", "token_count": 26904 }
1,724
# IMSDb >[IMSDb](https://imsdb.com/) is the `Internet Movie Script Database`. > ## Installation and Setup There isn't any special setup for it. ## Document Loader See a [usage example](/docs/integrations/document_loaders/imsdb). ```python from langchain_community.document_loaders import IMSDbLoader ```
langchain/docs/docs/integrations/providers/imsdb.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/imsdb.mdx", "repo_id": "langchain", "token_count": 98 }
138
from typing import Any, Iterator, List, Mapping, Optional import requests from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.llms import LLM from langchain_core.outputs import GenerationChunk from requests.exceptions import ConnectionError from langchain_community.llms.u...
langchain/libs/community/langchain_community/llms/titan_takeoff_pro.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/titan_takeoff_pro.py", "repo_id": "langchain", "token_count": 3459 }
274
import candle from candle import Tensor from candle.nn import Linear def test_linear_layer_can_be_constructed(): linear = Linear(10, 10) assert linear is not None def test_linear_layer_can_forward_a_singular_input(): linear = Linear(384, 1536) input_tensor = candle.randn((8, 384)) output = linea...
candle/candle-pyo3/tests/bindings/test_linear.py/0
{ "file_path": "candle/candle-pyo3/tests/bindings/test_linear.py", "repo_id": "candle", "token_count": 431 }
70
# 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 applicabl...
accelerate/src/accelerate/launchers.py/0
{ "file_path": "accelerate/src/accelerate/launchers.py", "repo_id": "accelerate", "token_count": 4790 }
11
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/embeddings/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/embeddings/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,508
// 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/constant.go/0
{ "file_path": "milvus/pkg/util/constant.go", "repo_id": "milvus", "token_count": 2653 }
1,833
# LlamaIndex Index_Store Integration: Dynamodb Index Store
llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-dynamodb/README.md/0
{ "file_path": "llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-dynamodb/README.md", "repo_id": "llama_index", "token_count": 15 }
1,416
stability: collections: - server: db_config.primary_path: /test/milvus/db_data_011/sift_10m_1024_128_l2_sq8_stability cache_config.cpu_cache_capacity: 64GB cache_config.cache_insert_data: true engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold:...
milvus/tests/benchmark/milvus_benchmark/suites/011_gpu_stability.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/011_gpu_stability.yaml", "repo_id": "milvus", "token_count": 580 }
1,866
# 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/models/attention.py/0
{ "file_path": "diffusers/src/diffusers/models/attention.py", "repo_id": "diffusers", "token_count": 12724 }
234
# Adapt a model to a new task Many diffusion systems share the same components, allowing you to adapt a pretrained model for one task to an entirely different task. This guide will show you how to adapt a pretrained text-to-image model for inpainting by initializing and modifying the architecture of a pretrained [`UN...
diffusers/docs/source/en/training/adapt_a_model.md/0
{ "file_path": "diffusers/docs/source/en/training/adapt_a_model.md", "repo_id": "diffusers", "token_count": 779 }
183
from langchain_community.llms.rwkv import RWKV __all__ = ["RWKV"]
langchain/libs/langchain/langchain/llms/rwkv.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/rwkv.py", "repo_id": "langchain", "token_count": 28 }
565
import json import os from dataclasses import dataclass import numpy as np import pyarrow as pa import datasets from utils import get_duration SPEED_TEST_N_EXAMPLES = 100_000_000_000 SPEED_TEST_CHUNK_SIZE = 10_000 RESULTS_BASEPATH, RESULTS_FILENAME = os.path.split(__file__) RESULTS_FILE_PATH = os.path.join(RESULTS...
datasets/benchmarks/benchmark_getitem_100B.py/0
{ "file_path": "datasets/benchmarks/benchmark_getitem_100B.py", "repo_id": "datasets", "token_count": 867 }
108
<jupyter_start><jupyter_text>**Building an Image Similarity System with 🤗 Transformers**In this notebook, you'll learn to build an image similarity system with 🤗 Transformers. Finding out the similarity between a query image and potential candidates is an important use case for information retrieval systems, reverse ...
notebooks/examples/image_similarity.ipynb/0
{ "file_path": "notebooks/examples/image_similarity.ipynb", "repo_id": "notebooks", "token_count": 8098 }
293
"""Util that calls AlphaVantage for Currency Exchange Rate.""" from typing import Any, Dict, List, Optional import requests from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator from langchain_core.utils import get_from_dict_or_env class AlphaVantageAPIWrapper(BaseModel): """Wrapper for AlphaVa...
langchain/libs/community/langchain_community/utilities/alpha_vantage.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/alpha_vantage.py", "repo_id": "langchain", "token_count": 895 }
316
import { z } from "zod"; import { zodToJsonSchema, JsonSchema7ObjectType } from "zod-to-json-schema"; import { BaseChatModel } from "@langchain/core/language_models/chat_models"; import { BaseFunctionCallOptions } from "@langchain/core/language_models/base"; import { PromptTemplate } from "@langchain/core/prompts"; imp...
langchainjs/langchain/src/chains/openai_functions/extraction.ts/0
{ "file_path": "langchainjs/langchain/src/chains/openai_functions/extraction.ts", "repo_id": "langchainjs", "token_count": 974 }
852
//! MobileOne inference implementation based on timm and candle-repvgg //! //! See "MobileOne: An Improved One millisecond Mobile Backbone" //! https://arxiv.org/abs/2206.04040 use candle::{DType, Result, Tensor, D}; use candle_nn::{ batch_norm, conv2d, conv2d_no_bias, linear, ops::sigmoid, BatchNorm, Conv2d, Conv...
candle/candle-transformers/src/models/mobileone.rs/0
{ "file_path": "candle/candle-transformers/src/models/mobileone.rs", "repo_id": "candle", "token_count": 4721 }
79
import struct import zlib from pathlib import Path from typing import Any, Dict, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class HWPReader(BaseReader): """Hwp Reader. Reads contents from Hwp file. Args: None. """ def __init__(sel...
llama_index/llama-index-integrations/readers/llama-index-readers-hwp/llama_index/readers/hwp/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hwp/llama_index/readers/hwp/base.py", "repo_id": "llama_index", "token_count": 1510 }
1,509
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, is_onnx_available, is_torch_available, is_transformers_availa...
diffusers/src/diffusers/pipelines/stable_diffusion/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion/__init__.py", "repo_id": "diffusers", "token_count": 3769 }
256
python_sources() python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/readability_web/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/readability_web/BUILD", "repo_id": "llama_index", "token_count": 24 }
1,540
<jupyter_start><jupyter_text>Azure AI Document Intelligence >[Azure AI Document Intelligence](https://aka.ms/doc-intelligence) (formerly known as `Azure Form Recognizer`) is machine-learning >based service that extracts text (including handwriting), tables or key-value-pairs from>scanned documents or images.>>Document ...
langchain/docs/docs/integrations/document_loaders/azure_document_intelligence.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/azure_document_intelligence.ipynb", "repo_id": "langchain", "token_count": 660 }
108
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
diffusers/examples/advanced_diffusion_training/train_dreambooth_lora_sd15_advanced.py/0
{ "file_path": "diffusers/examples/advanced_diffusion_training/train_dreambooth_lora_sd15_advanced.py", "repo_id": "diffusers", "token_count": 37748 }
195
import { SequentialChain, LLMChain } from "langchain/chains"; import { OpenAI } from "@langchain/openai"; import { PromptTemplate } from "@langchain/core/prompts"; // This is an LLMChain to write a synopsis given a title of a play and the era it is set in. const llm = new OpenAI({ temperature: 0 }); const template = `...
langchainjs/examples/src/chains/sequential_chain.ts/0
{ "file_path": "langchainjs/examples/src/chains/sequential_chain.ts", "repo_id": "langchainjs", "token_count": 967 }
823
"""Chain that makes API calls and summarizes the responses to answer a question.""" from __future__ import annotations from typing import Any, Dict, List, Optional, Sequence, Tuple from urllib.parse import urlparse from langchain_community.utilities.requests import TextRequestsWrapper from langchain_core.callbacks im...
langchain/libs/langchain/langchain/chains/api/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/api/base.py", "repo_id": "langchain", "token_count": 3757 }
453
# Copyright 2024 Bingxin Ke, ETH Zurich and 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 # # U...
diffusers/examples/community/marigold_depth_estimation.py/0
{ "file_path": "diffusers/examples/community/marigold_depth_estimation.py", "repo_id": "diffusers", "token_count": 10828 }
206
# Llama Guard Moderator Pack This pack is to utilize [Llama Guard](https://huggingface.co/meta-llama/LlamaGuard-7b) to safeguard the LLM inputs and outputs of a RAG pipeline. Llama Guard is an input-output safeguard model. It can be used for classifying content in both LLM inputs (prompt classification) and LLM respon...
llama_index/llama-index-packs/llama-index-packs-llama-guard-moderator/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-llama-guard-moderator/README.md", "repo_id": "llama_index", "token_count": 3545 }
1,661
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-apify/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-apify/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,318
from llama_index.llms.llama_api.base import LlamaAPI __all__ = ["LlamaAPI"]
llama_index/llama-index-integrations/llms/llama-index-llms-llama-api/llama_index/llms/llama_api/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-llama-api/llama_index/llms/llama_api/__init__.py", "repo_id": "llama_index", "token_count": 32 }
1,264
import * as uuid from "uuid"; import { EmbeddingsInterface } from "@langchain/core/embeddings"; import { VectorStore } from "@langchain/core/vectorstores"; import { Index as UpstashIndex } from "@upstash/vector"; import { Document, DocumentInterface } from "@langchain/core/documents"; import { chunkArray } from "@langc...
langchainjs/libs/langchain-community/src/vectorstores/upstash.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/upstash.ts", "repo_id": "langchainjs", "token_count": 2608 }
1,031
package meta import ( "fmt" "github.com/golang/protobuf/proto" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/cmd/tools/migration/legacy" "github.com/milvus-io/milvus/cmd/tools/migration/legacy/legacypb" "github.com/milvus-io/milvus/internal/metastore/kv/rootcoord" "github...
milvus/cmd/tools/migration/meta/meta210.go/0
{ "file_path": "milvus/cmd/tools/migration/meta/meta210.go", "repo_id": "milvus", "token_count": 3459 }
1,725
# EfficientNet **EfficientNet** is a convolutional neural network architecture and scaling method that uniformly scales all dimensions of depth/width/resolution using a *compound coefficient*. Unlike conventional practice that arbitrary scales these factors, the EfficientNet scaling method uniformly scales network wi...
pytorch-image-models/docs/models/.templates/models/efficientnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/efficientnet.md", "repo_id": "pytorch-image-models", "token_count": 4091 }
356
# `tokenizers-linux-arm-gnueabihf` This is the **armv7-unknown-linux-gnueabihf** binary for `tokenizers`
tokenizers/bindings/node/npm/linux-arm-gnueabihf/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/linux-arm-gnueabihf/README.md", "repo_id": "tokenizers", "token_count": 42 }
414
<!--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 agreed...
transformers/docs/source/en/model_doc/sew.md/0
{ "file_path": "transformers/docs/source/en/model_doc/sew.md", "repo_id": "transformers", "token_count": 712 }
517
"""Test OllamaFunctions""" import unittest from langchain_community.chat_models.ollama import ChatOllama from langchain_experimental.llms.ollama_functions import OllamaFunctions class TestOllamaFunctions(unittest.TestCase): """ Test OllamaFunctions """ def test_default_ollama_functions(self) -> No...
langchain/libs/experimental/tests/integration_tests/llms/test_ollama_functions.py/0
{ "file_path": "langchain/libs/experimental/tests/integration_tests/llms/test_ollama_functions.py", "repo_id": "langchain", "token_count": 924 }
452
<jupyter_start><jupyter_text>Recursive URLWe may want to process load all URLs under a root directory.For example, let's look at the [Python 3.9 Document](https://docs.python.org/3.9/).This has many interesting child pages that we may want to read in bulk.Of course, the `WebBaseLoader` can load a list of pages. But, th...
langchain/docs/docs/integrations/document_loaders/recursive_url.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/recursive_url.ipynb", "repo_id": "langchain", "token_count": 692 }
105
use super::{super::OrderedVocabIter, WordLevel, WordLevelBuilder}; use serde::{ de::{MapAccess, Visitor}, ser::SerializeStruct, Deserialize, Deserializer, Serialize, Serializer, }; use std::collections::HashSet; impl Serialize for WordLevel { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Er...
tokenizers/tokenizers/src/models/wordlevel/serialization.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/wordlevel/serialization.rs", "repo_id": "tokenizers", "token_count": 2084 }
431
# 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/yolos/test_modeling_yolos.py/0
{ "file_path": "transformers/tests/models/yolos/test_modeling_yolos.py", "repo_id": "transformers", "token_count": 6777 }
759
<jupyter_start><jupyter_text>QA using Activeloop's DeepLakeIn this tutorial, we are going to use Langchain + Activeloop's Deep Lake with GPT4 to semantically search and ask questions over a group chat.View a working demo [here](https://twitter.com/thisissukh_/status/1647223328363679745) 1. Install required packages<ju...
langchain/cookbook/deeplake_semantic_search_over_chat.ipynb/0
{ "file_path": "langchain/cookbook/deeplake_semantic_search_over_chat.ipynb", "repo_id": "langchain", "token_count": 1610 }
76
import { test, expect } from "@jest/globals"; import { difference, intersection, union } from "../set.js"; test("difference", () => { const set1 = new Set(["a", "b"]); const set2 = new Set(["b", "c"]); const resultSet = difference(set1, set2); expect(resultSet).toMatchInlineSnapshot(` Set { "a",...
langchainjs/langchain/src/util/tests/set.test.ts/0
{ "file_path": "langchainjs/langchain/src/util/tests/set.test.ts", "repo_id": "langchainjs", "token_count": 399 }
948
# Agentic strategies You can build agents on top of your existing LlamaIndex RAG pipeline to empower it with automated decision capabilities. A lot of modules (routing, query transformations, and more) are already agentic in nature in that they use LLMs for decision making. ## Simpler Agentic Strategies These includ...
llama_index/docs/optimizing/agentic_strategies/agentic_strategies.md/0
{ "file_path": "llama_index/docs/optimizing/agentic_strategies/agentic_strategies.md", "repo_id": "llama_index", "token_count": 443 }
1,163
# 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/deformable_detr/test_modeling_deformable_detr.py/0
{ "file_path": "transformers/tests/models/deformable_detr/test_modeling_deformable_detr.py", "repo_id": "transformers", "token_count": 14410 }
756
import unittest import pytest from langchain_community.document_loaders.parsers.language.lua import LuaSegmenter @pytest.mark.requires("tree_sitter", "tree_sitter_languages") class TestLuaSegmenter(unittest.TestCase): def setUp(self) -> None: self.example_code = """function F() print("Hello") end l...
langchain/libs/community/tests/unit_tests/document_loaders/parsers/language/test_lua.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/parsers/language/test_lua.py", "repo_id": "langchain", "token_count": 820 }
365
locust_insert_performance: collections: - server: cache_config.cpu_cache_capacity: 8GB cache_config.insert_buffer_size: 2GB engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: true gpu_resource_config.cache...
milvus/tests/benchmark/milvus_benchmark/suites/locust_insert.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/locust_insert.yaml", "repo_id": "milvus", "token_count": 328 }
2,154
import type { createCluster, createClient, RediSearchSchema, SearchOptions, } from "redis"; import { SchemaFieldTypes, VectorAlgorithms } from "redis"; import type { EmbeddingsInterface } from "@langchain/core/embeddings"; import { VectorStore } from "@langchain/core/vectorstores"; import { Document } from "@la...
langchainjs/libs/langchain-community/src/vectorstores/redis.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/redis.ts", "repo_id": "langchainjs", "token_count": 5106 }
994
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querycoordv2/checkers/controller_base_test.go/0
{ "file_path": "milvus/internal/querycoordv2/checkers/controller_base_test.go", "repo_id": "milvus", "token_count": 1426 }
1,893
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
trl/trl/trainer/ppo_trainer.py/0
{ "file_path": "trl/trl/trainer/ppo_trainer.py", "repo_id": "trl", "token_count": 29303 }
788
# coding=utf-8 # Copyright 2022 The Trajectory Transformers paper authors 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://ww...
transformers/src/transformers/models/deprecated/trajectory_transformer/convert_trajectory_transformer_original_pytorch_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/deprecated/trajectory_transformer/convert_trajectory_transformer_original_pytorch_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 1099 }
647
#!/usr/bin/env python # 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/L...
transformers/src/transformers/tools/translation.py/0
{ "file_path": "transformers/src/transformers/tools/translation.py", "repo_id": "transformers", "token_count": 4126 }
754
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/models/plbart/test_tokenization_plbart.py/0
{ "file_path": "transformers/tests/models/plbart/test_tokenization_plbart.py", "repo_id": "transformers", "token_count": 6876 }
744
from langchain_core.load.dump import dumpd, dumps from langchain_core.load.load import load, loads from langchain_openai import ChatOpenAI, OpenAI def test_loads_openai_llm() -> None: llm = OpenAI(model="davinci", temperature=0.5, openai_api_key="hello") llm_string = dumps(llm) llm2 = loads(llm_string, s...
langchain/libs/partners/openai/tests/unit_tests/test_load.py/0
{ "file_path": "langchain/libs/partners/openai/tests/unit_tests/test_load.py", "repo_id": "langchain", "token_count": 636 }
655
import logging import os from typing import List import requests from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class SemanticScholarReader(BaseReader): """ A class to read and process data from Semantic Scholar API ... Methods: ------- __in...
llama_index/llama-index-integrations/readers/llama-index-readers-semanticscholar/llama_index/readers/semanticscholar/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-semanticscholar/llama_index/readers/semanticscholar/base.py", "repo_id": "llama_index", "token_count": 3625 }
1,455
# LlamaIndex Readers Integration: Twitter
llama_index/llama-index-integrations/readers/llama-index-readers-twitter/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-twitter/README.md", "repo_id": "llama_index", "token_count": 9 }
1,438
<jupyter_start><jupyter_text>Fonctions avancées d'Interface Installez les bibliothèques 🤗 Transformers et 🤗 Gradio pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece] !pip install gradio import random import gradio as gr def chat(message, history): history = history or [...
notebooks/course/fr/chapter9/section6.ipynb/0
{ "file_path": "notebooks/course/fr/chapter9/section6.ipynb", "repo_id": "notebooks", "token_count": 647 }
294
//! Text Generation gRPC client library mod client; #[allow(clippy::derive_partial_eq_without_eq)] mod pb; mod sharded_client; pub use client::Client; pub use pb::generate::v2::HealthResponse; pub use pb::generate::v2::InfoResponse as ShardInfo; pub use pb::generate::v2::{ Batch, CachedBatch, FinishReason, Genera...
text-generation-inference/router/client/src/lib.rs/0
{ "file_path": "text-generation-inference/router/client/src/lib.rs", "repo_id": "text-generation-inference", "token_count": 464 }
433
"""Wrapper around Anyscale Endpoint""" from typing import ( Any, Dict, List, Mapping, Optional, Set, ) from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.outputs import Generation, GenerationChunk, LLMResult from langcha...
langchain/libs/community/langchain_community/llms/anyscale.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/anyscale.py", "repo_id": "langchain", "token_count": 5983 }
276
import type { ObjectId } from "bson"; import type { Timestamps } from "./Timestamps"; import type { User } from "./User"; export interface Session extends Timestamps { _id: ObjectId; sessionId: string; userId: User["_id"]; userAgent?: string; ip?: string; expiresAt: Date; }
chat-ui/src/lib/types/Session.ts/0
{ "file_path": "chat-ui/src/lib/types/Session.ts", "repo_id": "chat-ui", "token_count": 97 }
103
from typing import List from langchain_community.document_loaders.unstructured import UnstructuredFileLoader class UnstructuredImageLoader(UnstructuredFileLoader): """Load `PNG` and `JPG` files using `Unstructured`. You can run the loader in one of two modes: "single" and "elements". If you use "single"...
langchain/libs/community/langchain_community/document_loaders/image.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/image.py", "repo_id": "langchain", "token_count": 369 }
239
"""Test AzureML Endpoint wrapper.""" import json import os from pathlib import Path from typing import Dict from urllib.request import HTTPError import pytest from langchain_core.pydantic_v1 import ValidationError from langchain_community.llms.azureml_endpoint import ( AzureMLOnlineEndpoint, ContentFormatter...
langchain/libs/community/tests/integration_tests/llms/test_azureml_endpoint.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_azureml_endpoint.py", "repo_id": "langchain", "token_count": 2691 }
333
import time import pytest from pymilvus import Collection from base.client_base import TestcaseBase from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel from utils.util_log import test_log as log from utils.util_common import get_collections class TestAllC...
milvus/tests/python_client/chaos/testcases/test_all_collections_after_chaos.py/0
{ "file_path": "milvus/tests/python_client/chaos/testcases/test_all_collections_after_chaos.py", "repo_id": "milvus", "token_count": 2554 }
1,894
[build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" [tool.llamahub] classes = ["HatenaBlogReader"] contains_example = false import_path = "llama_index.readers.hatena_blo...
llama_index/llama-index-integrations/readers/llama-index-readers-hatena-blog/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hatena-blog/pyproject.toml", "repo_id": "llama_index", "token_count": 702 }
1,376
"""Pydantic output parser.""" import json from typing import Any, List, Optional, Type from llama_index.legacy.output_parsers.base import ChainableOutputParser from llama_index.legacy.output_parsers.utils import extract_json_str from llama_index.legacy.types import Model PYDANTIC_FORMAT_TMPL = """ Here's a JSON sche...
llama_index/llama-index-legacy/llama_index/legacy/output_parsers/pydantic.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/output_parsers/pydantic.py", "repo_id": "llama_index", "token_count": 849 }
1,597
// For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose { // Name for the dev container "name": "langchain", // Point to a Docker Compose file "dockerComposeFile": "./docker-compos...
langchain/.devcontainer/devcontainer.json/0
{ "file_path": "langchain/.devcontainer/devcontainer.json", "repo_id": "langchain", "token_count": 398 }
72
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,536
from llama_index.readers.pdf_table.base import PDFTableReader __all__ = ["PDFTableReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-pdf-table/llama_index/readers/pdf_table/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-pdf-table/llama_index/readers/pdf_table/__init__.py", "repo_id": "llama_index", "token_count": 31 }
1,539
from langchain_community.utilities.google_search import GoogleSearchAPIWrapper __all__ = ["GoogleSearchAPIWrapper"]
langchain/libs/langchain/langchain/utilities/google_search.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/google_search.py", "repo_id": "langchain", "token_count": 32 }
595
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/proxy/metrics_info_test.go/0
{ "file_path": "milvus/internal/proxy/metrics_info_test.go", "repo_id": "milvus", "token_count": 2744 }
1,817
""" PyTorch MADGRAD optimizer MADGRAD: https://arxiv.org/abs/2101.11075 Code from: https://github.com/facebookresearch/madgrad """ # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import ma...
pytorch-image-models/timm/optim/madgrad.py/0
{ "file_path": "pytorch-image-models/timm/optim/madgrad.py", "repo_id": "pytorch-image-models", "token_count": 3505 }
386
import asyncio from typing import Any, Dict from llama_index.core import ( ServiceContext, VectorStoreIndex, ) from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.llms.openai import OpenAI from llama_index.readers.wikipedia import WikipediaReader # Create a new event loop loop = asynci...
llama_index/llama-index-packs/llama-index-packs-streamlit-chatbot/llama_index/packs/streamlit_chatbot/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-streamlit-chatbot/llama_index/packs/streamlit_chatbot/base.py", "repo_id": "llama_index", "token_count": 2544 }
1,687
<jupyter_start><jupyter_text>Utilisation de modèles pré-entraînés (PyTorch) Installez la bibliothèque 🤗 Transformers pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece] from transformers import pipeline camembert_fill_mask = pipeline("fill-mask", model="camembert-base") results...
notebooks/course/fr/chapter4/section2_pt.ipynb/0
{ "file_path": "notebooks/course/fr/chapter4/section2_pt.ipynb", "repo_id": "notebooks", "token_count": 259 }
293
from llama_index.core.readers.base import BaseReader from llama_index.readers.readwise import ReadwiseReader def test_class(): names_of_base_classes = [b.__name__ for b in ReadwiseReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-readwise/tests/test_readers_readwise.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-readwise/tests/test_readers_readwise.py", "repo_id": "llama_index", "token_count": 88 }
1,512
"""Edenai Tools.""" from langchain_community.tools.edenai.audio_speech_to_text import ( EdenAiSpeechToTextTool, ) from langchain_community.tools.edenai.audio_text_to_speech import ( EdenAiTextToSpeechTool, ) from langchain_community.tools.edenai.edenai_base_tool import EdenaiTool from langchain_community.tools....
langchain/libs/community/langchain_community/tools/edenai/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/edenai/__init__.py", "repo_id": "langchain", "token_count": 394 }
295
python_sources() python_tests( name="tests0", )
llama_index/llama-index-packs/llama-index-packs-gradio-react-agent-chatbot/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-gradio-react-agent-chatbot/tests/BUILD", "repo_id": "llama_index", "token_count": 23 }
1,849
<jupyter_start><jupyter_text>Multi-Modal on PDF's with tables. One common challenge with RAG (`Retrieval-Augmented Generation`) involves handling PDFs that contain tables. Parsing tables in various formats can be quite complex.However, Microsoft's newly released model, [`Table Transformer`](https://huggingface.co/micro...
llama_index/docs/examples/multi_modal/multi_modal_pdf_tables.ipynb/0
{ "file_path": "llama_index/docs/examples/multi_modal/multi_modal_pdf_tables.ipynb", "repo_id": "llama_index", "token_count": 8911 }
1,095
# Using with Langchain 🦜🔗 LlamaIndex provides both Tool abstractions for a Langchain agent as well as a memory module. The API reference of the Tool abstractions + memory modules are [here](/api_reference/langchain_integrations/base.rst). ### Use any data loader as a Langchain Tool LlamaIndex allows you to use an...
llama_index/docs/community/integrations/using_with_langchain.md/0
{ "file_path": "llama_index/docs/community/integrations/using_with_langchain.md", "repo_id": "llama_index", "token_count": 530 }
1,086
from typing import Any, Dict, List, Optional from langchain_core.callbacks import CallbackManagerForRetrieverRun from langchain_core.documents import Document from langchain_core.pydantic_v1 import BaseModel, root_validator from langchain_core.retrievers import BaseRetriever class VectorSearchConfig(BaseModel, extra...
langchain/libs/community/langchain_community/retrievers/bedrock.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/bedrock.py", "repo_id": "langchain", "token_count": 2050 }
289
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/tools/llama-index-tools-bing-search/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-bing-search/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,560
from typing import Any, Callable, List, Optional, Union import torch from transformers import GenerationConfig, PreTrainedTokenizer, PreTrainedTokenizerFast from ..core import set_seed from ..models import SUPPORTED_ARCHITECTURES, PreTrainedModelWrapper class BestOfNSampler: def __init__( self, ...
trl/trl/extras/best_of_n_sampler.py/0
{ "file_path": "trl/trl/extras/best_of_n_sampler.py", "repo_id": "trl", "token_count": 2253 }
815
"""Integration test for Serper.dev's Google Search API Wrapper.""" from langchain_community.utilities.google_serper import GoogleSerperAPIWrapper def test_search_call() -> None: """Test that call gives the correct answer from search.""" search = GoogleSerperAPIWrapper() output = search.run("What was Obama...
langchain/libs/community/tests/integration_tests/utilities/test_googleserper_api.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/utilities/test_googleserper_api.py", "repo_id": "langchain", "token_count": 433 }
348
# 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/models/dual_transformer_2d.py/0
{ "file_path": "diffusers/src/diffusers/models/dual_transformer_2d.py", "repo_id": "diffusers", "token_count": 307 }
243
import os from typing import Optional, Type from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import BaseModel, Field from langchain_core.tools import BaseTool from langchain_community.tools.file_management.utils import ( INVALID_PATH_TEMPLATE, BaseFileToolMixin, ...
langchain/libs/community/langchain_community/tools/file_management/delete.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/file_management/delete.py", "repo_id": "langchain", "token_count": 532 }
301
# flake8: noqa from langchain_core.prompts.prompt import PromptTemplate _template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question. Chat History: {chat_history} Follow Up Input: {question} Standalone question:""" CONDENSE_QUESTION_PROMPT = Pro...
langchain/libs/langchain/langchain/chains/chat_vector_db/prompts.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/chat_vector_db/prompts.py", "repo_id": "langchain", "token_count": 199 }
477
<jupyter_start><jupyter_text>Multimodal Messages with OpenAI Vision**Note:** This feature is currently in preview and only available on `rc` branches, starting with `0.0.182-rc.0`. The message schema may change in future releases.OpenAI supports interleaving images with text in input messages with their `gpt-4-vision-p...
langchainjs/cookbook/openai_vision_multimodal.ipynb/0
{ "file_path": "langchainjs/cookbook/openai_vision_multimodal.ipynb", "repo_id": "langchainjs", "token_count": 28865 }
690
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/models/layoutlmv3/__init__.py/0
{ "file_path": "transformers/src/transformers/models/layoutlmv3/__init__.py", "repo_id": "transformers", "token_count": 1868 }
678
from uuid import UUID from starlette.responses import JSONResponse from chromadb.errors import ChromaError, InvalidUUIDError def fastapi_json_response(error: ChromaError) -> JSONResponse: return JSONResponse( content={"error": error.name(), "message": error.message()}, status_code=error.code(), ...
chroma/chromadb/server/fastapi/utils.py/0
{ "file_path": "chroma/chromadb/server/fastapi/utils.py", "repo_id": "chroma", "token_count": 189 }
19