text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
<jupyter_start><jupyter_text>Model comparisonConstructing your language model application will likely involved choosing between many different options of prompts, models, and even chains to use. When doing so, you will want to compare these different options on different inputs in an easy, flexible, and intuitive way. ...
langchain/docs/docs/guides/model_laboratory.ipynb/0
{ "file_path": "langchain/docs/docs/guides/model_laboratory.ipynb", "repo_id": "langchain", "token_count": 1147 }
95
<!--- 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 o...
diffusers/README.md/0
{ "file_path": "diffusers/README.md", "repo_id": "diffusers", "token_count": 5394 }
173
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/models/unets/test_unet_blocks_common.py/0
{ "file_path": "diffusers/tests/models/unets/test_unet_blocks_common.py", "repo_id": "diffusers", "token_count": 1805 }
266
from langchain_community.callbacks.infino_callback import ( InfinoCallbackHandler, ) __all__ = [ "InfinoCallbackHandler", ]
langchain/libs/langchain/langchain/callbacks/infino_callback.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/infino_callback.py", "repo_id": "langchain", "token_count": 46 }
473
import { BaseRetriever, type BaseRetrieverInput, } from "@langchain/core/retrievers"; import { Document } from "@langchain/core/documents"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import type { DriaParams, SearchOptions as DriaSearchOptions } from "dria"; import { Dria } from "dria"; /*...
langchainjs/libs/langchain-community/src/retrievers/dria.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/retrievers/dria.ts", "repo_id": "langchainjs", "token_count": 1247 }
951
"""Test jina embeddings.""" from langchain_community.embeddings.jina import JinaEmbeddings def test_jina_embedding_documents() -> None: """Test jina embeddings for documents.""" documents = ["foo bar", "bar foo"] embedding = JinaEmbeddings() output = embedding.embed_documents(documents) assert len...
langchain/libs/community/tests/integration_tests/embeddings/test_jina.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/embeddings/test_jina.py", "repo_id": "langchain", "token_count": 209 }
335
"""Relevancy evaluation.""" from __future__ import annotations import asyncio import re from typing import Any, Callable, Optional, Sequence, Tuple from llama_index.core import ServiceContext from llama_index.core.evaluation.base import BaseEvaluator, EvaluationResult from llama_index.core.indices import SummaryIndex...
llama_index/llama-index-core/llama_index/core/evaluation/context_relevancy.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/evaluation/context_relevancy.py", "repo_id": "llama_index", "token_count": 2637 }
1,170
python_sources() resource( name="py_typed", source="py.typed", )
llama_index/llama-index-core/llama_index/core/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/BUILD", "repo_id": "llama_index", "token_count": 34 }
1,135
[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 = ["AstraDBReader"] contains_example = false import_path = "llama_index.readers.astra_db" [t...
llama_index/llama-index-integrations/readers/llama-index-readers-astra-db/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-astra-db/pyproject.toml", "repo_id": "llama_index", "token_count": 663 }
1,324
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-dad-jokes/llama_index/readers/dad_jokes/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-dad-jokes/llama_index/readers/dad_jokes/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,478
#!/usr/bin/env python3 """ ImageNet Training Script This is intended to be a lean and easily modifiable ImageNet training script that reproduces ImageNet training results with some of the latest networks and training techniques. It favours canonical PyTorch and standard Python style over trying to be able to 'do it al...
pytorch-image-models/train.py/0
{ "file_path": "pytorch-image-models/train.py", "repo_id": "pytorch-image-models", "token_count": 24460 }
366
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datanode/metacache/segment.go/0
{ "file_path": "milvus/internal/datanode/metacache/segment.go", "repo_id": "milvus", "token_count": 1437 }
1,923
[virtualenvs] in-project = true [installer] modern-installation = false
langgraph/poetry.toml/0
{ "file_path": "langgraph/poetry.toml", "repo_id": "langgraph", "token_count": 25 }
1,121
from typing import List from llama_index.legacy.postprocessor.node import LongContextReorder from llama_index.legacy.schema import Node, NodeWithScore def test_long_context_reorder() -> None: nodes = [ NodeWithScore(node=Node(text="text"), score=0.7), NodeWithScore(node=Node(text="text"), score=0...
llama_index/llama-index-legacy/tests/postprocessor/test_longcontext_reorder.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/postprocessor/test_longcontext_reorder.py", "repo_id": "llama_index", "token_count": 508 }
1,542
--- sidebar_class_name: node-only --- import CodeBlock from "@theme/CodeBlock"; # Google Vertex AI Matching Engine :::tip Compatibility Only available on Node.js. ::: The Google Vertex AI Matching Engine "provides the industry's leading high-scale low latency vector database. These vector databases are commonly ref...
langchainjs/docs/core_docs/docs/integrations/vectorstores/googlevertexai.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/vectorstores/googlevertexai.mdx", "repo_id": "langchainjs", "token_count": 1580 }
742
# @cfworker/json-schema ![](https://badgen.net/bundlephobia/minzip/@cfworker/json-schema) ![](https://badgen.net/bundlephobia/min/@cfworker/json-schema) ![](https://badgen.net/bundlephobia/dependency-count/@cfworker/json-schema) ![](https://badgen.net/bundlephobia/tree-shaking/@cfworker/json-schema) ![](https://badgen...
langchainjs/langchain-core/src/utils/@cfworker/json-schema/README.md/0
{ "file_path": "langchainjs/langchain-core/src/utils/@cfworker/json-schema/README.md", "repo_id": "langchainjs", "token_count": 818 }
935
"""SQL agent."""
langchain/libs/community/langchain_community/agent_toolkits/sql/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/sql/__init__.py", "repo_id": "langchain", "token_count": 6 }
233
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-nvidia-triton/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-nvidia-triton/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,409
# 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/models/speech_to_text/__init__.py/0
{ "file_path": "transformers/src/transformers/models/speech_to_text/__init__.py", "repo_id": "transformers", "token_count": 1361 }
679
import { test, expect } from "@jest/globals"; import { _verifyObjectIsLangChainConfig } from "../utils.js"; test("_verifyObjectIsLangChainConfig successfully fails an invalid object", async () => { const { config } = await import("./langchain.invalid.config.js"); const isValid = _verifyObjectIsLangChainConfig(conf...
langchainjs/libs/langchain-scripts/src/tests/config_file.test.ts/0
{ "file_path": "langchainjs/libs/langchain-scripts/src/tests/config_file.test.ts", "repo_id": "langchainjs", "token_count": 189 }
986
<jupyter_start><jupyter_text>Fine-tune BLIP using Hugging Face `transformers`, `datasets`, `peft` 🤗 and `bitsandbytes`Let's leverage recent advances from Parameter Efficient Fine-Tuning methods to fine-tune a large image to text model! We will show through this tutorial that it is possible to fine-tune a 3B scale mode...
notebooks/peft/Fine_tune_BLIP2_on_an_image_captioning_dataset_PEFT.ipynb/0
{ "file_path": "notebooks/peft/Fine_tune_BLIP2_on_an_image_captioning_dataset_PEFT.ipynb", "repo_id": "notebooks", "token_count": 4011 }
306
<jupyter_start><jupyter_text>Prediction Guard<jupyter_code>%pip install --upgrade --quiet predictionguard langchain import os from langchain.chains import LLMChain from langchain.prompts import PromptTemplate from langchain_community.llms import PredictionGuard<jupyter_output><empty_output><jupyter_text>Basic LLM usa...
langchain/docs/docs/integrations/llms/predictionguard.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/predictionguard.ipynb", "repo_id": "langchain", "token_count": 858 }
121
from rag_chroma_multi_modal_multi_vector.chain import chain __all__ = ["chain"]
langchain/templates/rag-chroma-multi-modal-multi-vector/rag_chroma_multi_modal_multi_vector/__init__.py/0
{ "file_path": "langchain/templates/rag-chroma-multi-modal-multi-vector/rag_chroma_multi_modal_multi_vector/__init__.py", "repo_id": "langchain", "token_count": 28 }
726
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/api/pipelines/text_to_video_zero.md/0
{ "file_path": "diffusers/docs/source/en/api/pipelines/text_to_video_zero.md", "repo_id": "diffusers", "token_count": 4486 }
182
# LlamaIndex Vector_Stores Integration: Pinecone
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-pinecone/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-pinecone/README.md", "repo_id": "llama_index", "token_count": 13 }
1,531
from __future__ import annotations from typing import ( Dict, List, Type, Union, ) import google.ai.generativelanguage as glm from langchain_core.pydantic_v1 import BaseModel from langchain_core.tools import BaseTool from langchain_core.utils.json_schema import dereference_refs FunctionCallType = Uni...
langchain/libs/partners/google-genai/langchain_google_genai/_function_utils.py/0
{ "file_path": "langchain/libs/partners/google-genai/langchain_google_genai/_function_utils.py", "repo_id": "langchain", "token_count": 1831 }
644
from collections import OrderedDict from typing import Any, Dict, Optional, Type, cast import pytest from llama_index.legacy.bridge.pydantic import BaseModel from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.response_synthesizers import Refine from llama_index.legacy.response_synthesizer...
llama_index/llama-index-legacy/tests/response_synthesizers/test_refine.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/response_synthesizers/test_refine.py", "repo_id": "llama_index", "token_count": 1878 }
1,757
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/paint_by_example/test_paint_by_example.py/0
{ "file_path": "diffusers/tests/pipelines/paint_by_example/test_paint_by_example.py", "repo_id": "diffusers", "token_count": 3654 }
282
"""Retrievers for SummaryIndex.""" import logging from typing import Any, Callable, List, Optional, Tuple from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.core.base_retriever import BaseRetriever from llama_index.legacy.indices.list.base import SummaryIndex from llama_index.legacy...
llama_index/llama-index-legacy/llama_index/legacy/indices/list/retrievers.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/list/retrievers.py", "repo_id": "llama_index", "token_count": 3505 }
1,573
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/ddpm/test_ddpm.py/0
{ "file_path": "diffusers/tests/pipelines/ddpm/test_ddpm.py", "repo_id": "diffusers", "token_count": 1776 }
278
# coding=utf-8 # Copyright 2023 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/owlv2/convert_owlv2_to_hf.py/0
{ "file_path": "transformers/src/transformers/models/owlv2/convert_owlv2_to_hf.py", "repo_id": "transformers", "token_count": 9921 }
711
from typing import Any, Dict, Optional from llama_index.core.base.llms.types import LLMMetadata from llama_index.core.bridge.pydantic import Field from llama_index.core.constants import ( DEFAULT_NUM_OUTPUTS, DEFAULT_TEMPERATURE, ) from llama_index.core.llms.generic_utils import get_from_param_or_env from llam...
llama_index/llama-index-integrations/llms/llama-index-llms-neutrino/llama_index/llms/neutrino/base.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-neutrino/llama_index/llms/neutrino/base.py", "repo_id": "llama_index", "token_count": 937 }
1,305
import { sum } from "./sum"; export function concatUint8Arrays(arrays: Uint8Array[]): Uint8Array { const totalLength = sum(arrays.map((a) => a.length)); const result = new Uint8Array(totalLength); let offset = 0; for (const array of arrays) { result.set(array, offset); offset += array.length; } return result...
chat-ui/src/lib/utils/concatUint8Arrays.ts/0
{ "file_path": "chat-ui/src/lib/utils/concatUint8Arrays.ts", "repo_id": "chat-ui", "token_count": 117 }
107
<!--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/quicktour.md/0
{ "file_path": "accelerate/docs/source/quicktour.md", "repo_id": "accelerate", "token_count": 5632 }
2
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/nat.md/0
{ "file_path": "transformers/docs/source/en/model_doc/nat.md", "repo_id": "transformers", "token_count": 1229 }
481
"""Slack reader.""" import logging import os import time from datetime import datetime from ssl import SSLContext from typing import Any, List, Optional from llama_index.core.bridge.pydantic import PrivateAttr from llama_index.core.readers.base import BasePydanticReader from llama_index.core.schema import Document lo...
llama_index/llama-index-integrations/readers/llama-index-readers-slack/llama_index/readers/slack/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-slack/llama_index/readers/slack/base.py", "repo_id": "llama_index", "token_count": 4175 }
1,376
# Required Environment Variables: OPENAI_API_KEY from llama_index.core.llama_pack import download_llama_pack from llama_index.core import SimpleDirectoryReader # download and install dependencies HybridFusionRetrieverPack = download_llama_pack( "HybridFusionRetrieverPack", "./hybrid_fusion_pack" ) # load documen...
llama_index/llama-index-packs/llama-index-packs-fusion-retriever/examples/hybrid_fusion/example.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-fusion-retriever/examples/hybrid_fusion/example.py", "repo_id": "llama_index", "token_count": 201 }
1,843
"""Apify dataset reader.""" from typing import Callable, Dict, List from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class ApifyDataset(BaseReader): """Apify Dataset reader. Reads a dataset on the Apify platform. Args: apify_api_token (str): Apify...
llama_index/llama-index-integrations/readers/llama-index-readers-apify/llama_index/readers/apify/dataset/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-apify/llama_index/readers/apify/dataset/base.py", "repo_id": "llama_index", "token_count": 557 }
1,461
export { parsePartialJson } from "@langchain/core/output_parsers";
langchainjs/langchain/src/output_parsers/json.ts/0
{ "file_path": "langchainjs/langchain/src/output_parsers/json.ts", "repo_id": "langchainjs", "token_count": 22 }
975
python_tests( name="tests", )
llama_index/llama-index-core/tests/retrievers/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/retrievers/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,168
const adjectives: string[] = [ "abandoned", "aching", "advanced", "ample", "artistic", "back", "best", "bold", "brief", "clear", "cold", "complicated", "cooked", "crazy", "crushing", "damp", "dear", "definite", "dependable", "diligent", "drab", "earnest", "elderly", "ench...
langchainjs/langchain/src/smith/name_generation.ts/0
{ "file_path": "langchainjs/langchain/src/smith/name_generation.ts", "repo_id": "langchainjs", "token_count": 4011 }
1,016
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datanode/syncmgr/task_test.go/0
{ "file_path": "milvus/internal/datanode/syncmgr/task_test.go", "repo_id": "milvus", "token_count": 5995 }
1,703
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-feedly-rss/llama_index/readers/feedly_rss/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-feedly-rss/llama_index/readers/feedly_rss/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,289
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-microsoft-outlook/llama_index/readers/microsoft_outlook/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-microsoft-outlook/llama_index/readers/microsoft_outlook/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,407
from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.embeddings.ollama import OllamaEmbedding def test_embedding_class(): emb = OllamaEmbedding(model_name="") assert isinstance(emb, BaseEmbedding)
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-ollama/tests/test_embeddings_ollama.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-ollama/tests/test_embeddings_ollama.py", "repo_id": "llama_index", "token_count": 84 }
1,283
# coding=utf-8 # Copyright 2020, The RAG 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 r...
transformers/src/transformers/models/rag/retrieval_rag.py/0
{ "file_path": "transformers/src/transformers/models/rag/retrieval_rag.py", "repo_id": "transformers", "token_count": 12868 }
672
from langchain_community.vectorstores.elasticsearch import ( ApproxRetrievalStrategy, BaseRetrievalStrategy, ElasticsearchStore, ExactRetrievalStrategy, SparseRetrievalStrategy, ) __all__ = [ "BaseRetrievalStrategy", "ApproxRetrievalStrategy", "ExactRetrievalStrategy", "SparseRetrie...
langchain/libs/langchain/langchain/vectorstores/elasticsearch.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/elasticsearch.py", "repo_id": "langchain", "token_count": 142 }
627
# coding=utf-8 # Copyright 2020 T5 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 License. # You may obtain a copy of the License at # # ...
transformers/src/transformers/models/t5/modeling_tf_t5.py/0
{ "file_path": "transformers/src/transformers/models/t5/modeling_tf_t5.py", "repo_id": "transformers", "token_count": 33722 }
665
<jupyter_start><jupyter_text>PerplexityBefore we get started, make sure you install llama_index<jupyter_code>%pip install llama-index-llms-perplexity !pip install llama-index<jupyter_output><empty_output><jupyter_text>Setup LLMAs of Nov 14, 2023 - the following models are supported with the Perplexity LLM class in LLaM...
llama_index/docs/examples/llm/perplexity.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/perplexity.ipynb", "repo_id": "llama_index", "token_count": 1192 }
1,069
<!--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 to...
diffusers/docs/source/en/api/pipelines/kandinsky3.md/0
{ "file_path": "diffusers/docs/source/en/api/pipelines/kandinsky3.md", "repo_id": "diffusers", "token_count": 766 }
179
python_tests( interpreter_constraints=["==3.9.*", "==3.10.*"], )
llama_index/llama-index-integrations/llms/llama-index-llms-vertex/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-vertex/tests/BUILD", "repo_id": "llama_index", "token_count": 29 }
1,305
use std::str::FromStr; pub fn get_num_threads() -> usize { // Respond to the same environment variable as rayon. match std::env::var("RAYON_NUM_THREADS") .ok() .and_then(|s| usize::from_str(&s).ok()) { Some(x) if x > 0 => x, Some(_) | None => num_cpus::get(), } } pub fn...
candle/candle-core/src/utils.rs/0
{ "file_path": "candle/candle-core/src/utils.rs", "repo_id": "candle", "token_count": 389 }
39
from llama_index.core.llms.base import BaseLLM from llama_index.llms.openrouter import OpenRouter def test_embedding_class(): names_of_base_classes = [b.__name__ for b in OpenRouter.__mro__] assert BaseLLM.__name__ in names_of_base_classes
llama_index/llama-index-integrations/llms/llama-index-llms-openrouter/tests/test_llms_openrouter.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-openrouter/tests/test_llms_openrouter.py", "repo_id": "llama_index", "token_count": 94 }
1,236
import re from langchain.prompts import PromptTemplate def clean_pdf_text(text: str) -> str: """Cleans text extracted from a PDF file.""" # TODO: Remove References/Bibliography section. return remove_citations(text) def remove_citations(text: str) -> str: """Removes in-text citations from a string.""...
auto-evaluator/api/text_utils.py/0
{ "file_path": "auto-evaluator/api/text_utils.py", "repo_id": "auto-evaluator", "token_count": 2022 }
0
from langchain_community.document_loaders.tencent_cos_file import TencentCOSFileLoader __all__ = ["TencentCOSFileLoader"]
langchain/libs/langchain/langchain/document_loaders/tencent_cos_file.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/tencent_cos_file.py", "repo_id": "langchain", "token_count": 39 }
491
from typing import Any, List, Optional from llama_index.core.base.embeddings.base import ( DEFAULT_EMBED_BATCH_SIZE, BaseEmbedding, ) from llama_index.core.bridge.pydantic import Field, PrivateAttr from llama_index.core.callbacks import CallbackManager from llama_index.core.utils import infer_torch_device from...
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum-intel/llama_index/embeddings/huggingface_optimum_intel/base.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum-intel/llama_index/embeddings/huggingface_optimum_intel/base.py", "repo_id": "llama_index", "token_count": 2492 }
1,363
import { ConfluencePagesLoader } from "langchain/document_loaders/web/confluence"; const username = process.env.CONFLUENCE_USERNAME; const accessToken = process.env.CONFLUENCE_ACCESS_TOKEN; const personalAccessToken = process.env.CONFLUENCE_PAT; if (username && accessToken) { const loader = new ConfluencePagesLoade...
langchainjs/examples/src/document_loaders/confluence.ts/0
{ "file_path": "langchainjs/examples/src/document_loaders/confluence.ts", "repo_id": "langchainjs", "token_count": 326 }
794
# 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/tests/pipelines/test_pipelines_object_detection.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_object_detection.py", "repo_id": "transformers", "token_count": 6048 }
799
from langchain_experimental.openai_assistant.base import OpenAIAssistantRunnable __all__ = ["OpenAIAssistantRunnable"]
langchain/libs/experimental/langchain_experimental/openai_assistant/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/openai_assistant/__init__.py", "repo_id": "langchain", "token_count": 40 }
423
"""**OutputParser** classes parse the output of an LLM call. **Class hierarchy:** .. code-block:: BaseLLMOutputParser --> BaseOutputParser --> <name>OutputParser # ListOutputParser, PydanticOutputParser **Main helpers:** .. code-block:: Serializable, Generation, PromptValue """ # noqa: E501 from langcha...
langchain/libs/langchain/langchain/output_parsers/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/output_parsers/__init__.py", "repo_id": "langchain", "token_count": 724 }
523
from typing import Any, Dict, List, Optional from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.constants import DEFAULT_SIMILARITY_TOP_K from llama_index.legacy.core.base_retriever import BaseRetriever from llama_index.legacy.schema import NodeWithScore, QueryBundle from llama_index...
llama_index/llama-index-legacy/llama_index/legacy/indices/managed/colbert_index/retriever.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/managed/colbert_index/retriever.py", "repo_id": "llama_index", "token_count": 865 }
1,562
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-openai/llama_index/tools/openai/image_generation/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-openai/llama_index/tools/openai/image_generation/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,449
--- sidebar-position: 1 --- # Graph querying Graph databases give us a powerful way to represent and query real-world relationships. There are a number of chains that make it easy to use LLMs to interact with various graph DBs. import DocCardList from "@theme/DocCardList"; <DocCardList />
langchain/docs/docs/use_cases/graph/index.mdx/0
{ "file_path": "langchain/docs/docs/use_cases/graph/index.mdx", "repo_id": "langchain", "token_count": 77 }
203
## 6. Proxy As the user access layer of Milvus, Proxy mainly plays a role that does some checks and preprocessing for requests from clients and then forwards these requests to other components, such as Root Coordinator, Data Coordinator, Query Coordinator, Index Coordinator. The below figure shows how Proxy interacts ...
milvus/docs/design_docs/20220105-proxy.md/0
{ "file_path": "milvus/docs/design_docs/20220105-proxy.md", "repo_id": "milvus", "token_count": 6976 }
1,734
python_tests()
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-dynamodb/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-dynamodb/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,590
<!--- Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/templates/adding_a_new_model/README.md/0
{ "file_path": "transformers/templates/adding_a_new_model/README.md", "repo_id": "transformers", "token_count": 2800 }
774
[ { "server": "apollo", "suite_params": [ { "suite": "011_insert_performance.yaml", "image_type": "cpu" }, { "suite": "011_delete_performance.yaml", "image_type": "cpu" } ] } ]
milvus/tests/benchmark/milvus_benchmark/scheduler/011_delete.json/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/scheduler/011_delete.json", "repo_id": "milvus", "token_count": 210 }
1,938
{ "name": "dependency-range-tests", "version": "0.0.0", "private": true, "description": "Tests dependency ranges for LangChain.", "dependencies": { "semver": "^7.5.4" } }
langchainjs/dependency_range_tests/scripts/node/package.json/0
{ "file_path": "langchainjs/dependency_range_tests/scripts/node/package.json", "repo_id": "langchainjs", "token_count": 75 }
710
/* eslint-disable import/first */ /* eslint-disable arrow-body-style */ /* eslint-disable import/no-duplicates */ import { TavilySearchResults } from "@langchain/community/tools/tavily_search"; import { ChatOpenAI } from "@langchain/openai"; const tools = [ new TavilySearchResults({ maxResults: 1, }), ]; con...
langchainjs/examples/src/use_cases/chatbots/tool_usage.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/chatbots/tool_usage.ts", "repo_id": "langchainjs", "token_count": 995 }
852
<jupyter_start><jupyter_text>JinaLet's load the Jina Embedding class.<jupyter_code>from langchain_community.embeddings import JinaEmbeddings embeddings = JinaEmbeddings( jina_api_key="jina_*", model_name="jina-embeddings-v2-base-en" ) text = "This is a test document." query_result = embeddings.embed_query(text) pri...
langchain/docs/docs/integrations/text_embedding/jina.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/jina.ipynb", "repo_id": "langchain", "token_count": 164 }
174
<jupyter_start><jupyter_text>[WIP] Hyperparameter Optimization for RAGIn this guide we show you how to do hyperparameter optimization for RAG.We use our new, experimental `ParamTuner` class which allows hyperparameter grid search over a RAG function. It comes in two variants:- `ParamTuner`: a naive way for parameter tu...
llama_index/docs/examples/param_optimizer/param_optimizer.ipynb/0
{ "file_path": "llama_index/docs/examples/param_optimizer/param_optimizer.ipynb", "repo_id": "llama_index", "token_count": 3487 }
1,137
<jupyter_start><jupyter_text>Redis>[Redis](https://redis.com) is an open-source key-value store that can be used as a cache, message broker, database, vector database and more.In the notebook, we'll demo the `SelfQueryRetriever` wrapped around a `Redis` vector store. Creating a Redis vector storeFirst we'll want to c...
langchain/docs/docs/integrations/retrievers/self_query/redis_self_query.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/self_query/redis_self_query.ipynb", "repo_id": "langchain", "token_count": 2313 }
168
# Runhouse This page covers how to use the [Runhouse](https://github.com/run-house/runhouse) ecosystem within LangChain. It is broken into three parts: installation and setup, LLMs, and Embeddings. ## Installation and Setup - Install the Python SDK with `pip install runhouse` - If you'd like to use on-demand cluster,...
langchain/docs/docs/integrations/providers/runhouse.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/runhouse.mdx", "repo_id": "langchain", "token_count": 359 }
148
#ifndef named_type_impl_h #define named_type_impl_h #include <tuple> #include <type_traits> #include <utility> // C++17 detection #if defined(_MSC_VER) && (defined(_HAS_CXX17) && _HAS_CXX17) # define FLUENT_CPP17_PRESENT 1 #elif __cplusplus >= 201703L # define FLUENT_CPP17_PRESENT 1 #else # define FLUENT_CPP...
milvus/internal/core/thirdparty/NamedType/named_type_impl.hpp/0
{ "file_path": "milvus/internal/core/thirdparty/NamedType/named_type_impl.hpp", "repo_id": "milvus", "token_count": 1667 }
1,947
import * as fs from "fs"; import * as path from "path"; // .gitignore const DEFAULT_GITIGNORE_PATHS = ["node_modules", "dist", ".yarn"]; // This lists all the entrypoints for the library. Each key corresponds to an // importable path, eg. `import { AgentExecutor } from "langchain/agents"`. // The value is the path to...
langchainjs/libs/langchain-scripts/scripts/create-entrypoints.js/0
{ "file_path": "langchainjs/libs/langchain-scripts/scripts/create-entrypoints.js", "repo_id": "langchainjs", "token_count": 1126 }
1,012
<jupyter_start><jupyter_text>Multi-modal RAGMany documents contain a mixture of content types, including text and images. Yet, information captured in images is lost in most RAG applications.With the emergence of multimodal LLMs, like [GPT-4V](https://openai.com/research/gpt-4v-system-card), it is worth considering how...
langchain/cookbook/Multi_modal_RAG.ipynb/0
{ "file_path": "langchain/cookbook/Multi_modal_RAG.ipynb", "repo_id": "langchain", "token_count": 6365 }
68
python_sources()
llama_index/llama-index-integrations/indices/llama-index-indices-managed-colbert/llama_index/indices/managed/colbert/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-colbert/llama_index/indices/managed/colbert/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,381
"""Init params."""
llama_index/llama-index-core/tests/output_parsers/__init__.py/0
{ "file_path": "llama_index/llama-index-core/tests/output_parsers/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,226
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class StableDiffusionKDiffusionPipeline(metaclass=DummyObject): _backends = ["torch", "transformers", "k_diffusion"] def __init__(self, *args, **kwargs): requires_backends(se...
diffusers/src/diffusers/utils/dummy_torch_and_transformers_and_k_diffusion_objects.py/0
{ "file_path": "diffusers/src/diffusers/utils/dummy_torch_and_transformers_and_k_diffusion_objects.py", "repo_id": "diffusers", "token_count": 451 }
262
# 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 law or ag...
milvus/tests/docker/Dockerfile/0
{ "file_path": "milvus/tests/docker/Dockerfile", "repo_id": "milvus", "token_count": 278 }
1,979
import os import re from functools import partial from glob import has_magic from pathlib import Path, PurePath from typing import Callable, Dict, List, Optional, Set, Tuple, Union import huggingface_hub from fsspec import get_fs_token_paths from fsspec.implementations.http import HTTPFileSystem from huggingface_hub i...
datasets/src/datasets/data_files.py/0
{ "file_path": "datasets/src/datasets/data_files.py", "repo_id": "datasets", "token_count": 13354 }
140
python_tests()
llama_index/llama-index-packs/llama-index-packs-corrective-rag/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-corrective-rag/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,647
from __future__ import annotations import logging from typing import Optional from langchain_core.callbacks import CallbackManagerForToolRun from langchain_community.tools.edenai.edenai_base_tool import EdenaiTool logger = logging.getLogger(__name__) class EdenAiExplicitImageTool(EdenaiTool): """Tool that qu...
langchain/libs/community/langchain_community/tools/edenai/image_explicitcontent.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/edenai/image_explicitcontent.py", "repo_id": "langchain", "token_count": 858 }
282
# This module contains utility classes and functions for interacting with Arcee API. # For more information and updates, refer to the Arcee utils page: # [https://github.com/arcee-ai/arcee-python/blob/main/arcee/dalm.py] from enum import Enum from typing import Any, Dict, List, Literal, Mapping, Optional, Union impor...
langchain/libs/community/langchain_community/utilities/arcee.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/arcee.py", "repo_id": "langchain", "token_count": 3876 }
298
<jupyter_start><jupyter_text>Multiple Memory classesWe can use multiple memory classes in the same chain. To combine multiple memory classes, we initialize and use the `CombinedMemory` class.<jupyter_code>from langchain.chains import ConversationChain from langchain.memory import ( CombinedMemory, ConversationB...
langchain/docs/docs/modules/memory/multiple_memory.ipynb/0
{ "file_path": "langchain/docs/docs/modules/memory/multiple_memory.ipynb", "repo_id": "langchain", "token_count": 569 }
189
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_img2img.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_img2img.py", "repo_id": "diffusers", "token_count": 4267 }
273
<jupyter_start><jupyter_text>Recursive Retriever + Document AgentsThis guide shows how to combine recursive retrieval and "document agents" for advanced decision making over heterogeneous documents.There are two motivating factors that lead to solutions for better retrieval:- Decoupling retrieval embeddings from chunk-...
llama_index/docs/examples/query_engine/recursive_retriever_agents.ipynb/0
{ "file_path": "llama_index/docs/examples/query_engine/recursive_retriever_agents.ipynb", "repo_id": "llama_index", "token_count": 2189 }
1,083
<jupyter_start><jupyter_text>IMSDb>[IMSDb](https://imsdb.com/) is the `Internet Movie Script Database`.This covers how to load `IMSDb` webpages into a document format that we can use downstream.<jupyter_code>from langchain_community.document_loaders import IMSDbLoader loader = IMSDbLoader("https://imsdb.com/scripts/Bla...
langchain/docs/docs/integrations/document_loaders/imsdb.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/imsdb.ipynb", "repo_id": "langchain", "token_count": 147 }
113
import json import urllib.request from typing import Any, Iterator, List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class LarkSuiteDocLoader(BaseLoader): """Load from `LarkSuite` (`FeiShu`).""" def __init__(self, domain: str, access_token:...
langchain/libs/community/langchain_community/document_loaders/larksuite.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/larksuite.py", "repo_id": "langchain", "token_count": 870 }
250
import argparse import os from typing import List import google.generativeai as genai import chromadb from chromadb.utils import embedding_functions model = genai.GenerativeModel("gemini-pro") def build_prompt(query: str, context: List[str]) -> str: """ Builds a prompt for the LLM. # This function buil...
chroma/examples/gemini/main.py/0
{ "file_path": "chroma/examples/gemini/main.py", "repo_id": "chroma", "token_count": 1673 }
39
python_tests()
llama_index/llama-index-packs/llama-index-packs-llava-completion/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-llava-completion/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,709
--- sidebar_position: 1 --- # Memory management A key feature of chatbots is their ability to use content of previous conversation turns as context. This state management can take several forms, including: - Simply stuffing previous messages into a chat model prompt. - The above, but trimming old messages to reduce ...
langchainjs/docs/core_docs/docs/use_cases/chatbots/memory_management.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/use_cases/chatbots/memory_management.mdx", "repo_id": "langchainjs", "token_count": 4336 }
767
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/time_series_transformer.md/0
{ "file_path": "transformers/docs/source/en/model_doc/time_series_transformer.md", "repo_id": "transformers", "token_count": 1371 }
489
"""HTML node parser.""" from typing import TYPE_CHECKING, Any, List, Optional, Sequence from llama_index.core.bridge.pydantic import Field from llama_index.core.callbacks.base import CallbackManager from llama_index.core.node_parser.interface import NodeParser from llama_index.core.node_parser.node_utils import build_...
llama_index/llama-index-core/llama_index/core/node_parser/file/html.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/node_parser/file/html.py", "repo_id": "llama_index", "token_count": 1945 }
1,162
package deletebuffer import ( "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus/internal/storage" ) func TestDeleteBufferItem(t *testing.T) { item := &BufferItem{ PartitionID: 100, DeleteData: storage.DeleteData{}, } assert.Equal(t, int64(96), item.Size()) item.DeleteData.Pks...
milvus/internal/querynodev2/delegator/deletebuffer/delete_item_test.go/0
{ "file_path": "milvus/internal/querynodev2/delegator/deletebuffer/delete_item_test.go", "repo_id": "milvus", "token_count": 168 }
1,904
# `tokenizers-darwin-x64` This is the **x86_64-apple-darwin** binary for `tokenizers`
tokenizers/bindings/node/npm/darwin-x64/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/darwin-x64/README.md", "repo_id": "tokenizers", "token_count": 34 }
451
import json import os import re from pathlib import Path import pytest from fsspec.registry import _registry as _fsspec_registry from fsspec.spec import AbstractBufferedFile, AbstractFileSystem from datasets.download.download_config import DownloadConfig from datasets.download.streaming_download_manager import ( ...
datasets/tests/test_streaming_download_manager.py/0
{ "file_path": "datasets/tests/test_streaming_download_manager.py", "repo_id": "datasets", "token_count": 17220 }
170
"""Default query for EmptyIndex.""" from typing import Any, List, Optional from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.core.base_retriever import BaseRetriever from llama_index.legacy.indices.empty.base import EmptyIndex from llama_index.legacy.prompts import BasePromptTempla...
llama_index/llama-index-legacy/llama_index/legacy/indices/empty/retrievers.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/empty/retrievers.py", "repo_id": "llama_index", "token_count": 495 }
1,598
<!--Copyright 2021 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/visual_bert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/visual_bert.md", "repo_id": "transformers", "token_count": 1676 }
458
class ModerationPiiError(Exception): """Exception raised if PII entities are detected. Attributes: message -- explanation of the error """ def __init__( self, message: str = "The prompt contains PII entities and cannot be processed" ): self.message = message super()...
langchain/libs/experimental/langchain_experimental/comprehend_moderation/base_moderation_exceptions.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/comprehend_moderation/base_moderation_exceptions.py", "repo_id": "langchain", "token_count": 367 }
427