text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# coding=utf-8 # Copyright 2023 MURGe-Lab and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
transformers/src/transformers/models/tvlt/modeling_tvlt.py/0
{ "file_path": "transformers/src/transformers/models/tvlt/modeling_tvlt.py", "repo_id": "transformers", "token_count": 24404 }
755
from langchain_community.utilities.stackexchange import StackExchangeAPIWrapper __all__ = ["StackExchangeAPIWrapper"]
langchain/libs/langchain/langchain/utilities/stackexchange.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/stackexchange.py", "repo_id": "langchain", "token_count": 36 }
578
"""Tests utilities module."""
langchain/libs/community/tests/unit_tests/utilities/__init__.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/utilities/__init__.py", "repo_id": "langchain", "token_count": 8 }
382
# OpenWeatherMap >[OpenWeatherMap](https://openweathermap.org/api/) provides all essential weather data for a specific location: >- Current weather >- Minute forecast for 1 hour >- Hourly forecast for 48 hours >- Daily forecast for 8 days >- National weather alerts >- Historical weather data for 40+ years back This p...
langchain/docs/docs/integrations/providers/openweathermap.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/openweathermap.mdx", "repo_id": "langchain", "token_count": 349 }
141
cargo build --target wasm32-unknown-unknown --release wasm-bindgen ../../target/wasm32-unknown-unknown/release/m.wasm --out-dir build --target web wasm-bindgen ../../target/wasm32-unknown-unknown/release/m-quantized.wasm --out-dir build --target web
candle/candle-wasm-examples/t5/build-lib.sh/0
{ "file_path": "candle/candle-wasm-examples/t5/build-lib.sh", "repo_id": "candle", "token_count": 84 }
75
export function formatUserCount(userCount: number): string { const userCountRanges: { min: number; max: number; label: string }[] = [ { min: 0, max: 1, label: "1" }, { min: 2, max: 9, label: "1-10" }, { min: 10, max: 49, label: "10+" }, { min: 50, max: 99, label: "50+" }, { min: 100, max: 299, label: "100+" ...
chat-ui/src/lib/utils/formatUserCount.ts/0
{ "file_path": "chat-ui/src/lib/utils/formatUserCount.ts", "repo_id": "chat-ui", "token_count": 308 }
97
import json import time from llama_index.legacy.schema import TextNode from llama_index.legacy.vector_stores.jaguar import JaguarVectorStore from llama_index.legacy.vector_stores.types import ( VectorStoreQuery, ) ############################################################################################# ## Th...
llama_index/llama-index-legacy/tests/vector_stores/test_jaguar.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/vector_stores/test_jaguar.py", "repo_id": "llama_index", "token_count": 3377 }
1,685
from langchain_core.prompts.few_shot_with_templates import FewShotPromptWithTemplates __all__ = ["FewShotPromptWithTemplates"]
langchain/libs/langchain/langchain/prompts/few_shot_with_templates.py/0
{ "file_path": "langchain/libs/langchain/langchain/prompts/few_shot_with_templates.py", "repo_id": "langchain", "token_count": 42 }
527
from langchain_community.llms.titan_takeoff import TitanTakeoff __all__ = ["TitanTakeoff"]
langchain/libs/langchain/langchain/llms/titan_takeoff.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/titan_takeoff.py", "repo_id": "langchain", "token_count": 31 }
518
import copy import re from typing import Any, Iterable, List, Optional, Sequence, Tuple import numpy as np from langchain_community.utils.math import ( cosine_similarity, ) from langchain_core.documents import BaseDocumentTransformer, Document from langchain_core.embeddings import Embeddings def combine_sentence...
langchain/libs/experimental/langchain_experimental/text_splitter.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/text_splitter.py", "repo_id": "langchain", "token_count": 2559 }
424
from llama_index.callbacks.aim.base import AimCallback __all__ = ["AimCallback"]
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-aim/llama_index/callbacks/aim/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-aim/llama_index/callbacks/aim/__init__.py", "repo_id": "llama_index", "token_count": 26 }
1,342
<jupyter_start><jupyter_text>OpenAI JSON Mode vs. Function Calling for Data Extraction OpenAI just released [JSON Mode](https://platform.openai.com/docs/guides/text-generation/json-mode): This new config constrain the LLM to only generate strings that parse into valid JSON (but no guarantee on validation against any s...
llama_index/docs/examples/llm/openai_json_vs_function_calling.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/openai_json_vs_function_calling.ipynb", "repo_id": "llama_index", "token_count": 3070 }
1,128
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.multi_tenancy_rag import MultiTenancyRAGPack def test_class(): names_of_base_classes = [b.__name__ for b in MultiTenancyRAGPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-multi-tenancy-rag/tests/test_packs_multi_tenancy_rag.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-multi-tenancy-rag/tests/test_packs_multi_tenancy_rag.py", "repo_id": "llama_index", "token_count": 101 }
1,712
from langchain_community.agent_toolkits.nla.toolkit import NLAToolkit __all__ = ["NLAToolkit"]
langchain/libs/langchain/langchain/agents/agent_toolkits/nla/toolkit.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/nla/toolkit.py", "repo_id": "langchain", "token_count": 35 }
461
# coding=utf-8 # Copyright 2023 The Google Flax Team Authors and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
transformers/src/transformers/models/regnet/modeling_flax_regnet.py/0
{ "file_path": "transformers/src/transformers/models/regnet/modeling_flax_regnet.py", "repo_id": "transformers", "token_count": 12467 }
651
import { DataSource } from "typeorm"; import { OpenAI } from "@langchain/openai"; import { SqlDatabase } from "langchain/sql_db"; import { SqlDatabaseChain } from "langchain/chains/sql_db"; /** * This example uses Chinook database, which is a sample database available for SQL Server, Oracle, MySQL, etc. * To set it ...
langchainjs/examples/src/chains/sql_db_sql_output_legacy.ts/0
{ "file_path": "langchainjs/examples/src/chains/sql_db_sql_output_legacy.ts", "repo_id": "langchainjs", "token_count": 299 }
805
use candle_core::{test_device, test_utils, DType, Device, IndexOp, Result, Tensor, D}; fn zeros(device: &Device) -> Result<()> { let tensor = Tensor::zeros((5, 2), DType::F32, device)?; let (dim1, dim2) = tensor.dims2()?; assert_eq!(dim1, 5); assert_eq!(dim2, 2); Ok(()) } fn ones(device: &Device) ...
candle/candle-core/tests/tensor_tests.rs/0
{ "file_path": "candle/candle-core/tests/tensor_tests.rs", "repo_id": "candle", "token_count": 23918 }
44
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node NUM_SHARDS = 4 NUM_ITEMS_PER_SHARD = 3 class FailedTestError(RuntimeError): pass def gen(shards: List[str]): ...
datasets/tests/distributed_scripts/run_torch_distributed.py/0
{ "file_path": "datasets/tests/distributed_scripts/run_torch_distributed.py", "repo_id": "datasets", "token_count": 617 }
155
# 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 applicabl...
transformers/tests/pipelines/test_pipelines_image_to_image.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_image_to_image.py", "repo_id": "transformers", "token_count": 1057 }
854
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/tasks/image_captioning.md/0
{ "file_path": "transformers/docs/source/en/tasks/image_captioning.md", "repo_id": "transformers", "token_count": 2704 }
502
from __future__ import annotations from dataclasses import dataclass @dataclass(frozen=True, eq=True) class VellumRegisteredPrompt: deployment_id: str deployment_name: str model_version_id: str sandbox_id: str | None = None sandbox_snapshot_id: str | None = None prompt_id: str | None = None ...
llama_index/llama-index-legacy/llama_index/legacy/llm_predictor/vellum/types.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llm_predictor/vellum/types.py", "repo_id": "llama_index", "token_count": 429 }
1,730
"""Tools for interacting with Spark SQL."""
langchain/libs/langchain/langchain/tools/spark_sql/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/spark_sql/__init__.py", "repo_id": "langchain", "token_count": 10 }
587
"""Loader that uses bs4 to load HTML files, enriching metadata with page title.""" import logging from typing import Any, Dict, Iterator, Union from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseBlobParser from langchain_community.document_loaders.blob_loaders imp...
langchain/libs/community/langchain_community/document_loaders/parsers/html/bs4.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/parsers/html/bs4.py", "repo_id": "langchain", "token_count": 697 }
256
const renderPassFail = (data: any) => { if (data.score === 0) { return "Incorrect"; } if (data.score === 1) { return "Correct"; } throw new Error(`Problem parsing ${data}`); }; export default renderPassFail;
auto-evaluator/nextjs/utils/renderPassFail.ts/0
{ "file_path": "auto-evaluator/nextjs/utils/renderPassFail.ts", "repo_id": "auto-evaluator", "token_count": 82 }
5
# LlamaIndex Embeddings Integration: Clip
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-clip/README.md/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-clip/README.md", "repo_id": "llama_index", "token_count": 11 }
1,192
import { test } from "@jest/globals"; import { GoogleLLM } from "../llms.js"; describe("Google APIKey LLM", () => { test("platform", async () => { const model = new GoogleLLM(); expect(model.platform).toEqual("gai"); }); test("call", async () => { const model = new GoogleLLM(); const res = await...
langchainjs/libs/langchain-google-webauth/src/tests/llms.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-google-webauth/src/tests/llms.int.test.ts", "repo_id": "langchainjs", "token_count": 601 }
1,101
import math from typing import Dict, Optional import torch import torchvision.transforms.functional as FF from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer from diffusers import StableDiffusionPipeline from diffusers.models import AutoencoderKL, UNet2DConditionModel from diffusers.pipelines....
diffusers/examples/community/regional_prompting_stable_diffusion.py/0
{ "file_path": "diffusers/examples/community/regional_prompting_stable_diffusion.py", "repo_id": "diffusers", "token_count": 13641 }
189
import os from langchain_community.chat_models import ChatOpenAI from langchain_community.embeddings import OpenAIEmbeddings from langchain_community.vectorstores.supabase import SupabaseVectorStore from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from lan...
langchain/templates/rag-supabase/rag_supabase/chain.py/0
{ "file_path": "langchain/templates/rag-supabase/rag_supabase/chain.py", "repo_id": "langchain", "token_count": 426 }
673
<jupyter_start><jupyter_text>Argilla>[Argilla](https://argilla.io/) is an open-source data curation platform for LLMs.> Using Argilla, everyone can build robust language models through faster data curation > using both human and machine feedback. We provide support for each step in the MLOps cycle, > from data labeling...
langchain/docs/docs/integrations/callbacks/argilla.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/callbacks/argilla.ipynb", "repo_id": "langchain", "token_count": 2385 }
97
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/api/pipelines/stable_diffusion/inpaint.md/0
{ "file_path": "diffusers/docs/source/en/api/pipelines/stable_diffusion/inpaint.md", "repo_id": "diffusers", "token_count": 680 }
175
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-amazon-product-extraction/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-amazon-product-extraction/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,691
search_performance: collections: - server: db_config.primary_path: /test/milvus/db_data_011/sift_50m_100000_128_l2_ivf_flat cache_config.cpu_cache_capacity: 32GB engine_config.use_blas_threshold: 0 engine_config.gpu_search_threshold: 100 gpu_resource_config.enable: tr...
milvus/tests/benchmark/milvus_benchmark/suites/011_gpu_sift50m_ivf.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/011_gpu_sift50m_ivf.yaml", "repo_id": "milvus", "token_count": 408 }
1,875
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/create_a_model.md/0
{ "file_path": "transformers/docs/source/ko/create_a_model.md", "repo_id": "transformers", "token_count": 11662 }
493
use crate::{DType, Device, Error, Result, Tensor, WithDType}; use safetensors::tensor as st; use safetensors::tensor::SafeTensors; use std::borrow::Cow; use std::collections::HashMap; use std::path::Path; impl From<DType> for st::Dtype { fn from(value: DType) -> Self { match value { DType::U8 =...
candle/candle-core/src/safetensors.rs/0
{ "file_path": "candle/candle-core/src/safetensors.rs", "repo_id": "candle", "token_count": 7743 }
38
from typing import Any, Dict, List, Optional, Union from .. import config from ..exceptions import DatasetsError from .file_utils import ( get_authentication_headers_for_url, http_get, ) from .logging import get_logger logger = get_logger(__name__) class DatasetsServerError(DatasetsError): """Dataset-s...
datasets/src/datasets/utils/_datasets_server.py/0
{ "file_path": "datasets/src/datasets/utils/_datasets_server.py", "repo_id": "datasets", "token_count": 1946 }
139
<jupyter_start><jupyter_text>Ionic Shopping Tool[Ionic](https://www.ioniccommerce.com/) is a plug and play ecommerce marketplace for AI Assistants. By including the [Ionic Tool](https://github.com/ioniccommerce/ionic_langchain) in your agent, you are effortlessly providing your users with the ability to shop and transa...
langchain/docs/docs/integrations/tools/ionic_shopping.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/ionic_shopping.ipynb", "repo_id": "langchain", "token_count": 935 }
175
release=${1:-"milvs-chaos"} milvus_mode=${2:-"cluster"} ns=${3:-"chaos-testing"} bash uninstall_milvus.sh ${release} ${ns}|| true helm repo add milvus https://zilliztech.github.io/milvus-helm/ helm repo update if [[ ${milvus_mode} == "cluster" ]]; then helm install --wait --timeout 360s ${release} milvus/milvus -...
milvus/tests/python_client/chaos/scripts/install_milvus.sh/0
{ "file_path": "milvus/tests/python_client/chaos/scripts/install_milvus.sh", "repo_id": "milvus", "token_count": 227 }
1,970
from llama_index.tools.weather.base import ( OpenWeatherMapToolSpec, ) __all__ = ["OpenWeatherMapToolSpec"]
llama_index/llama-index-integrations/tools/llama-index-tools-weather/llama_index/tools/weather/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-weather/llama_index/tools/weather/__init__.py", "repo_id": "llama_index", "token_count": 39 }
1,501
# coding=utf-8 # Copyright 2019 HuggingFace Inc. # # 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 ag...
transformers/tests/test_tokenization_common.py/0
{ "file_path": "transformers/tests/test_tokenization_common.py", "repo_id": "transformers", "token_count": 106722 }
860
import { OpenAI } from "@langchain/openai"; const model = new OpenAI({ // customize openai model that's used, `gpt-3.5-turbo-instruct` is the default modelName: "gpt-3.5-turbo-instruct", // `max_tokens` supports a magic -1 param where the max token length for the specified modelName // is calculated and incl...
langchainjs/examples/src/models/llm/llm_advanced.ts/0
{ "file_path": "langchainjs/examples/src/models/llm/llm_advanced.ts", "repo_id": "langchainjs", "token_count": 256 }
811
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-hubspot/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-hubspot/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,280
// 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/SystemProperty.cpp/0
{ "file_path": "milvus/internal/core/src/common/SystemProperty.cpp", "repo_id": "milvus", "token_count": 985 }
1,732
import hashlib import io import logging import os from pathlib import Path from typing import Any, Dict, List, Mapping, Optional, Sequence, Union import requests from langchain_core.documents import Document from langchain_core.pydantic_v1 import BaseModel, root_validator from langchain_community.document_loaders.bas...
langchain/libs/community/langchain_community/document_loaders/docugami.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/docugami.py", "repo_id": "langchain", "token_count": 6597 }
254
<!--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/whisper.md/0
{ "file_path": "transformers/docs/source/en/model_doc/whisper.md", "repo_id": "transformers", "token_count": 1994 }
497
# coding=utf-8 # Copyright 2019 HuggingFace Inc. # # 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 ag...
transformers/tests/test_modeling_utils.py/0
{ "file_path": "transformers/tests/test_modeling_utils.py", "repo_id": "transformers", "token_count": 42668 }
791
<jupyter_start><jupyter_text>HotpotQADistractor DemoThis notebook walks through evaluating a query engine using the HotpotQA dataset. In this task, the LLM must answer a question given a pre-configured context. The answer usually has to be concise, and accuracy is measured by calculating the overlap (measured by F1) an...
llama_index/docs/examples/evaluation/HotpotQADistractor.ipynb/0
{ "file_path": "llama_index/docs/examples/evaluation/HotpotQADistractor.ipynb", "repo_id": "llama_index", "token_count": 1145 }
1,100
"""Test StochasticAI API wrapper.""" from langchain_community.llms.stochasticai import StochasticAI def test_stochasticai_call() -> None: """Test valid call to StochasticAI.""" llm = StochasticAI() output = llm("Say foo:") assert isinstance(output, str)
langchain/libs/community/tests/integration_tests/llms/test_stochasticai.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_stochasticai.py", "repo_id": "langchain", "token_count": 98 }
367
import { OpenAI } from "@langchain/openai"; import { LLMChain } from "langchain/chains"; import { PromptTemplate } from "@langchain/core/prompts"; // Create a new LLMChain from a PromptTemplate and an LLM in streaming mode. const model = new OpenAI({ temperature: 0.9, streaming: true }); const prompt = PromptTemplate....
langchainjs/examples/src/chains/llm_chain_stream.ts/0
{ "file_path": "langchainjs/examples/src/chains/llm_chain_stream.ts", "repo_id": "langchainjs", "token_count": 235 }
776
import torch import torch.distributed from opentelemetry import trace from transformers import AutoConfig, AutoTokenizer from typing import Optional from text_generation_server.models import FlashCausalLM from text_generation_server.models.custom_modeling.flash_phi_modeling import ( FlashPhiForCausalLM, PhiCo...
text-generation-inference/server/text_generation_server/models/flash_phi.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/flash_phi.py", "repo_id": "text-generation-inference", "token_count": 1719 }
398
# Digital Ocean Droplet Deployment This is an example deployment using Digital Ocean Droplet using [terraform](https://www.terraform.io/). This deployment will do the following: - 🔥 Create a firewall with required ports open (22 and 8000) - 🐳 Create Droplet with Ubuntu 22 and deploy Chroma using docker compose - �...
chroma/examples/deployments/do-terraform/README.md/0
{ "file_path": "chroma/examples/deployments/do-terraform/README.md", "repo_id": "chroma", "token_count": 1331 }
37
import type { OpenAIClient } from "@langchain/openai"; import { AgentAction, AgentFinish, AgentStep } from "@langchain/core/agents"; import { BaseMessage, isBaseMessage } from "@langchain/core/messages"; import { ChatGeneration } from "@langchain/core/outputs"; import { OutputParserException } from "@langchain/core/out...
langchainjs/langchain/src/agents/openai_tools/output_parser.ts/0
{ "file_path": "langchainjs/langchain/src/agents/openai_tools/output_parser.ts", "repo_id": "langchainjs", "token_count": 1462 }
915
from langchain_core.agents import AgentAction from langchain.agents.conversational.output_parser import ConvoOutputParser def test_normal_output_parsing() -> None: _test_convo_output( """ Action: my_action Action Input: my action input """, "my_action", "my action input", ) def test...
langchain/libs/langchain/tests/unit_tests/agents/output_parsers/test_convo_output_parser.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/agents/output_parsers/test_convo_output_parser.py", "repo_id": "langchain", "token_count": 385 }
617
from functools import partial from typing import TYPE_CHECKING, Any, Optional, Type, cast from llama_index.legacy.bridge.pydantic import BaseModel from llama_index.legacy.program.llm_prompt_program import BaseLLMFunctionProgram from llama_index.legacy.prompts.base import PromptTemplate from llama_index.legacy.prompts....
llama_index/llama-index-legacy/llama_index/legacy/program/guidance_program.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/program/guidance_program.py", "repo_id": "llama_index", "token_count": 1472 }
1,586
python_tests()
llama_index/llama-index-integrations/question_gen/llama-index-question-gen-openai/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/question_gen/llama-index-question-gen-openai/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,275
""" Split Attention Conv2d (for ResNeSt Models) Paper: `ResNeSt: Split-Attention Networks` - /https://arxiv.org/abs/2004.08955 Adapted from original PyTorch impl at https://github.com/zhanghang1989/ResNeSt Modified for torchscript compat, performance, and consistency with timm by Ross Wightman """ import torch impor...
pytorch-image-models/timm/layers/split_attn.py/0
{ "file_path": "pytorch-image-models/timm/layers/split_attn.py", "repo_id": "pytorch-image-models", "token_count": 1533 }
336
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-hive/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hive/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,456
# Load text data This guide shows you how to load text datasets. To learn how to load any type of dataset, take a look at the <a class="underline decoration-sky-400 decoration-2 font-semibold" href="./loading">general loading guide</a>. Text files are one of the most common file types for storing a dataset. By defaul...
datasets/docs/source/nlp_load.mdx/0
{ "file_path": "datasets/docs/source/nlp_load.mdx", "repo_id": "datasets", "token_count": 482 }
113
## Overview To test deployment by docker-compose(Both standalone and cluster) * re-install milvus to check data persistence 1. Deploy Milvus 2. Insert data 3. Build index 4. Search 5. Stop Milvus 6. Repeat from step #1 * upgrade milvus to check data compatibility 1. Deploy Milvus (Previo...
milvus/tests/python_client/deploy/README.md/0
{ "file_path": "milvus/tests/python_client/deploy/README.md", "repo_id": "milvus", "token_count": 656 }
2,000
# Licensed to the Apache Software Foundation (ASF) 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 u...
milvus/internal/core/build-support/lintutils.py/0
{ "file_path": "milvus/internal/core/build-support/lintutils.py", "repo_id": "milvus", "token_count": 1296 }
1,637
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/mq/mqimpl/rocksmq/client/rmq_message.go/0
{ "file_path": "milvus/internal/mq/mqimpl/rocksmq/client/rmq_message.go", "repo_id": "milvus", "token_count": 498 }
1,726
# coding=utf-8 # Copyright 2021 The Google Flax Team Authors and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
transformers/src/transformers/models/electra/modeling_flax_electra.py/0
{ "file_path": "transformers/src/transformers/models/electra/modeling_flax_electra.py", "repo_id": "transformers", "token_count": 27232 }
658
<jupyter_start><jupyter_text>Déboguer le pipeline d'entraînementCe chapitre portant sur le débogage, la langue nous importe peu ici. Nous nous intéressons surtout à la logique du code pour comprendre d'où provient l'erreur. Installez les bibliothèques 🤗 Transformers et 🤗 Datasets pour exécuter ce *notebook*.<jupyter_...
notebooks/course/fr/chapter8/section4_tf.ipynb/0
{ "file_path": "notebooks/course/fr/chapter8/section4_tf.ipynb", "repo_id": "notebooks", "token_count": 806 }
273
import os from typing import Dict from exa_py import Exa # type: ignore from langchain_core.utils import convert_to_secret_str def initialize_client(values: Dict) -> Dict: """Initialize the client.""" exa_api_key = values.get("exa_api_key") or os.environ.get("EXA_API_KEY") or "" values["exa_api_key"] = ...
langchain/libs/partners/exa/langchain_exa/_utilities.py/0
{ "file_path": "langchain/libs/partners/exa/langchain_exa/_utilities.py", "repo_id": "langchain", "token_count": 238 }
642
xml_template = """{system_message} You have access to the following tools: {tools} In order to use a tool, you can use <tool></tool> and <tool_input></tool_input> tags. You will then get back a response in the form <observation></observation> For example, if you have a tool called 'search' that could run a google se...
opengpts/backend/app/agent_types/prompts.py/0
{ "file_path": "opengpts/backend/app/agent_types/prompts.py", "repo_id": "opengpts", "token_count": 236 }
2,017
# 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/mt5/test_modeling_tf_mt5.py/0
{ "file_path": "transformers/tests/models/mt5/test_modeling_tf_mt5.py", "repo_id": "transformers", "token_count": 819 }
758
import fnmatch import gc import os import shutil import tempfile import textwrap import time import unittest from io import BytesIO from pathlib import Path from unittest.mock import patch import numpy as np import pytest from huggingface_hub import DatasetCard, HfApi from datasets import ( Audio, ClassLabel,...
datasets/tests/test_upstream_hub.py/0
{ "file_path": "datasets/tests/test_upstream_hub.py", "repo_id": "datasets", "token_count": 22798 }
157
<jupyter_start><jupyter_text>Learned Prompt Variable Injection via RLLLM prompts can be enhanced by injecting specific terms into template sentences. Selecting the right terms is crucial for obtaining high-quality responses. This notebook introduces automated prompt engineering through term injection using Reinforcemen...
langchain/cookbook/learned_prompt_optimization.ipynb/0
{ "file_path": "langchain/cookbook/learned_prompt_optimization.ipynb", "repo_id": "langchain", "token_count": 8224 }
78
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-monsterapi/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-monsterapi/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,316
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/optimization/memory.md/0
{ "file_path": "diffusers/docs/source/en/optimization/memory.md", "repo_id": "diffusers", "token_count": 4134 }
193
<!--- 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 ...
datasets/notebooks/README.md/0
{ "file_path": "datasets/notebooks/README.md", "repo_id": "datasets", "token_count": 534 }
147
import { ChatOpenAI } from "@langchain/openai"; import { AgentExecutor } from "langchain/agents"; import { BaseMessageChunk } from "@langchain/core/messages"; import { AgentAction, AgentFinish } from "@langchain/core/agents"; import { RunnableSequence } from "@langchain/core/runnables"; import { ChatPromptTemplate } fr...
langchainjs/examples/src/tools/searxng_search.ts/0
{ "file_path": "langchainjs/examples/src/tools/searxng_search.ts", "repo_id": "langchainjs", "token_count": 601 }
853
"""Test deeplake indexes.""" from typing import List import pytest from llama_index.legacy.indices.vector_store.base import VectorStoreIndex from llama_index.legacy.schema import Document, TextNode from llama_index.legacy.service_context import ServiceContext from llama_index.legacy.storage.storage_context import Sto...
llama_index/llama-index-legacy/tests/indices/vector_store/test_deeplake.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/vector_store/test_deeplake.py", "repo_id": "llama_index", "token_count": 1847 }
1,666
<jupyter_start><jupyter_text>Sub Question Query EngineIn this tutorial, we showcase how to use a **sub question query engine** to tackle the problem of answering a complex query using multiple data sources. It first breaks down the complex query into sub questions for each relevant data source,then gather all the inte...
llama_index/docs/examples/query_engine/sub_question_query_engine.ipynb/0
{ "file_path": "llama_index/docs/examples/query_engine/sub_question_query_engine.ipynb", "repo_id": "llama_index", "token_count": 1200 }
1,209
from .auto_augment import RandAugment, AutoAugment, rand_augment_ops, auto_augment_policy,\ rand_augment_transform, auto_augment_transform from .config import resolve_data_config, resolve_model_data_config from .constants import * from .dataset import ImageDataset, IterableImageDataset, AugMixDataset from .dataset_...
pytorch-image-models/timm/data/__init__.py/0
{ "file_path": "pytorch-image-models/timm/data/__init__.py", "repo_id": "pytorch-image-models", "token_count": 256 }
381
from llama_index.tools.multion.base import MultionToolSpec __all__ = ["MultionToolSpec"]
llama_index/llama-index-integrations/tools/llama-index-tools-multion/llama_index/tools/multion/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-multion/llama_index/tools/multion/__init__.py", "repo_id": "llama_index", "token_count": 30 }
1,624
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-nebulagraph-query-engine/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-nebulagraph-query-engine/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,682
# 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/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/test_modeling_tf_{{cookiecutter.lowercase_modelname}}.py/0
{ "file_path": "transformers/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/test_modeling_tf_{{cookiecutter.lowercase_modelname}}.py", "repo_id": "transformers", "token_count": 17346 }
775
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base"; import type { VectorStoreInterface } from "@langchain/core/vectorstores"; import { Tool } from "@langchain/core/tools"; import { VectorDBQAChain } from "../chains/vector_db_qa.js"; /** * Interface for tools that interact with a Ve...
langchainjs/langchain/src/tools/vectorstore.ts/0
{ "file_path": "langchainjs/langchain/src/tools/vectorstore.ts", "repo_id": "langchainjs", "token_count": 520 }
1,025
<jupyter_start><jupyter_text>Infino>[Infino](https://github.com/infinohq/infino) is a scalable telemetry store designed for logs, metrics, and traces. Infino can function as a standalone observability solution or as the storage layer in your observability stack.This example shows how one can track the following while c...
langchain/docs/docs/integrations/callbacks/infino.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/callbacks/infino.ipynb", "repo_id": "langchain", "token_count": 2967 }
93
# IDEFICS Demos/examples ## Inference - [Normal inference](inference.py) (needs ~20GB GPU memory) - [4bit quantized inference](inference_4bit.py) (needs ~7GB GPU memory) ## Finetuning The following demos use the Image captioning task: - [PEFT (LORA) finetuning (notebook)](finetune_image_captioning_peft.ipynb) (fits...
notebooks/examples/idefics/README.md/0
{ "file_path": "notebooks/examples/idefics/README.md", "repo_id": "notebooks", "token_count": 148 }
317
use std::collections::HashMap; use crate::utils::wrap_err; use crate::{PyDType, PyTensor}; use candle_onnx::eval::{dtype, get_tensor, simple_eval}; use candle_onnx::onnx::tensor_proto::DataType; use candle_onnx::onnx::tensor_shape_proto::dimension::Value; use candle_onnx::onnx::type_proto::{Tensor as ONNXTensor, Value...
candle/candle-pyo3/src/onnx.rs/0
{ "file_path": "candle/candle-pyo3/src/onnx.rs", "repo_id": "candle", "token_count": 3266 }
68
<jupyter_start><jupyter_text>💬🤖 How to Build a ChatbotLlamaIndex serves as a bridge between your data and Language Learning Models (LLMs), providing a toolkit that enables you to establish a query interface around your data for a variety of tasks, such as question-answering and summarization.In this tutorial, we'll w...
llama_index/docs/examples/agent/Chatbot_SEC.ipynb/0
{ "file_path": "llama_index/docs/examples/agent/Chatbot_SEC.ipynb", "repo_id": "llama_index", "token_count": 2939 }
1,090
#!/usr/bin/env python import argparse import gc import os import sys from pathlib import Path from typing import List # noqa: F401 import pytorch_lightning as pl import torch from finetune import SummarizationModule, TranslationModule from finetune import main as ft_main from make_student import create_student_by_co...
transformers/examples/research_projects/seq2seq-distillation/distillation.py/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/distillation.py", "repo_id": "transformers", "token_count": 6315 }
537
#!/usr/bin/env python # Licensed to the Apache Software Foundation (ASF) 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 # "Li...
milvus/internal/core/build-support/run_clang_tidy.py/0
{ "file_path": "milvus/internal/core/build-support/run_clang_tidy.py", "repo_id": "milvus", "token_count": 2618 }
1,860
# coding=utf-8 # Copyright 2018 Mesh TensorFlow authors, T5 Authors and 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...
text-generation-inference/server/text_generation_server/models/custom_modeling/t5_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/t5_modeling.py", "repo_id": "text-generation-inference", "token_count": 22421 }
442
from typing import Optional import pytest from langchain_core.documents import Document from langchain_community.vectorstores import Qdrant from tests.integration_tests.vectorstores.fake_embeddings import ( ConsistentFakeEmbeddings, ) from tests.integration_tests.vectorstores.qdrant.async_api.fixtures import ( ...
langchain/libs/community/tests/integration_tests/vectorstores/qdrant/async_api/test_max_marginal_relevance.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/qdrant/async_api/test_max_marginal_relevance.py", "repo_id": "langchain", "token_count": 756 }
388
# 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 applicabl...
transformers/src/transformers/modeling_attn_mask_utils.py/0
{ "file_path": "transformers/src/transformers/modeling_attn_mask_utils.py", "repo_id": "transformers", "token_count": 9638 }
628
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/ko/training/lora.md/0
{ "file_path": "diffusers/docs/source/ko/training/lora.md", "repo_id": "diffusers", "token_count": 4733 }
180
"""Download.""" import json import os from pathlib import Path from typing import Any, Dict, List, Optional, Union import tqdm from llama_index.core.download.module import LLAMA_HUB_URL from llama_index.core.download.utils import ( get_file_content, get_file_content_bytes, get_source_files_list, initi...
llama_index/llama-index-core/llama_index/core/download/dataset.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/download/dataset.py", "repo_id": "llama_index", "token_count": 4096 }
1,252
<jupyter_start><jupyter_text>Simple Vector Store - Async Index Creation If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-readers-wikipedia !pip install llama-index import time # Helps asyncio run within Jupyter import nest_asyncio nest_as...
llama_index/docs/examples/vector_stores/AsyncIndexCreationDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/AsyncIndexCreationDemo.ipynb", "repo_id": "llama_index", "token_count": 1022 }
1,164
{ "name": "chat-ui", "version": "0.7.0", "private": true, "packageManager": "npm@9.5.0", "scripts": { "dev": "vite dev", "build": "vite build", "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./ts...
chat-ui/package.json/0
{ "file_path": "chat-ui/package.json", "repo_id": "chat-ui", "token_count": 1310 }
98
<jupyter_start><jupyter_text>Streaming for Chat Engine - Condense Question Mode Load documents, build the VectorStoreIndex<jupyter_code>import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout)) from llama_index.core im...
llama_index/docs/examples/customization/streaming/chat_engine_condense_question_stream_response.ipynb/0
{ "file_path": "llama_index/docs/examples/customization/streaming/chat_engine_condense_question_stream_response.ipynb", "repo_id": "llama_index", "token_count": 804 }
1,107
# flake8: noqa prompt_template = """Given the following question and context, return YES if the context is relevant to the question and NO if it isn't. > Question: {question} > Context: >>> {context} >>> > Relevant (YES / NO):"""
langchain/libs/langchain/langchain/retrievers/document_compressors/chain_filter_prompt.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/document_compressors/chain_filter_prompt.py", "repo_id": "langchain", "token_count": 69 }
566
# flake8: noqa """Prompts for PowerBI agent.""" POWERBI_PREFIX = """You are an agent designed to help users interact with a PowerBI Dataset. Agent has access to a tool that can write a query based on the question and then run those against PowerBI, Microsofts business intelligence tool. The questions from the users ...
langchain/libs/community/langchain_community/agent_toolkits/powerbi/prompt.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/powerbi/prompt.py", "repo_id": "langchain", "token_count": 655 }
232
from langchain_community.embeddings.bedrock import BedrockEmbeddings __all__ = ["BedrockEmbeddings"]
langchain/libs/langchain/langchain/embeddings/bedrock.py/0
{ "file_path": "langchain/libs/langchain/langchain/embeddings/bedrock.py", "repo_id": "langchain", "token_count": 32 }
499
python_sources()
llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-nebula/llama_index/graph_stores/nebula/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-nebula/llama_index/graph_stores/nebula/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,380
from langgraph.graph.graph import END, Graph from langgraph.graph.message import MessageGraph from langgraph.graph.state import StateGraph __all__ = ["END", "Graph", "StateGraph", "MessageGraph"]
langgraph/langgraph/graph/__init__.py/0
{ "file_path": "langgraph/langgraph/graph/__init__.py", "repo_id": "langgraph", "token_count": 54 }
1,004
from llama_index.readers.dashvector.base import DashVectorReader __all__ = ["DashVectorReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-dashvector/llama_index/readers/dashvector/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-dashvector/llama_index/readers/dashvector/__init__.py", "repo_id": "llama_index", "token_count": 29 }
1,354
import tempfile from typing import Dict, List, Tuple import torch from diffusers import LCMScheduler from diffusers.utils.testing_utils import torch_device from .test_schedulers import SchedulerCommonTest class LCMSchedulerTest(SchedulerCommonTest): scheduler_classes = (LCMScheduler,) forward_default_kwarg...
diffusers/tests/schedulers/test_scheduler_lcm.py/0
{ "file_path": "diffusers/tests/schedulers/test_scheduler_lcm.py", "repo_id": "diffusers", "token_count": 5668 }
282
import type { BaseRetrieverInterface } from "@langchain/core/retrievers"; import { ChatOpenAI } from "@langchain/openai"; import { BaseMessage, HumanMessage, isBaseMessage, } from "@langchain/core/messages"; import { ChainValues } from "@langchain/core/utils/types"; import { StringOutputParser } from "@langchain/...
langchainjs/langchain/src/experimental/chains/violation_of_expectations/violation_of_expectations_chain.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/chains/violation_of_expectations/violation_of_expectations_chain.ts", "repo_id": "langchainjs", "token_count": 5639 }
881