text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# coding=utf-8 # Copyright 2021 Iz Beltagy, Matthew E. Peters, Arman Cohan 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://w...
transformers/src/transformers/models/led/modeling_led.py/0
{ "file_path": "transformers/src/transformers/models/led/modeling_led.py", "repo_id": "transformers", "token_count": 59459 }
689
from typing import Any, Iterator, List, Sequence, cast from langchain_core.documents import BaseDocumentTransformer, Document class BeautifulSoupTransformer(BaseDocumentTransformer): """Transform HTML content by extracting specific tags and removing unwanted ones. Example: .. code-block:: python ...
langchain/libs/community/langchain_community/document_transformers/beautiful_soup_transformer.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_transformers/beautiful_soup_transformer.py", "repo_id": "langchain", "token_count": 2137 }
252
use crate::parallelism::*; use crate::tokenizer::{Offsets, Token}; use crate::utils::padding::PaddingDirection; use crate::utils::truncation::TruncationDirection; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::ops::Range; /// Represents the output of a `Tokenizer`. #[derive(Default, Parti...
tokenizers/tokenizers/src/tokenizer/encoding.rs/0
{ "file_path": "tokenizers/tokenizers/src/tokenizer/encoding.rs", "repo_id": "tokenizers", "token_count": 17197 }
435
use super::Pair; use rand::{thread_rng, Rng}; use std::cmp::Ordering; use std::collections::{BinaryHeap, HashMap}; #[derive(Debug, Eq)] struct Merge { pos: usize, rank: u32, new_id: u32, } impl PartialEq for Merge { fn eq(&self, other: &Self) -> bool { self.rank == other.rank && self.pos == ot...
tokenizers/tokenizers/src/models/bpe/word.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/bpe/word.rs", "repo_id": "tokenizers", "token_count": 6488 }
418
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/indices/common_tree/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/common_tree/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,562
import { AgentExecutor, ChatAgent } from "langchain/agents"; import { ConversationChain, LLMChain } from "langchain/chains"; import { ChatOpenAI } from "@langchain/openai"; import { BufferMemory } from "langchain/memory"; import { ChatPromptTemplate, HumanMessagePromptTemplate, MessagesPlaceholder, SystemMessag...
langchainjs/examples/src/chat/overview.ts/0
{ "file_path": "langchainjs/examples/src/chat/overview.ts", "repo_id": "langchainjs", "token_count": 1335 }
806
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 4321, "logprob": -8.6875, "text": "Test" ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama_load.json", "repo_id": "text-generation-inference", "token_count": 4901 }
423
import unittest from dataclasses import dataclass import pytest from accelerate.commands.config.config_args import SageMakerConfig from accelerate.utils import ComputeEnvironment from accelerate.utils.launch import _convert_nargs_to_dict @dataclass class MockLaunchConfig(SageMakerConfig): compute_environment = ...
accelerate/tests/test_sagemaker.py/0
{ "file_path": "accelerate/tests/test_sagemaker.py", "repo_id": "accelerate", "token_count": 851 }
19
python_tests()
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-wandb/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-wandb/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,265
// 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/merr/errors_test.go/0
{ "file_path": "milvus/pkg/util/merr/errors_test.go", "repo_id": "milvus", "token_count": 3285 }
1,918
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/auto/auto_factory.py/0
{ "file_path": "transformers/src/transformers/models/auto/auto_factory.py", "repo_id": "transformers", "token_count": 17510 }
618
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datacoord/channel_manager.go/0
{ "file_path": "milvus/internal/datacoord/channel_manager.go", "repo_id": "milvus", "token_count": 10709 }
1,789
import operator from typing import Annotated, Sequence, TypedDict, Union from langchain_core.agents import AgentAction, AgentFinish from langchain_core.messages import BaseMessage from langchain_core.runnables import RunnableLambda from langgraph.graph import END, StateGraph from langgraph.prebuilt.tool_executor impo...
langgraph/langgraph/prebuilt/agent_executor.py/0
{ "file_path": "langgraph/langgraph/prebuilt/agent_executor.py", "repo_id": "langgraph", "token_count": 1844 }
1,034
# 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...
transformers/src/transformers/onnx/convert.py/0
{ "file_path": "transformers/src/transformers/onnx/convert.py", "repo_id": "transformers", "token_count": 7864 }
760
package conc import ( "sync" "testing" "github.com/stretchr/testify/suite" "go.uber.org/atomic" ) type SingleflightSuite struct { suite.Suite } func (s *SingleflightSuite) TestDo() { counter, hasShared := atomic.Int32{}, atomic.Bool{} sf := Singleflight[any]{} ch := make(chan struct{}) var wg sync.WaitGro...
milvus/pkg/util/conc/singleflight_test.go/0
{ "file_path": "milvus/pkg/util/conc/singleflight_test.go", "repo_id": "milvus", "token_count": 836 }
1,898
"""OpenAI Agent. Simple wrapper around AgentRunner + OpenAIAgentWorker. For the legacy implementation see: ```python from llama_index.agent.legacy.openai.base import OpenAIAgent ``` """ from typing import ( Any, List, Optional, Type, ) from llama_index.agent.openai.step import OpenAIAgentWorker from...
llama_index/llama-index-integrations/agent/llama-index-agent-openai/llama_index/agent/openai/base.py/0
{ "file_path": "llama_index/llama-index-integrations/agent/llama-index-agent-openai/llama_index/agent/openai/base.py", "repo_id": "llama_index", "token_count": 1912 }
1,340
# 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/opt/test_modeling_tf_opt.py/0
{ "file_path": "transformers/tests/models/opt/test_modeling_tf_opt.py", "repo_id": "transformers", "token_count": 7496 }
779
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-apify/llama_index/readers/apify/dataset/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-apify/llama_index/readers/apify/dataset/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,288
{ "name": "docs", "version": "0.0.0", "private": true, "scripts": { "docusaurus": "docusaurus", "start": "rm -rf ./docs/api && docusaurus start", "build": "bash vercel_build.sh && rm -rf ./build && docusaurus build", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", "clear"...
langchain/docs/package.json/0
{ "file_path": "langchain/docs/package.json", "repo_id": "langchain", "token_count": 968 }
200
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-txtai/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-txtai/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,429
import { test, expect } from "@jest/globals"; import { AIMessage, HumanMessage } from "@langchain/core/messages"; import { LLMResult } from "@langchain/core/outputs"; import { BaseLLM } from "@langchain/core/language_models/llms"; import { ChatMessageHistory } from "@langchain/community/stores/message/in_memory"; imp...
langchainjs/langchain/src/memory/tests/entity_memory.test.ts/0
{ "file_path": "langchainjs/langchain/src/memory/tests/entity_memory.test.ts", "repo_id": "langchainjs", "token_count": 583 }
1,000
"""Base output parser class.""" from dataclasses import dataclass from typing import Any, Dict, Optional from llama_index.legacy.bridge.pydantic import Field from llama_index.legacy.core.query_pipeline.query_component import ( ChainableMixin, InputKeys, OutputKeys, QueryComponent, validate_and_con...
llama_index/llama-index-legacy/llama_index/legacy/output_parsers/base.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/output_parsers/base.py", "repo_id": "llama_index", "token_count": 731 }
1,746
[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.mypy] disallow_untyped_defs = true exclude = ["_static", "build", "examples", "notebooks", "venv"] ignore_missi...
llama_index/llama-index-integrations/readers/llama-index-readers-clickhouse/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-clickhouse/pyproject.toml", "repo_id": "llama_index", "token_count": 603 }
1,332
export const SQL_PREFIX = `You are an agent designed to interact with a SQL database. Given an input question, create a syntactically correct {dialect} query to run, then look at the results of the query and return the answer. Unless the user specifies a specific number of examples they wish to obtain, always limit you...
langchainjs/langchain/src/agents/toolkits/sql/prompt.ts/0
{ "file_path": "langchainjs/langchain/src/agents/toolkits/sql/prompt.ts", "repo_id": "langchainjs", "token_count": 299 }
948
from pymilvus import connections import sys sys.path.append("..") sys.path.append("../..") from common.milvus_sys import MilvusSys from utils import * def task_1(data_size, host): """ task_1: before upgrade: create collection and insert data with flush, create index, load and search after upgr...
milvus/tests/python_client/deploy/scripts/action_after_upgrade.py/0
{ "file_path": "milvus/tests/python_client/deploy/scripts/action_after_upgrade.py", "repo_id": "milvus", "token_count": 1526 }
2,180
# coding=utf-8 # Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) 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...
transformers/examples/research_projects/mm-imdb/utils_mmimdb.py/0
{ "file_path": "transformers/examples/research_projects/mm-imdb/utils_mmimdb.py", "repo_id": "transformers", "token_count": 2030 }
528
import json from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union from llama_index.core.base.llms.types import ( ChatMessage, ChatResponse, ChatResponseAsyncGen, ChatResponseGen, CompletionResponse, CompletionResponseAsyncGen, CompletionResponseGen, LLMMetadata,...
llama_index/llama-index-integrations/llms/llama-index-llms-rungpt/llama_index/llms/rungpt/base.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-rungpt/llama_index/llms/rungpt/base.py", "repo_id": "llama_index", "token_count": 5387 }
1,315
package proxy import ( "context" "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/internal/proto/internalpb" "github.com/milvus-io/milvus/pkg/common" "github.com/milvus-io/milvus/pkg/util/merr" "github.com/milvus-io/milvu...
milvus/internal/proxy/default_limit_reducer.go/0
{ "file_path": "milvus/internal/proxy/default_limit_reducer.go", "repo_id": "milvus", "token_count": 961 }
1,737
import { expect, test } from "@jest/globals"; import { CombiningOutputParser } from "../combining.js"; import { StructuredOutputParser } from "../structured.js"; import { RegexParser } from "../regex.js"; test("CombiningOutputParser", async () => { const parser = new CombiningOutputParser( StructuredOutputParse...
langchainjs/langchain/src/output_parsers/tests/combining.test.ts/0
{ "file_path": "langchainjs/langchain/src/output_parsers/tests/combining.test.ts", "repo_id": "langchainjs", "token_count": 983 }
939
# coding=utf-8 # Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, 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.or...
transformers/src/transformers/models/distilbert/modeling_flax_distilbert.py/0
{ "file_path": "transformers/src/transformers/models/distilbert/modeling_flax_distilbert.py", "repo_id": "transformers", "token_count": 14393 }
607
package writebuffer import ( "context" "sync" "time" "go.uber.org/zap" "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" "github.com/milvus-io/milvus/internal/datanode/metacache" "github.com/milvus-io/milvus/internal/datanode/syncmgr" "github.com/milvus-io/milvus/pkg/log" "github.com/milvus-io/milvus/pkg/...
milvus/internal/datanode/writebuffer/manager.go/0
{ "file_path": "milvus/internal/datanode/writebuffer/manager.go", "repo_id": "milvus", "token_count": 2689 }
1,784
<jupyter_start><jupyter_text>Benchmarking LLM Evaluators On The MT-Bench Human Judgement `LabelledPairwiseEvaluatorDataset` In this notebook guide, we benchmark Gemini and GPT models as LLM evaluators using a slightly adapted version of the MT-Bench Human Judgements dataset. For this dataset, human evaluators compare t...
llama_index/docs/examples/evaluation/mt_bench_human_judgement.ipynb/0
{ "file_path": "llama_index/docs/examples/evaluation/mt_bench_human_judgement.ipynb", "repo_id": "llama_index", "token_count": 2059 }
1,056
import multiprocessing import numbers import random import numpy import threading import pytest import pandas as pd import decimal from decimal import Decimal, getcontext from time import sleep import heapq from base.client_base import TestcaseBase from utils.util_log import test_log as log from common import common_f...
milvus/tests/python_client/milvus_client/test_milvus_client_alias.py/0
{ "file_path": "milvus/tests/python_client/milvus_client/test_milvus_client_alias.py", "repo_id": "milvus", "token_count": 10904 }
2,183
from langchain_community.document_loaders.merge import MergedDataLoader __all__ = ["MergedDataLoader"]
langchain/libs/langchain/langchain/document_loaders/merge.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/merge.py", "repo_id": "langchain", "token_count": 31 }
484
# adapted from https://github.com/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/image_captioning.ipynb # This example demonstrates normal finetuning (w/o peft) - for the sake of keeping the memory # requirements small it freezes the original pre-trained text and image layers to keep the memory # requirem...
notebooks/examples/idefics/finetune_image_captioning.py/0
{ "file_path": "notebooks/examples/idefics/finetune_image_captioning.py", "repo_id": "notebooks", "token_count": 1670 }
303
from typing import List import jieba from tokenizers import NormalizedString, PreTokenizedString, Regex, Tokenizer from tokenizers.decoders import Decoder from tokenizers.models import BPE from tokenizers.normalizers import Normalizer from tokenizers.pre_tokenizers import PreTokenizer class JiebaPreTokenizer: de...
tokenizers/bindings/python/examples/custom_components.py/0
{ "file_path": "tokenizers/bindings/python/examples/custom_components.py", "repo_id": "tokenizers", "token_count": 1293 }
460
from typing import Any, Callable, Dict, Optional, Sequence from llama_index.legacy.bridge.pydantic import Field, PrivateAttr from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.constants import DEFAULT_NUM_OUTPUTS from llama_index.legacy.core.llms.types import ( ChatMessage, ChatRe...
llama_index/llama-index-legacy/llama_index/legacy/llms/llama_api.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/llama_api.py", "repo_id": "llama_index", "token_count": 1971 }
1,680
import argparse import json import subprocess def get_runner_status(target_runners, token): offline_runners = [] cmd = ( f'curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer {token}"' " https://api.github.com/repos/huggingface/transformers/actions/runners" ) outpu...
transformers/utils/check_self_hosted_runner.py/0
{ "file_path": "transformers/utils/check_self_hosted_runner.py", "repo_id": "transformers", "token_count": 611 }
765
interactions: - request: body: '{"input": [[2059, 7341, 527, 264, 1912, 315, 658, 10753, 677, 81, 3581, 7795, 32971, 555, 264, 7558, 321, 351, 61798, 30535, 11, 4330, 311, 8254, 342, 484, 1776, 1220, 389, 279, 11314, 315, 279, 2010, 11, 323, 281, 1279, 278, 66079, 430, 527, 539, 75754, 311, 279, 2...
langchain/libs/community/tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_custom_index_from_documents.yaml/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_custom_index_from_documents.yaml", "repo_id": "langchain", "token_count": 31715 }
377
# NOTE timm.models.layers is DEPRECATED, please use timm.layers, this is here to reduce breakages in transition from timm.layers.activations import * from timm.layers.adaptive_avgmax_pool import \ adaptive_avgmax_pool2d, select_adaptive_pool2d, AdaptiveAvgMaxPool2d, SelectAdaptivePool2d from timm.layers.attention_p...
pytorch-image-models/timm/models/layers/__init__.py/0
{ "file_path": "pytorch-image-models/timm/models/layers/__init__.py", "repo_id": "pytorch-image-models", "token_count": 1240 }
374
<jupyter_start><jupyter_text>Cube Semantic Layer This notebook demonstrates the process of retrieving Cube's data model metadata in a format suitable for passing to LLMs as embeddings, thereby enhancing contextual information. About Cube [Cube](https://cube.dev/) is the Semantic Layer for building data apps. It helps ...
langchain/docs/docs/integrations/document_loaders/cube_semantic.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/cube_semantic.ipynb", "repo_id": "langchain", "token_count": 916 }
110
<jupyter_start><jupyter_text>RAGatouille[RAGatouille](https://github.com/bclavie/RAGatouille) makes it as simple as can be to use ColBERT! [ColBERT](https://github.com/stanford-futuredata/ColBERT) is a fast and accurate retrieval model, enabling scalable BERT-based search over large text collections in tens of millisec...
langchain/docs/docs/integrations/providers/ragatouille.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/providers/ragatouille.ipynb", "repo_id": "langchain", "token_count": 1104 }
143
package flag import ( "fmt" "github.com/spf13/cobra" ) const ( DefaultGRPCPort = 50051 ) func GRPCAddr(cmd *cobra.Command, conf *string) { cmd.Flags().StringVarP(conf, "grpc-addr", "g", fmt.Sprintf("0.0.0.0:%d", DefaultGRPCPort), "GRPC service bind address") }
chroma/go/coordinator/cmd/flag/flag.go/0
{ "file_path": "chroma/go/coordinator/cmd/flag/flag.go", "repo_id": "chroma", "token_count": 117 }
40
[tool.poetry] name = "rag-fusion" version = "0.0.1" description = "RAG using RAG fusion approach" authors = [] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "<2" pinecone-client = "^2.2.4" langchainhub = "^0.1.13" [tool.poetry.group.dev.dependencies] langchain-cli...
langchain/templates/rag-fusion/pyproject.toml/0
{ "file_path": "langchain/templates/rag-fusion/pyproject.toml", "repo_id": "langchain", "token_count": 271 }
654
"""Chains and utils related to evaluating question answering functionality.""" from langchain.evaluation.qa.eval_chain import ( ContextQAEvalChain, CotQAEvalChain, QAEvalChain, ) from langchain.evaluation.qa.generate_chain import QAGenerateChain __all__ = ["QAEvalChain", "QAGenerateChain", "ContextQAEvalCh...
langchain/libs/langchain/langchain/evaluation/qa/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/evaluation/qa/__init__.py", "repo_id": "langchain", "token_count": 115 }
512
from typing import Any, Optional from llama_index.legacy.storage.docstore.keyval_docstore import KVDocumentStore from llama_index.legacy.storage.docstore.types import DEFAULT_BATCH_SIZE from llama_index.legacy.storage.kvstore.redis_kvstore import RedisKVStore class RedisDocumentStore(KVDocumentStore): """Redis D...
llama_index/llama-index-legacy/llama_index/legacy/storage/docstore/redis_docstore.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/storage/docstore/redis_docstore.py", "repo_id": "llama_index", "token_count": 677 }
1,603
import argparse import logging import math import os import random from pathlib import Path import jax import jax.numpy as jnp import numpy as np import optax import torch import torch.utils.checkpoint import transformers from datasets import load_dataset from flax import jax_utils from flax.training import train_stat...
diffusers/examples/text_to_image/train_text_to_image_flax.py/0
{ "file_path": "diffusers/examples/text_to_image/train_text_to_image_flax.py", "repo_id": "diffusers", "token_count": 9855 }
220
# VisualBERT Demo This demo shows usage of VisualBERT VQA model and is adapted from LXMERT demo present [here](https://github.com/huggingface/transformers/blob/main/examples/research_projects/lxmert/demo.ipynb). 1. make a virtualenv: ``virtualenv venv`` and activate ``source venv/bin/activate`` 2. install reqs: ``pip ...
transformers/examples/research_projects/visual_bert/README.md/0
{ "file_path": "transformers/examples/research_projects/visual_bert/README.md", "repo_id": "transformers", "token_count": 127 }
556
<jupyter_start><jupyter_text>YandexGPTThis notebook goes over how to use Langchain with [YandexGPT](https://cloud.yandex.com/en/services/yandexgpt).To use, you should have the `yandexcloud` python package installed.<jupyter_code>%pip install --upgrade --quiet yandexcloud<jupyter_output><empty_output><jupyter_text>Firs...
langchain/docs/docs/integrations/llms/yandex.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/yandex.ipynb", "repo_id": "langchain", "token_count": 518 }
135
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-intercom/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-intercom/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,462
--- sidebar_position: 0 --- # Quick Start Language models take text as input - that text is commonly referred to as a prompt. Typically this is not simply a hardcoded string but rather a combination of a template, some examples, and user input. LangChain provides several classes and functions to make constructing and...
langchainjs/docs/core_docs/docs/modules/model_io/prompts/quick_start.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/prompts/quick_start.mdx", "repo_id": "langchainjs", "token_count": 2104 }
740
import { test } from "@jest/globals"; import { Writer } from "../writer.js"; test.skip("Test Writer", async () => { const model = new Writer({ maxTokens: 20 }); const res = await model.invoke("1 + 1 ="); console.log(res); }, 50000);
langchainjs/libs/langchain-community/src/llms/tests/writer.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/llms/tests/writer.int.test.ts", "repo_id": "langchainjs", "token_count": 80 }
1,004
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-langchain/llama_index/llms/langchain/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-langchain/llama_index/llms/langchain/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,356
from typing import Literal import pytest from llama_index.legacy.embeddings import FastEmbedEmbedding try: import fastembed except ImportError: fastembed = None # type: ignore @pytest.mark.skipif(fastembed is None, reason="fastembed is not installed") @pytest.mark.parametrize( "model_name", ["sentence-...
llama_index/llama-index-legacy/tests/embeddings/test_fastembed.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/embeddings/test_fastembed.py", "repo_id": "llama_index", "token_count": 671 }
1,616
import { test, expect } from "@jest/globals"; import { flattenObjectForWeaviate } from "../vectorstores.js"; test("flattenObjectForWeaviate", () => { expect( flattenObjectForWeaviate({ array2: [{}, "a"], deep: { string: "deep string", array: ["1", 2], array3: [1, 3], ...
langchainjs/libs/langchain-weaviate/src/tests/vectorstores.test.ts/0
{ "file_path": "langchainjs/libs/langchain-weaviate/src/tests/vectorstores.test.ts", "repo_id": "langchainjs", "token_count": 312 }
1,047
# LlamaIndex Postprocessor Integration: Sbert Rerank
llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-sbert-rerank/README.md/0
{ "file_path": "llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-sbert-rerank/README.md", "repo_id": "llama_index", "token_count": 14 }
1,299
package indexnode import ( "context" "fmt" "github.com/milvus-io/milvus/internal/proto/indexpb" "github.com/milvus-io/milvus/internal/storage" "github.com/milvus-io/milvus/pkg/util/typeutil" ) type StorageFactory interface { NewChunkManager(ctx context.Context, config *indexpb.StorageConfig) (storage.ChunkMana...
milvus/internal/indexnode/chunk_mgr_factory.go/0
{ "file_path": "milvus/internal/indexnode/chunk_mgr_factory.go", "repo_id": "milvus", "token_count": 552 }
1,719
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-weather/llama_index/readers/weather/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-weather/llama_index/readers/weather/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,430
from __future__ import annotations import json import logging from hashlib import sha1 from threading import Thread from typing import Any, Dict, Iterable, List, Optional, Tuple from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseSe...
langchain/libs/community/langchain_community/vectorstores/starrocks.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/starrocks.py", "repo_id": "langchain", "token_count": 8342 }
314
python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/agent/react/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/agent/react/BUILD", "repo_id": "llama_index", "token_count": 25 }
1,615
from typing import List from langchain_core.callbacks import CallbackManagerForRetrieverRun from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever from langchain_community.utilities.pubmed import PubMedAPIWrapper class PubMedRetriever(BaseRetriever, PubMedAPIWrapper): ...
langchain/libs/community/langchain_community/retrievers/pubmed.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/pubmed.py", "repo_id": "langchain", "token_count": 206 }
279
# Cloudflare >[Cloudflare, Inc. (Wikipedia)](https://en.wikipedia.org/wiki/Cloudflare) is an American company that provides > content delivery network services, cloud cybersecurity, DDoS mitigation, and ICANN-accredited > domain registration services. >[Cloudflare Workers AI](https://developers.cloudflare.com/worke...
langchain/docs/docs/integrations/providers/cloudflare.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/cloudflare.mdx", "repo_id": "langchain", "token_count": 190 }
129
# 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/utils/test_add_new_model_like.py/0
{ "file_path": "transformers/tests/utils/test_add_new_model_like.py", "repo_id": "transformers", "token_count": 25261 }
772
"""Test CPAL chain.""" import json import unittest from typing import Type from unittest import mock import pytest from langchain.output_parsers import PydanticOutputParser from langchain.prompts.prompt import PromptTemplate from langchain_community.llms import OpenAI from langchain_experimental import pydantic_v1 a...
langchain/libs/experimental/tests/integration_tests/chains/test_cpal.py/0
{ "file_path": "langchain/libs/experimental/tests/integration_tests/chains/test_cpal.py", "repo_id": "langchain", "token_count": 11014 }
429
[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 = ["StreamlitChatPack"] contains_example = false import_path = "llama_index.packs.streamlit_c...
llama_index/llama-index-packs/llama-index-packs-streamlit-chatbot/pyproject.toml/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-streamlit-chatbot/pyproject.toml", "repo_id": "llama_index", "token_count": 752 }
1,609
import type { createCluster, createClient } from "redis"; import { BaseCache, deserializeStoredGeneration, getCacheKey, serializeGeneration, } from "@langchain/core/caches"; import { Generation } from "@langchain/core/outputs"; /** * Represents the type of the Redis client used to interact with the Redis * ...
langchainjs/libs/langchain-redis/src/caches.ts/0
{ "file_path": "langchainjs/libs/langchain-redis/src/caches.ts", "repo_id": "langchainjs", "token_count": 907 }
1,066
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/using-diffusers/textual_inversion_inference.md/0
{ "file_path": "diffusers/docs/source/en/using-diffusers/textual_inversion_inference.md", "repo_id": "diffusers", "token_count": 1716 }
190
from langchain_community.document_loaders.docugami import ( DocugamiLoader, ) __all__ = [ "DocugamiLoader", ]
langchain/libs/langchain/langchain/document_loaders/docugami.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/docugami.py", "repo_id": "langchain", "token_count": 47 }
479
<jupyter_start><jupyter_text>Pinecone Vector Store - Metadata Filter If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-vector-stores-pinecone # !pip install llama-index>=0.9.31 pinecone-client>=3.0.0 import logging import sys import os logg...
llama_index/docs/examples/vector_stores/pinecone_metadata_filter.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/pinecone_metadata_filter.ipynb", "repo_id": "llama_index", "token_count": 2228 }
1,095
<jupyter_start><jupyter_text>Exporting LLM Runs and Feedback[](https://colab.research.google.com/github/langchain-ai/langsmith-cookbook/blob/main/exploratory-data-analysis/exporting-llm-runs-and-feedback/llm_run_etl.ipynb)Understanding how your LLM app interacts with users is crucial. LangSmith offers a number of usefu...
langsmith-cookbook/exploratory-data-analysis/exporting-llm-runs-and-feedback/llm_run_etl.ipynb/0
{ "file_path": "langsmith-cookbook/exploratory-data-analysis/exporting-llm-runs-and-feedback/llm_run_etl.ipynb", "repo_id": "langsmith-cookbook", "token_count": 2985 }
1,008
<jupyter_start><jupyter_text>Explain *Anything* Like I'm Five: A Model for Open Domain Long Form Question Answering--- Table of Contents 1. [**Introduction**](intro) a. [Preliminaries](prelims) b. [Note on Data and Biases](reddit_biases)2. [**Task and Data Description**](task_description) 3. [**Sparse Ret...
notebooks/longform-qa/Long_Form_Question_Answering_with_ELI5_and_Wikipedia.ipynb/0
{ "file_path": "notebooks/longform-qa/Long_Form_Question_Answering_with_ELI5_and_Wikipedia.ipynb", "repo_id": "notebooks", "token_count": 13060 }
313
from rag_vectara_multiquery.chain import chain __all__ = ["chain"]
langchain/templates/rag-vectara-multiquery/rag_vectara_multiquery/__init__.py/0
{ "file_path": "langchain/templates/rag-vectara-multiquery/rag_vectara_multiquery/__init__.py", "repo_id": "langchain", "token_count": 24 }
675
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-mangadex/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mangadex/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,394
import { ChatOpenAI } from "@langchain/openai"; import { HttpResponseOutputParser } from "langchain/output_parsers"; const handler = async () => { const parser = new HttpResponseOutputParser(); const model = new ChatOpenAI({ temperature: 0 }); const stream = await model.pipe(parser).stream("Hello there!"); ...
langchainjs/examples/src/prompts/http_response_output_parser.ts/0
{ "file_path": "langchainjs/examples/src/prompts/http_response_output_parser.ts", "repo_id": "langchainjs", "token_count": 152 }
857
<jupyter_start><jupyter_text>Sentence Transformers on Hugging Face>[Hugging Face sentence-transformers](https://huggingface.co/sentence-transformers) is a Python framework for state-of-the-art sentence, text and image embeddings.>One of the embedding models is used in the `HuggingFaceEmbeddings` class.>We have also add...
langchain/docs/docs/integrations/text_embedding/sentence_transformers.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/sentence_transformers.ipynb", "repo_id": "langchain", "token_count": 313 }
167
# The Bellman Equation: simplify our value estimation [[bellman-equation]] The Bellman equation **simplifies our state value or state-action value calculation.** <img src="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit3/bellman.jpg" alt="Bellman equation"/> With what w...
deep-rl-class/units/en/unit2/bellman-equation.mdx/0
{ "file_path": "deep-rl-class/units/en/unit2/bellman-equation.mdx", "repo_id": "deep-rl-class", "token_count": 1247 }
176
import { resolve, dirname } from "node:path"; import { fileURLToPath } from "node:url"; /** * @param {string} relativePath * @returns {string} */ function abs(relativePath) { return resolve(dirname(fileURLToPath(import.meta.url)), relativePath); } export const config = { internals: [/node\:/, /@langchain\/cor...
langchainjs/libs/langchain-anthropic/langchain.config.js/0
{ "file_path": "langchainjs/libs/langchain-anthropic/langchain.config.js", "repo_id": "langchainjs", "token_count": 170 }
1,011
// Code generated by mockery v2.32.4. DO NOT EDIT. package segments import ( context "context" commonpb "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" datapb "github.com/milvus-io/milvus/internal/proto/datapb" mock "github.com/stretchr/testify/mock" pkoracle "github.com/milvus-io/milvus/internal/quer...
milvus/internal/querynodev2/segments/mock_loader.go/0
{ "file_path": "milvus/internal/querynodev2/segments/mock_loader.go", "repo_id": "milvus", "token_count": 4275 }
1,769
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/blenderbot_small/test_modeling_tf_blenderbot_small.py/0
{ "file_path": "transformers/tests/models/blenderbot_small/test_modeling_tf_blenderbot_small.py", "repo_id": "transformers", "token_count": 4273 }
704
// 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/cmd/components/query_coord.go/0
{ "file_path": "milvus/cmd/components/query_coord.go", "repo_id": "milvus", "token_count": 776 }
1,838
import os import tempfile from typing import Any, Iterator, List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader from langchain_community.document_loaders.unstructured import UnstructuredFileLoader class TencentCOSFileLoader(BaseLoader): """Load fro...
langchain/libs/community/langchain_community/document_loaders/tencent_cos_file.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/tencent_cos_file.py", "repo_id": "langchain", "token_count": 726 }
269
"""Chain for applying constitutional principles to the outputs of another chain.""" from typing import Any, Dict, List, Optional from langchain_core.callbacks import CallbackManagerForChainRun from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import BasePromptTemplate from langc...
langchain/libs/langchain/langchain/chains/constitutional_ai/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/constitutional_ai/base.py", "repo_id": "langchain", "token_count": 2888 }
458
python_sources()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-sagemaker-endpoint/llama_index/embeddings/sagemaker_endpoint/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-sagemaker-endpoint/llama_index/embeddings/sagemaker_endpoint/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,255
FROM python:3.11-buster RUN pip install poetry==1.5.1 RUN poetry config virtualenvs.create false COPY ./pyproject.toml ./poetry.lock* ./ RUN poetry install --no-interaction --no-ansi --no-root --no-directory COPY ./*.py ./ RUN poetry install --no-interaction --no-ansi CMD exec uvicorn main:app --host 0.0.0.0 --...
chat-langchain/Dockerfile/0
{ "file_path": "chat-langchain/Dockerfile", "repo_id": "chat-langchain", "token_count": 128 }
5
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/docs/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/docs/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,346
from langchain_community.tools.memorize.tool import Memorize, TrainableLLM __all__ = ["TrainableLLM", "Memorize"]
langchain/libs/langchain/langchain/tools/memorize/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/memorize/tool.py", "repo_id": "langchain", "token_count": 39 }
560
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lice...
transformers/src/transformers/models/deprecated/transfo_xl/configuration_transfo_xl.py/0
{ "file_path": "transformers/src/transformers/models/deprecated/transfo_xl/configuration_transfo_xl.py", "repo_id": "transformers", "token_count": 3230 }
602
from llama_index.readers.twitter.base import TwitterTweetReader __all__ = ["TwitterTweetReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-twitter/llama_index/readers/twitter/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-twitter/llama_index/readers/twitter/__init__.py", "repo_id": "llama_index", "token_count": 28 }
1,451
# 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/test_modeling_flax_common.py/0
{ "file_path": "transformers/tests/test_modeling_flax_common.py", "repo_id": "transformers", "token_count": 25154 }
859
// Audio processing code, adapted from whisper.cpp // https://github.com/ggerganov/whisper.cpp use candle::utils::get_num_threads; use std::sync::Arc; use std::thread; pub trait Float: num_traits::Float + num_traits::FloatConst + num_traits::NumAssign + Send + Sync { } impl Float for f32 {} impl Float for f64 {}...
candle/candle-transformers/src/models/whisper/audio.rs/0
{ "file_path": "candle/candle-transformers/src/models/whisper/audio.rs", "repo_id": "candle", "token_count": 5281 }
78
python_sources()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-clarifai/llama_index/embeddings/clarifai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-clarifai/llama_index/embeddings/clarifai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,236
"""Loader that uses Playwright to load a page, then uses unstructured to load the html. """ import logging from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Dict, List, Optional from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader if TYPE_...
langchain/libs/community/langchain_community/document_loaders/url_playwright.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/url_playwright.py", "repo_id": "langchain", "token_count": 3611 }
264
package model import "github.com/milvus-io/milvus/internal/proto/querypb" type CollectionLoadInfo struct { CollectionID int64 PartitionIDs []int64 ReleasedPartitionIDs []int64 LoadType querypb.LoadType LoadPercentage int64 Status querypb.LoadStatus ReplicaNumber ...
milvus/internal/metastore/model/load_info.go/0
{ "file_path": "milvus/internal/metastore/model/load_info.go", "repo_id": "milvus", "token_count": 257 }
1,728
python_tests( name="tests", )
llama_index/llama-index-finetuning/tests/gradient/BUILD/0
{ "file_path": "llama_index/llama-index-finetuning/tests/gradient/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,337
# coding=utf-8 # Copyright 2021 The I-BERT Authors (Sehoon Kim, Amir Gholami, Zhewei Yao, # Michael Mahoney, Kurt Keutzer - UC Berkeley) and The HuggingFace Inc. team. # Copyright (c) 20121, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use t...
transformers/src/transformers/models/ibert/quant_modules.py/0
{ "file_path": "transformers/src/transformers/models/ibert/quant_modules.py", "repo_id": "transformers", "token_count": 13544 }
646
.. _Ref-Prompt-Helper: PromptHelper ================= .. automodule:: llama_index.core.indices.prompt_helper :members: :inherited-members:
llama_index/docs/api_reference/service_context/prompt_helper.rst/0
{ "file_path": "llama_index/docs/api_reference/service_context/prompt_helper.rst", "repo_id": "llama_index", "token_count": 56 }
1,036
# IORedis This example demonstrates how to setup chat history storage using the `RedisByteStore` `BaseStore` integration. ## Setup ```bash npm2yarn npm install ioredis ``` ## Usage import CodeBlock from "@theme/CodeBlock"; import Example from "@examples/stores/ioredis_storage.ts"; <CodeBlock language="typescript"...
langchainjs/docs/core_docs/docs/integrations/stores/ioredis_storage.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/stores/ioredis_storage.mdx", "repo_id": "langchainjs", "token_count": 106 }
711
<jupyter_start><jupyter_text>Qdrant Vector Store - Default Qdrant Filters Example on how to use Filters from the qdrant_client SDK directly in your Retriever / Query Engine<jupyter_code>%pip install llama-index-vector-stores-qdrant !pip3 install llama-index qdrant_client import openai import qdrant_client from IPython....
llama_index/docs/examples/vector_stores/Qdrant_using_qdrant_filters.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/Qdrant_using_qdrant_filters.ipynb", "repo_id": "llama_index", "token_count": 1303 }
1,148
# coding=utf-8 # Copyright 2022 The REALM 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 # # Unless ...
transformers/src/transformers/models/realm/retrieval_realm.py/0
{ "file_path": "transformers/src/transformers/models/realm/retrieval_realm.py", "repo_id": "transformers", "token_count": 2788 }
721
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-lancedb/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-lancedb/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,521