text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# candle-quantized-llama: Fast Inference of quantized LLaMA models This example provides a quantized LLaMA model similar to [llama.cpp](https://github.com/ggerganov/llama.cpp). This is based on candle built-in quantization methods. Supported features include: - 2-bit, 3-bit, 4-bit, 5-bit, 6-bit and 8-bit integer quan...
candle/candle-examples/examples/quantized/README.md/0
{ "file_path": "candle/candle-examples/examples/quantized/README.md", "repo_id": "candle", "token_count": 820 }
53
"""Base interface for loading large language model APIs.""" import json from pathlib import Path from typing import Union import yaml from langchain_core.language_models.llms import BaseLLM from langchain_community.llms import get_type_to_cls_dict def load_llm_from_config(config: dict) -> BaseLLM: """Load LLM f...
langchain/libs/community/langchain_community/llms/loading.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/loading.py", "repo_id": "langchain", "token_count": 542 }
269
//! A sequential layer used to chain multiple layers and closures. use candle::{Module, Result, Tensor}; /// A sequential layer combining multiple other layers. pub struct Sequential { layers: Vec<Box<dyn Module>>, } /// Creates a new empty sequential layer. pub fn seq() -> Sequential { Sequential { layers: v...
candle/candle-nn/src/sequential.rs/0
{ "file_path": "candle/candle-nn/src/sequential.rs", "repo_id": "candle", "token_count": 705 }
58
<jupyter_start><jupyter_text>Time Series DatasetsThis notebook shows how to create a time series dataset from some csv file in order to then share it on the [🤗 hub](https://huggingface.co/docs/datasets/index). We will use the GluonTS library to read the csv into the appropriate format. We start by installing the libra...
notebooks/examples/time_series_datasets.ipynb/0
{ "file_path": "notebooks/examples/time_series_datasets.ipynb", "repo_id": "notebooks", "token_count": 975 }
309
package paramtable type httpConfig struct { Enabled ParamItem `refreshable:"false"` DebugMode ParamItem `refreshable:"false"` Port ParamItem `refreshable:"false"` AcceptTypeAllowInt64 ParamItem `refreshable:"false"` EnablePprof ParamItem `refreshable:"false"` Requ...
milvus/pkg/util/paramtable/http_param.go/0
{ "file_path": "milvus/pkg/util/paramtable/http_param.go", "repo_id": "milvus", "token_count": 755 }
1,977
import json import urllib.request from typing import List, Optional from langchain_core.documents import Document from langchain_core.utils import get_from_env, stringify_dict from langchain_community.document_loaders.base import BaseLoader STRIPE_ENDPOINTS = { "balance_transactions": "https://api.stripe.com/v1/...
langchain/libs/community/langchain_community/document_loaders/stripe.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/stripe.py", "repo_id": "langchain", "token_count": 738 }
250
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 1724, "logprob": -10.734375, "text": "What" ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_medusa/test_flash_medusa_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_medusa/test_flash_medusa_load.json", "repo_id": "text-generation-inference", "token_count": 5726 }
384
[tool.poetry] name = "summarize-anthropic" version = "0.1.0" description = "This template uses Anthropic's `Claude2` to summarize long documents." authors = [ "Lance Martin <lance@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" anthropic = ">=0.5.0" lan...
langchain/templates/summarize-anthropic/pyproject.toml/0
{ "file_path": "langchain/templates/summarize-anthropic/pyproject.toml", "repo_id": "langchain", "token_count": 291 }
714
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/unittest/test_group_by.cpp/0
{ "file_path": "milvus/internal/core/unittest/test_group_by.cpp", "repo_id": "milvus", "token_count": 12121 }
1,952
export { BaseMessagePromptTemplate, type MessagesPlaceholderFields as MessagePlaceholderFields, MessagesPlaceholder, type MessageStringPromptTemplateFields, BaseMessageStringPromptTemplate, BaseChatPromptTemplate, type ChatMessagePromptTemplateFields, ChatMessagePromptTemplate, HumanMessagePromptTempl...
langchainjs/langchain/src/prompts/chat.ts/0
{ "file_path": "langchainjs/langchain/src/prompts/chat.ts", "repo_id": "langchainjs", "token_count": 178 }
940
from typing import Any from llama_index.core.base.llms.types import ( ChatMessage, CompletionResponse, CompletionResponseGen, LLMMetadata, ) from llama_index.core.llms.custom import CustomLLM class TestLLM(CustomLLM): __test__ = False def __init__(self) -> None: super().__init__(call...
llama_index/llama-index-core/tests/llms/test_custom.py/0
{ "file_path": "llama_index/llama-index-core/tests/llms/test_custom.py", "repo_id": "llama_index", "token_count": 762 }
1,193
use anyhow::Result; use candle_core::{Device, IndexOp, Tensor}; #[test] fn integer_index() -> Result<()> { let dev = Device::Cpu; let tensor = Tensor::arange(0u32, 2 * 3, &dev)?.reshape((2, 3))?; let result = tensor.i(1)?; assert_eq!(result.dims(), &[3]); assert_eq!(result.to_vec1::<u32>()?, &[3, ...
candle/candle-core/tests/indexing_tests.rs/0
{ "file_path": "candle/candle-core/tests/indexing_tests.rs", "repo_id": "candle", "token_count": 1994 }
43
import { MouseEventHandler } from "react"; export function DefaultQuestion(props: { question: string; onMouseUp: MouseEventHandler; }) { return ( <div onMouseUp={props.onMouseUp} className="bg-stone-700 px-2 py-1 mx-2 rounded cursor-pointer justify-center text-stone-200 hover:bg-stone-500 mb-2" ...
weblangchain/nextjs/app/components/DefaultQuestion.tsx/0
{ "file_path": "weblangchain/nextjs/app/components/DefaultQuestion.tsx", "repo_id": "weblangchain", "token_count": 146 }
1,996
# coding=utf-8 # Copyright 2018 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/auto/modeling_flax_auto.py/0
{ "file_path": "transformers/src/transformers/models/auto/modeling_flax_auto.py", "repo_id": "transformers", "token_count": 6111 }
570
<jupyter_start><jupyter_text>CerebriumAI`Cerebrium` is an AWS Sagemaker alternative. It also provides API access to [several LLM models](https://docs.cerebrium.ai/cerebrium/prebuilt-models/deployment).This notebook goes over how to use Langchain with [CerebriumAI](https://docs.cerebrium.ai/introduction). Install cereb...
langchain/docs/docs/integrations/llms/cerebriumai.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/cerebriumai.ipynb", "repo_id": "langchain", "token_count": 629 }
127
poetry_requirements( name="poetry", )
llama_index/llama-index-experimental/BUILD/0
{ "file_path": "llama_index/llama-index-experimental/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,172
import time from typing import List from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document from selenium import webdriver from selenium.common.exceptions import WebDriverException from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_cond...
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/whole_site/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/whole_site/base.py", "repo_id": "llama_index", "token_count": 2080 }
1,394
from llama_index.core.readers.base import BaseReader from llama_index.readers.spotify import SpotifyReader def test_class(): names_of_base_classes = [b.__name__ for b in SpotifyReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-spotify/tests/test_readers_spotify.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-spotify/tests/test_readers_spotify.py", "repo_id": "llama_index", "token_count": 86 }
1,528
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_default_index_from_documents.yaml/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/cassettes/test_elasticsearch/TestElasticsearch.test_default_index_from_documents.yaml", "repo_id": "langchain", "token_count": 31680 }
369
export * from "@langchain/core/utils/stream";
langchainjs/langchain/src/util/stream.ts/0
{ "file_path": "langchainjs/langchain/src/util/stream.ts", "repo_id": "langchainjs", "token_count": 14 }
920
import os from typing import Any, Callable, Dict, Optional, Sequence from llama_index.core.base.llms.types import ( ChatMessage, ChatResponse, ChatResponseAsyncGen, ChatResponseGen, CompletionResponse, CompletionResponseAsyncGen, CompletionResponseGen, LLMMetadata, ) from llama_index.co...
llama_index/llama-index-integrations/llms/llama-index-llms-clarifai/llama_index/llms/clarifai/base.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-clarifai/llama_index/llms/clarifai/base.py", "repo_id": "llama_index", "token_count": 3265 }
1,392
from llama_index.vector_stores.lantern.base import LanternVectorStore __all__ = ["LanternVectorStore"]
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-lantern/llama_index/vector_stores/lantern/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-lantern/llama_index/vector_stores/lantern/__init__.py", "repo_id": "llama_index", "token_count": 32 }
1,522
<jupyter_start><jupyter_text>CitationsHow can we get a model to cite which parts of the source documents it referenced in its response?To explore some techniques for extracting citations, let's first create a simple RAG chain. To start we'll just retrieve from Wikipedia using the [WikipediaRetriever](https://api.python...
langchain/docs/docs/use_cases/question_answering/citations.ipynb/0
{ "file_path": "langchain/docs/docs/use_cases/question_answering/citations.ipynb", "repo_id": "langchain", "token_count": 4929 }
213
<jupyter_start><jupyter_text>Self-checking chainThis notebook showcases how to use LLMCheckerChain.<jupyter_code>from langchain.chains import LLMCheckerChain from langchain_openai import OpenAI llm = OpenAI(temperature=0.7) text = "What type of mammal lays the biggest eggs?" checker_chain = LLMCheckerChain.from_llm(...
langchain/cookbook/llm_checker.ipynb/0
{ "file_path": "langchain/cookbook/llm_checker.ipynb", "repo_id": "langchain", "token_count": 199 }
78
"""Vector stores.""" from llama_index.legacy.vector_stores.astra import AstraDBVectorStore from llama_index.legacy.vector_stores.awadb import AwaDBVectorStore from llama_index.legacy.vector_stores.azureaisearch import ( AzureAISearchVectorStore, CognitiveSearchVectorStore, ) from llama_index.legacy.vector_stor...
llama_index/llama-index-legacy/llama_index/legacy/vector_stores/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/vector_stores/__init__.py", "repo_id": "llama_index", "token_count": 1529 }
1,722
import { AutoGPT } from "langchain/experimental/autogpt"; import { ReadFileTool, WriteFileTool } from "langchain/tools"; import { NodeFileStore } from "langchain/stores/file/node"; import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { OpenAIEmbeddings, ChatOpenAI } from "@langchain/openai"; impo...
langchainjs/examples/src/experimental/autogpt/weather.ts/0
{ "file_path": "langchainjs/examples/src/experimental/autogpt/weather.ts", "repo_id": "langchainjs", "token_count": 1178 }
835
# coding=utf-8 # Copyright 2018 The OpenAI Team Authors and 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 License. # You may obtain a copy of the License...
transformers/src/transformers/models/albert/modeling_tf_albert.py/0
{ "file_path": "transformers/src/transformers/models/albert/modeling_tf_albert.py", "repo_id": "transformers", "token_count": 29581 }
641
from langchain_community.document_loaders.s3_file import S3FileLoader __all__ = ["S3FileLoader"]
langchain/libs/langchain/langchain/document_loaders/s3_file.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/s3_file.py", "repo_id": "langchain", "token_count": 33 }
493
<jupyter_start><jupyter_text>CSV parserThis output parser can be used when you want to return a list of comma-separated items.<jupyter_code>from langchain.output_parsers import CommaSeparatedListOutputParser from langchain.prompts import PromptTemplate from langchain_openai import ChatOpenAI output_parser = CommaSepar...
langchain/docs/docs/modules/model_io/output_parsers/types/csv.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/output_parsers/types/csv.ipynb", "repo_id": "langchain", "token_count": 284 }
207
python_sources()
llama_index/llama-index-experimental/llama_index/experimental/param_tuner/BUILD/0
{ "file_path": "llama_index/llama-index-experimental/llama_index/experimental/param_tuner/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,249
<jupyter_start><jupyter_text>Bedrock EmbeddingsIf you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-embeddings-bedrock import os from llama_index.embeddings.bedrock import BedrockEmbedding embed_model = BedrockEmbedding.from_credentials( a...
llama_index/docs/examples/embeddings/bedrock.ipynb/0
{ "file_path": "llama_index/docs/examples/embeddings/bedrock.ipynb", "repo_id": "llama_index", "token_count": 949 }
1,097
import os import shutil from overrides import override import pickle from typing import Dict, List, Optional, Sequence, Set, cast from chromadb.config import System from chromadb.segment.impl.vector.batch import Batch from chromadb.segment.impl.vector.hnsw_params import PersistentHnswParams from chromadb.segment.impl.v...
chroma/chromadb/segment/impl/vector/local_persistent_hnsw.py/0
{ "file_path": "chroma/chromadb/segment/impl/vector/local_persistent_hnsw.py", "repo_id": "chroma", "token_count": 9232 }
23
import CodeBlock from "@theme/CodeBlock"; import DebuggingExample from "@examples/models/llm/llm_debugging.ts"; # Subscribing to events Especially when using an agent, there can be a lot of back-and-forth going on behind the scenes as a LLM processes a prompt. For agents, the response object contains an intermediateS...
langchainjs/docs/core_docs/docs/modules/model_io/llms/subscribing_events.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/llms/subscribing_events.mdx", "repo_id": "langchainjs", "token_count": 265 }
762
"""Elasticsearch vector store.""" import asyncio import uuid from logging import getLogger from typing import Any, Callable, Dict, List, Literal, Optional, Union, cast import nest_asyncio import numpy as np from llama_index.legacy.bridge.pydantic import PrivateAttr from llama_index.legacy.schema import BaseNode, Met...
llama_index/llama-index-legacy/llama_index/legacy/vector_stores/elasticsearch.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/vector_stores/elasticsearch.py", "repo_id": "llama_index", "token_count": 10270 }
1,653
from elasticsearch import Elasticsearch # Setup Elasticsearch # This shows how to set it up for a cloud hosted version # Password for the 'elastic' user generated by Elasticsearch ELASTIC_PASSWORD = "..." # Found in the 'Manage Deployment' page CLOUD_ID = "..." # Create the client instance db = Elasticsearch(cloud_...
langchain/templates/elastic-query-generator/ingest.py/0
{ "file_path": "langchain/templates/elastic-query-generator/ingest.py", "repo_id": "langchain", "token_count": 257 }
634
// 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/test_helper.go/0
{ "file_path": "milvus/internal/mq/mqimpl/rocksmq/client/test_helper.go", "repo_id": "milvus", "token_count": 690 }
2,003
DB = 'test' UNIQUE_ID_COLLECTION = 'unique_id' DOC_COLLECTION = 'doc'
milvus/tests/benchmark/milvus_benchmark/metrics/config.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/metrics/config.py", "repo_id": "milvus", "token_count": 32 }
1,863
# Copyright 2021 AlQuraishi Laboratory # Copyright 2021 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
transformers/src/transformers/models/esm/openfold_utils/feats.py/0
{ "file_path": "transformers/src/transformers/models/esm/openfold_utils/feats.py", "repo_id": "transformers", "token_count": 3763 }
685
"""Arxiv API toolkit."""
langchain/libs/community/langchain_community/tools/arxiv/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/arxiv/__init__.py", "repo_id": "langchain", "token_count": 10 }
283
import { OpenAI } from "@langchain/openai"; const model = new OpenAI({ temperature: 1 }); const controller = new AbortController(); // Call `controller.abort()` somewhere to cancel the request. const res = await model.call( "What would be a good name for a company that makes colorful socks?", { signal: controlle...
langchainjs/examples/src/models/llm/llm_cancellation.ts/0
{ "file_path": "langchainjs/examples/src/models/llm/llm_cancellation.ts", "repo_id": "langchainjs", "token_count": 116 }
808
import time import copy import logging import numpy as np from milvus_benchmark import parser from milvus_benchmark.runners import utils from milvus_benchmark.runners.base import BaseRunner logger = logging.getLogger("milvus_benchmark.runners.accuracy") INSERT_INTERVAL = 50000 class AccuracyRunner(BaseRunner): ...
milvus/tests/benchmark/milvus_benchmark/runners/accuracy.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/runners/accuracy.py", "repo_id": "milvus", "token_count": 7527 }
1,864
from langchain_community.utilities.dalle_image_generator import DallEAPIWrapper __all__ = ["DallEAPIWrapper"]
langchain/libs/langchain/langchain/utilities/dalle_image_generator.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/dalle_image_generator.py", "repo_id": "langchain", "token_count": 38 }
564
from langchain_community.chat_loaders.gmail import ( GMailLoader, ) __all__ = ["GMailLoader"]
langchain/libs/langchain/langchain/chat_loaders/gmail.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_loaders/gmail.py", "repo_id": "langchain", "token_count": 36 }
471
#!/usr/bin/env python # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
transformers/src/transformers/tools/prompts.py/0
{ "file_path": "transformers/src/transformers/tools/prompts.py", "repo_id": "transformers", "token_count": 541 }
732
import collections.abc import math import re from collections import defaultdict from itertools import chain from typing import Any, Callable, Dict, Iterator, Tuple, Type, Union import torch from torch import nn as nn from torch.utils.checkpoint import checkpoint __all__ = ['model_parameters', 'named_apply', 'named_m...
pytorch-image-models/timm/models/_manipulate.py/0
{ "file_path": "pytorch-image-models/timm/models/_manipulate.py", "repo_id": "pytorch-image-models", "token_count": 4393 }
373
python_sources()
llama_index/llama-index-core/llama_index/core/vector_stores/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/vector_stores/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,145
#!/usr/bin/env python # coding=utf-8 # Copyright 2021 The HuggingFace Team All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
transformers/examples/flax/question-answering/run_qa.py/0
{ "file_path": "transformers/examples/flax/question-answering/run_qa.py", "repo_id": "transformers", "token_count": 20092 }
541
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/src/segcore/ScalarIndex.h/0
{ "file_path": "milvus/internal/core/src/segcore/ScalarIndex.h", "repo_id": "milvus", "token_count": 730 }
1,935
import datetime import json from pathlib import Path from typing import List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader def concatenate_rows(row: dict) -> str: """Combine message information in a readable format ready to be used. Args: ...
langchain/libs/community/langchain_community/document_loaders/facebook_chat.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/facebook_chat.py", "repo_id": "langchain", "token_count": 500 }
249
# Wide ResNet **Wide Residual Networks** are a variant on [ResNets](https://paperswithcode.com/method/resnet) where we decrease depth and increase the width of residual networks. This is achieved through the use of [wide residual blocks](https://paperswithcode.com/method/wide-residual-block). ## How do I use this mod...
pytorch-image-models/docs/models/wide-resnet.md/0
{ "file_path": "pytorch-image-models/docs/models/wide-resnet.md", "repo_id": "pytorch-image-models", "token_count": 2032 }
322
from numpy.core.fromnumeric import _partition_dispatcher import pytest import sys from pymilvus import DefaultConfig from base.database_wrapper import ApiDatabaseWrapper sys.path.append("..") from base.connections_wrapper import ApiConnectionsWrapper from base.collection_wrapper import ApiCollectionWrapper from base....
milvus/tests/python_client/base/client_base.py/0
{ "file_path": "milvus/tests/python_client/base/client_base.py", "repo_id": "milvus", "token_count": 9447 }
1,961
from collections import defaultdict from typing import Any, DefaultDict, Dict, List, Literal, Optional, Set import nest_asyncio from llama_index.core.callbacks.base_handler import BaseCallbackHandler from llama_index.core.callbacks.schema import ( CBEvent, CBEventType, ) class UpTrainDataSchema: """UpTr...
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-uptrain/llama_index/callbacks/uptrain/base.py/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-uptrain/llama_index/callbacks/uptrain/base.py", "repo_id": "llama_index", "token_count": 6405 }
1,215
from llama_index.postprocessor.longllmlingua.base import LongLLMLinguaPostprocessor __all__ = ["LongLLMLinguaPostprocessor"]
llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-longllmlingua/llama_index/postprocessor/longllmlingua/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-longllmlingua/llama_index/postprocessor/longllmlingua/__init__.py", "repo_id": "llama_index", "token_count": 40 }
1,352
import pRetry from "p-retry"; import { CallbackManager, CallbackManagerForChainRun, } from "../callbacks/manager.js"; import { LogStreamCallbackHandler, LogStreamCallbackHandlerInput, RunLog, RunLogPatch, StreamEvent, StreamEventData, } from "../tracers/log_stream.js"; import { Serializable } from "../...
langchainjs/langchain-core/src/runnables/base.ts/0
{ "file_path": "langchainjs/langchain-core/src/runnables/base.ts", "repo_id": "langchainjs", "token_count": 30699 }
867
"""Attempt to implement MRKL systems as described in arxiv.org/pdf/2205.00445.pdf.""" from __future__ import annotations from typing import Any, Callable, List, NamedTuple, Optional, Sequence from langchain_core._api import deprecated from langchain_core.callbacks import BaseCallbackManager from langchain_core.langua...
langchain/libs/langchain/langchain/agents/mrkl/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/mrkl/base.py", "repo_id": "langchain", "token_count": 2507 }
468
from langchain_community.document_loaders.unstructured import ( UnstructuredAPIFileIOLoader, UnstructuredAPIFileLoader, UnstructuredBaseLoader, UnstructuredFileIOLoader, UnstructuredFileLoader, get_elements_from_api, satisfies_min_unstructured_version, validate_unstructured_version, ) _...
langchain/libs/langchain/langchain/document_loaders/unstructured.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/unstructured.py", "repo_id": "langchain", "token_count": 237 }
492
<!--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...
accelerate/docs/source/concept_guides/training_tpu.md/0
{ "file_path": "accelerate/docs/source/concept_guides/training_tpu.md", "repo_id": "accelerate", "token_count": 2214 }
2
"""Utils for jupyter notebook.""" import os from io import BytesIO from typing import Any, Dict, List, Tuple import matplotlib.pyplot as plt import requests from IPython.display import Markdown, display from llama_index.core.base.response.schema import Response from llama_index.core.img_utils import b64_2_img from lla...
llama_index/llama-index-core/llama_index/core/response/notebook_utils.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/response/notebook_utils.py", "repo_id": "llama_index", "token_count": 2140 }
1,203
""" Callback handler for storing generation data in OpenInference format. OpenInference is an open standard for capturing and storing AI model inferences. It enables production LLMapp servers to seamlessly integrate with LLM observability solutions such as Arize and Phoenix. For more information on the specification, ...
llama_index/llama-index-legacy/llama_index/legacy/callbacks/open_inference_callback.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/callbacks/open_inference_callback.py", "repo_id": "llama_index", "token_count": 3382 }
1,554
import { test, expect } from "@jest/globals"; import { OpenAIEmbeddings } from "@langchain/openai"; import { Document } from "@langchain/core/documents"; import { RecursiveCharacterTextSplitter } from "../../../text_splitter.js"; import { EmbeddingsFilter } from "../embeddings_filter.js"; import { DocumentCompressorPip...
langchainjs/langchain/src/retrievers/document_compressors/test/document_compressor.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/document_compressors/test/document_compressor.int.test.ts", "repo_id": "langchainjs", "token_count": 362 }
942
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.slack import SlackToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in SlackToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-slack/tests/test_tools_slack.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-slack/tests/test_tools_slack.py", "repo_id": "llama_index", "token_count": 92 }
1,582
from typing import Any, List, Optional from llama_index.legacy.bridge.pydantic import Field, PrivateAttr from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.core.embeddings.base import ( DEFAULT_EMBED_BATCH_SIZE, BaseEmbedding, ) from llama_index.legacy.embeddings.huggingface_utils...
llama_index/llama-index-legacy/llama_index/legacy/embeddings/huggingface_optimum.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/embeddings/huggingface_optimum.py", "repo_id": "llama_index", "token_count": 3156 }
1,650
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-waii/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-waii/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,534
# 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...
datasets/src/datasets/utils/_dill.py/0
{ "file_path": "datasets/src/datasets/utils/_dill.py", "repo_id": "datasets", "token_count": 8380 }
157
# Using Managed Indices LlamaIndex offers multiple integration points with Managed Indices. A managed index is a special type of index that is not managed locally as part of LlamaIndex but instead is managed via an API, such as [Vectara](https://vectara.com). ## Using a Managed Index Similar to any other index withi...
llama_index/docs/community/integrations/managed_indices.md/0
{ "file_path": "llama_index/docs/community/integrations/managed_indices.md", "repo_id": "llama_index", "token_count": 1777 }
1,120
<!--Copyright 2021 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
accelerate/docs/source/usage_guides/sagemaker.md/0
{ "file_path": "accelerate/docs/source/usage_guides/sagemaker.md", "repo_id": "accelerate", "token_count": 2261 }
4
from llama_index.core.readers.base import BaseReader from llama_index.readers.pdf_table import PDFTableReader def test_class(): names_of_base_classes = [b.__name__ for b in PDFTableReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-pdf-table/tests/test_readers_pdf_table.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-pdf-table/tests/test_readers_pdf_table.py", "repo_id": "llama_index", "token_count": 89 }
1,361
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.ionic_shopping import IonicShoppingToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in IonicShoppingToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-ionic-shopping/tests/test_tools_ionic_shopping.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-ionic-shopping/tests/test_tools_ionic_shopping.py", "repo_id": "llama_index", "token_count": 100 }
1,571
from typing import List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class GutenbergLoader(BaseLoader): """Load from `Gutenberg.org`.""" def __init__(self, file_path: str): """Initialize with a file path.""" if not file_path....
langchain/libs/community/langchain_community/document_loaders/gutenberg.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/gutenberg.py", "repo_id": "langchain", "token_count": 356 }
238
from llama_index.llms.ai21.base import AI21 __all__ = ["AI21"]
llama_index/llama-index-integrations/llms/llama-index-llms-ai21/llama_index/llms/ai21/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-ai21/llama_index/llms/ai21/__init__.py", "repo_id": "llama_index", "token_count": 27 }
1,289
/* eslint-disable no-shadow */ export enum UrlDependency { ConversationList = "conversation:list", Conversation = "conversation", }
chat-ui/src/lib/types/UrlDependency.ts/0
{ "file_path": "chat-ui/src/lib/types/UrlDependency.ts", "repo_id": "chat-ui", "token_count": 47 }
94
from langchain_community.agent_toolkits.multion.toolkit import MultionToolkit __all__ = ["MultionToolkit"]
langchain/libs/langchain/langchain/agents/agent_toolkits/multion/toolkit.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/multion/toolkit.py", "repo_id": "langchain", "token_count": 35 }
445
<jupyter_start><jupyter_text>Parent Document RetrieverWhen splitting documents for retrieval, there are often conflicting desires:1. You may want to have small documents, so that their embeddings can most accurately reflect their meaning. If too long, then the embeddings can lose meaning.2. You want to have long ...
langchain/docs/docs/modules/data_connection/retrievers/parent_document_retriever.ipynb/0
{ "file_path": "langchain/docs/docs/modules/data_connection/retrievers/parent_document_retriever.ipynb", "repo_id": "langchain", "token_count": 1557 }
187
python_sources() python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/postprocessor/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/postprocessor/BUILD", "repo_id": "llama_index", "token_count": 32 }
1,645
from langchain_community.vectorstores.astradb import ( AstraDB, ) __all__ = [ "AstraDB", ]
langchain/libs/langchain/langchain/vectorstores/astradb.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/astradb.py", "repo_id": "langchain", "token_count": 43 }
600
<jupyter_start><jupyter_text>Time-Weighted RerankShowcase capabilities of time-weighted node postprocessor<jupyter_code>from llama_index.core import VectorStoreIndex, SimpleDirectoryReader from llama_index.core.postprocessor import TimeWeightedPostprocessor from llama_index.core.node_parser import SentenceSplitter from...
llama_index/docs/examples/node_postprocessor/TimeWeightedPostprocessorDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/node_postprocessor/TimeWeightedPostprocessorDemo.ipynb", "repo_id": "llama_index", "token_count": 1549 }
1,135
# 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/resnet/test_modeling_tf_resnet.py/0
{ "file_path": "transformers/tests/models/resnet/test_modeling_tf_resnet.py", "repo_id": "transformers", "token_count": 3896 }
836
import { ChatWindow } from "@/components/ChatWindow"; export default function AgentsPage() { const InfoCard = ( <div className="p-4 md:p-8 rounded bg-[#25252d] w-full max-h-[85%] overflow-hidden"> <h1 className="text-3xl md:text-4xl mb-4"> ▲ Next.js + LangChain.js Retrieval Chain 🦜🔗 </h1> ...
langchain-nextjs-template/app/retrieval/page.tsx/0
{ "file_path": "langchain-nextjs-template/app/retrieval/page.tsx", "repo_id": "langchain-nextjs-template", "token_count": 1962 }
69
import pytest as pytest from langchain_community.utilities import ArxivAPIWrapper @pytest.mark.requires("arxiv") def test_is_arxiv_identifier() -> None: """Test that is_arxiv_identifier returns True for valid arxiv identifiers""" api_client = ArxivAPIWrapper() assert api_client.is_arxiv_identifier("1605....
langchain/libs/community/tests/unit_tests/utilities/test_arxiv.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/utilities/test_arxiv.py", "repo_id": "langchain", "token_count": 301 }
394
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/util/importutil/parquet_parser_test.go/0
{ "file_path": "milvus/internal/util/importutil/parquet_parser_test.go", "repo_id": "milvus", "token_count": 18362 }
1,804
#include <cstdint> #include <cassert> #include <boost/filesystem.hpp> #include <iostream> #include <random> #include "tantivy-binding.h" #include "tantivy-wrapper.h" #include "time_recorder.h" using namespace milvus::tantivy; void build_index(size_t n = 1000000) { auto path = "/tmp/inverted-index/test-binding/";...
milvus/internal/core/thirdparty/tantivy/bench.cpp/0
{ "file_path": "milvus/internal/core/thirdparty/tantivy/bench.cpp", "repo_id": "milvus", "token_count": 647 }
1,812
import math from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin from ...models.attention import FeedForward from ...models.attention_processor import Attention from ...models.embeddings import Timestep...
diffusers/src/diffusers/pipelines/unidiffuser/modeling_uvit.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/unidiffuser/modeling_uvit.py", "repo_id": "diffusers", "token_count": 24180 }
272
# coding=utf-8 # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
transformers/utils/release.py/0
{ "file_path": "transformers/utils/release.py", "repo_id": "transformers", "token_count": 2931 }
847
# Cohere import CodeBlock from "@theme/CodeBlock"; LangChain.js supports Cohere LLMs. Here's an example: You'll first need to install the [`@langchain/cohere`](https://www.npmjs.com/package/@langchain/cohere) package. import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <Integra...
langchainjs/docs/core_docs/docs/integrations/llms/cohere.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/llms/cohere.mdx", "repo_id": "langchainjs", "token_count": 176 }
730
# coding=utf-8 # Copyright 2022 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/deformable_detr/convert_deformable_detr_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/deformable_detr/convert_deformable_detr_to_pytorch.py", "repo_id": "transformers", "token_count": 4058 }
589
<jupyter_start><jupyter_text>Doctran: interrogate documentsDocuments used in a vector store knowledge base are typically stored in a narrative or conversational format. However, most user queries are in question format. If we **convert documents into Q&A format** before vectorizing them, we can increase the likelihood ...
langchain/docs/docs/integrations/document_transformers/doctran_interrogate_document.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_transformers/doctran_interrogate_document.ipynb", "repo_id": "langchain", "token_count": 1353 }
122
# Neo4j ## Setup Install the dependencies needed for Neo4j: import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <IntegrationInstallTooltip></IntegrationInstallTooltip> ```bash npm2yarn npm install @langchain/openai neo4j-driver @langchain/community ``` ## Usage This walkthrou...
langchainjs/docs/core_docs/docs/modules/data_connection/experimental/graph_databases/neo4j.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/experimental/graph_databases/neo4j.mdx", "repo_id": "langchainjs", "token_count": 357 }
809
"""Couchbase document loader.""" from typing import Any, Iterable, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class CouchbaseReader(BaseReader): """Couchbase document loader. Loads data from a Couchbase cluster into Document used by Llam...
llama_index/llama-index-integrations/readers/llama-index-readers-couchbase/llama_index/readers/couchbase/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-couchbase/llama_index/readers/couchbase/base.py", "repo_id": "llama_index", "token_count": 1684 }
1,388
export interface TracerSession { // The ID of the tenant, or organization tenant_id: string; // The ID of the project (alias for session) id: string; // The start time of the project start_time: number; // The end time of the project end_time?: number; // A description of the project description?: s...
langsmith-sdk/js/src/schemas.ts/0
{ "file_path": "langsmith-sdk/js/src/schemas.ts", "repo_id": "langsmith-sdk", "token_count": 2493 }
1,102
from __future__ import annotations import base64 import json import logging import os from io import BytesIO from typing import ( Any, AsyncIterator, Callable, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple, Union, cast, ) from urllib.parse import urlparse imp...
langchain/libs/partners/google-genai/langchain_google_genai/chat_models.py/0
{ "file_path": "langchain/libs/partners/google-genai/langchain_google_genai/chat_models.py", "repo_id": "langchain", "token_count": 10357 }
627
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/distributed/datanode/client/client_test.go/0
{ "file_path": "milvus/internal/distributed/datanode/client/client_test.go", "repo_id": "milvus", "token_count": 1384 }
1,707
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/program/llama-index-program-lmformatenforcer/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/program/llama-index-program-lmformatenforcer/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,393
# coding=utf-8 # Copyright 2021 The HuggingFace Team All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
transformers/examples/pytorch/question-answering/trainer_seq2seq_qa.py/0
{ "file_path": "transformers/examples/pytorch/question-answering/trainer_seq2seq_qa.py", "repo_id": "transformers", "token_count": 3076 }
515
from unittest.mock import MagicMock, patch import pytest from llama_index.legacy.llms import ChatMessage, MessageRole from llama_index.legacy.llms.huggingface import HuggingFaceInferenceAPI STUB_MODEL_NAME = "placeholder_model" @pytest.fixture(name="hf_inference_api") def fixture_hf_inference_api() -> HuggingFaceIn...
llama_index/llama-index-legacy/tests/llms/test_huggingface.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/llms/test_huggingface.py", "repo_id": "llama_index", "token_count": 2067 }
1,626
import { CohereClient } from "cohere-ai"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { Embeddings, EmbeddingsParams } from "@langchain/core/embeddings"; import { chunkArray } from "@langchain/core/utils/chunk_array"; /** * Interface that extends EmbeddingsParams and defines additional...
langchainjs/libs/langchain-cohere/src/embeddings.ts/0
{ "file_path": "langchainjs/libs/langchain-cohere/src/embeddings.ts", "repo_id": "langchainjs", "token_count": 1851 }
946
use crate::{ chroma_proto, errors::{ChromaError, ErrorCodes}, }; use std::collections::HashMap; use thiserror::Error; #[derive(Debug, PartialEq)] pub(crate) enum UpdateMetadataValue { Int(i32), Float(f64), Str(String), None, } #[derive(Error, Debug)] pub(crate) enum UpdateMetadataValueConversi...
chroma/rust/worker/src/types/metadata.rs/0
{ "file_path": "chroma/rust/worker/src/types/metadata.rs", "repo_id": "chroma", "token_count": 3704 }
59
<jupyter_start><jupyter_text>Recursive Retriever + Node ReferencesThis guide shows how you can use recursive retrieval to traverse node relationships and fetch nodes based on "references".Node references are a powerful concept. When you first perform retrieval, you may want to retrieve the reference as opposed to the r...
llama_index/docs/examples/retrievers/recursive_retriever_nodes.ipynb/0
{ "file_path": "llama_index/docs/examples/retrievers/recursive_retriever_nodes.ipynb", "repo_id": "llama_index", "token_count": 4509 }
1,107
import { AuthOptions } from "./auth"; import { IEmbeddingFunction } from "./embeddings/IEmbeddingFunction"; export enum IncludeEnum { Documents = 'documents', Embeddings = 'embeddings', Metadatas = 'metadatas', Distances = 'distances' } type Number = number; export type Embedding = Array<Number>; export type ...
chroma/clients/js/src/types.ts/0
{ "file_path": "chroma/clients/js/src/types.ts", "repo_id": "chroma", "token_count": 1169 }
30
FROM rocm/dev-ubuntu-20.04:5.6 # rocm/pytorch has no version with 2.1.0 LABEL maintainer="Hugging Face" ARG DEBIAN_FRONTEND=noninteractive ARG PYTORCH='2.1.0' ARG TORCH_VISION='0.16.0' ARG TORCH_AUDIO='2.1.0' ARG ROCM='5.6' RUN apt update && \ apt install -y --no-install-recommends git libsndfile1-dev tesseract-...
transformers/docker/transformers-pytorch-amd-gpu/Dockerfile/0
{ "file_path": "transformers/docker/transformers-pytorch-amd-gpu/Dockerfile", "repo_id": "transformers", "token_count": 516 }
444
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion.py", "repo_id": "diffusers", "token_count": 14315 }
250