text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-metal/llama_index/readers/metal/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-metal/llama_index/readers/metal/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,427
// 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/actions_test.go/0
{ "file_path": "milvus/internal/datanode/metacache/actions_test.go", "repo_id": "milvus", "token_count": 1153 }
1,805
.. _Ref-Service-Context: Service Context ================= The service context container is a utility container for LlamaIndex index and query classes. The container contains the following objects that are commonly used for configuring every index and query, such as the LLM, the PromptHelper (for configuring input si...
llama_index/docs/api_reference/service_context.rst/0
{ "file_path": "llama_index/docs/api_reference/service_context.rst", "repo_id": "llama_index", "token_count": 211 }
1,062
from langchain_community.vectorstores.pinecone import Pinecone __all__ = ["Pinecone"]
langchain/libs/langchain/langchain/vectorstores/pinecone.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/pinecone.py", "repo_id": "langchain", "token_count": 26 }
584
# coding=utf-8 # Copyright 2018 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/convert_pytorch_checkpoint_to_tf2.py/0
{ "file_path": "transformers/src/transformers/convert_pytorch_checkpoint_to_tf2.py", "repo_id": "transformers", "token_count": 7993 }
618
"""Init file for langchain helpers.""" try: import langchain # noqa except ImportError: raise ImportError( "langchain not installed. " "Please install langchain with `pip install llama_index[langchain]`." )
llama_index/llama-index-legacy/llama_index/legacy/langchain_helpers/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/langchain_helpers/__init__.py", "repo_id": "llama_index", "token_count": 86 }
1,672
[project] name = "chromadb" dynamic = ["version"] authors = [ { name="Jeff Huber", email="jeff@trychroma.com" }, { name="Anton Troynikov", email="anton@trychroma.com" } ] description = "Chroma." readme = "README.md" requires-python = ">=3.8" classifiers = [ "Programming Language :: Python :: 3", "License :...
chroma/pyproject.toml/0
{ "file_path": "chroma/pyproject.toml", "repo_id": "chroma", "token_count": 886 }
55
# Copyright 2019 The TensorFlow Authors, The Hugging Face 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 # # Unl...
transformers/src/transformers/optimization_tf.py/0
{ "file_path": "transformers/src/transformers/optimization_tf.py", "repo_id": "transformers", "token_count": 6957 }
698
import transformers from tokenizers.implementations import SentencePieceUnigramTokenizer, BaseTokenizer from tokenizers.processors import TemplateProcessing from tokenizers.models import Unigram, BPE from tokenizers import decoders from tokenizers import Tokenizer, Regex from tokenizers.normalizers import ( StripAc...
tokenizers/bindings/python/scripts/convert.py/0
{ "file_path": "tokenizers/bindings/python/scripts/convert.py", "repo_id": "tokenizers", "token_count": 6438 }
464
{ "openapi": "3.0.1", "info": { "title": "Shop", "description": "Search for millions of products from the world's greatest brands.", "version": "v1" }, "servers": [ { "url": "https://server.shop.app" } ], "paths": { "/openai/search": { "get": { ...
langchain/libs/community/tests/unit_tests/examples/test_specs/shop/apispec.json/0
{ "file_path": "langchain/libs/community/tests/unit_tests/examples/test_specs/shop/apispec.json", "repo_id": "langchain", "token_count": 3242 }
406
# 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/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/fastspeech2_conformer/configuration_fastspeech2_conformer.py/0
{ "file_path": "transformers/src/transformers/models/fastspeech2_conformer/configuration_fastspeech2_conformer.py", "repo_id": "transformers", "token_count": 9839 }
633
import inspect from typing import List, Optional, Tuple, Union import torch from torch.nn import functional as F from transformers import CLIPTextModelWithProjection, CLIPTokenizer from transformers.models.clip.modeling_clip import CLIPTextModelOutput from diffusers import ( DiffusionPipeline, ImagePipelineOu...
diffusers/examples/community/unclip_text_interpolation.py/0
{ "file_path": "diffusers/examples/community/unclip_text_interpolation.py", "repo_id": "diffusers", "token_count": 11575 }
217
use super::with_tracing::{linear, Embedding, Linear}; use candle::{Result, Tensor}; use candle_nn::{layer_norm, LayerNorm, VarBuilder}; #[derive(Debug, Clone)] pub struct Config { pub vocab_size: usize, pub decoder_vocab_size: Option<usize>, pub max_position_embeddings: usize, pub encoder_layers: usize...
candle/candle-transformers/src/models/marian.rs/0
{ "file_path": "candle/candle-transformers/src/models/marian.rs", "repo_id": "candle", "token_count": 8917 }
71
<jupyter_start><jupyter_text>Préparer des données (TensorFlow) Installez les bibliothèques 🤗 *Transformers* et 🤗 *Datasets* pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece] import tensorflow as tf import numpy as np from transformers import AutoTokenizer, TFAutoModelForSequ...
notebooks/course/fr/chapter3/section2_tf.ipynb/0
{ "file_path": "notebooks/course/fr/chapter3/section2_tf.ipynb", "repo_id": "notebooks", "token_count": 1005 }
268
"""Chain that interprets a prompt and executes bash operations.""" from __future__ import annotations import logging import warnings from typing import Any, Dict, List, Optional from langchain.callbacks.manager import CallbackManagerForChainRun from langchain.chains.base import Chain from langchain.chains.llm import ...
langchain/libs/experimental/langchain_experimental/llm_bash/base.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/llm_bash/base.py", "repo_id": "langchain", "token_count": 1878 }
431
version: '3.5' services: etcd: container_name: milvus-etcd image: quay.io/coreos/etcd:v3.5.5 environment: - ETCD_AUTO_COMPACTION_MODE=revision - ETCD_AUTO_COMPACTION_RETENTION=1000 - ETCD_QUOTA_BACKEND_BYTES=4294967296 - ETCD_SNAPSHOT_COUNT=50000 volumes: - ${DOCKER_VOLU...
milvus/deployments/docker/gpu/standalone/docker-compose.yml/0
{ "file_path": "milvus/deployments/docker/gpu/standalone/docker-compose.yml", "repo_id": "milvus", "token_count": 844 }
1,763
FROM ontotext/graphdb:10.5.1 RUN mkdir -p /opt/graphdb/dist/data/repositories/langchain COPY config.ttl /opt/graphdb/dist/data/repositories/langchain/ COPY starwars-data.trig / COPY graphdb_create.sh /run.sh ENTRYPOINT bash /run.sh
langchain/libs/community/tests/integration_tests/graphs/docker-compose-ontotext-graphdb/Dockerfile/0
{ "file_path": "langchain/libs/community/tests/integration_tests/graphs/docker-compose-ontotext-graphdb/Dockerfile", "repo_id": "langchain", "token_count": 101 }
358
/* eslint-disable react/jsx-props-no-spreading */ import React from "react"; import CodeBlock from "@theme-original/CodeBlock"; function Imports({ imports }) { return ( <div style={{ paddingTop: "1.3rem", background: "var(--prism-background-color)", color: "var(--prism-color)", ...
langchain/docs/src/theme/CodeBlock/index.js/0
{ "file_path": "langchain/docs/src/theme/CodeBlock/index.js", "repo_id": "langchain", "token_count": 713 }
201
import logging from typing import Callable, List, Optional, cast from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.callbacks.base import CallbackManager from llama_index.core.constants import DEFAULT_SIMILARITY_TOP_K from llama_index.core.indices.keyword_table.utils import simple_ext...
llama_index/llama-index-integrations/retrievers/llama-index-retrievers-bm25/llama_index/retrievers/bm25/base.py/0
{ "file_path": "llama_index/llama-index-integrations/retrievers/llama-index-retrievers-bm25/llama_index/retrievers/bm25/base.py", "repo_id": "llama_index", "token_count": 1550 }
1,465
"""Simple reader that reads weather data from OpenWeatherMap API.""" from typing import List from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class WeatherReader(BaseReader): """Weather Reader. Reads the forecast & current weather of any location using OpenWe...
llama_index/llama-index-integrations/readers/llama-index-readers-weather/llama_index/readers/weather/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-weather/llama_index/readers/weather/base.py", "repo_id": "llama_index", "token_count": 1358 }
1,391
from langchain_community.document_loaders.git import GitLoader __all__ = ["GitLoader"]
langchain/libs/langchain/langchain/document_loaders/git.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/git.py", "repo_id": "langchain", "token_count": 27 }
481
[tool.poetry] name = "rag-pinecone-rerank" version = "0.1.0" description = "" authors = [ "Lance Martin <lance@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "<2" tiktoken = ">=0.5.1" pinecone-client = ">=2.2.4" cohere = ">=4.32" [tool.poetry...
langchain/templates/rag-pinecone-rerank/pyproject.toml/0
{ "file_path": "langchain/templates/rag-pinecone-rerank/pyproject.toml", "repo_id": "langchain", "token_count": 308 }
663
use super::with_tracing::{layer_norm, linear, LayerNorm, Linear}; use candle::{DType, Device, Result, Tensor}; use candle_nn::{embedding, Embedding, Module, VarBuilder}; use serde::Deserialize; pub const DTYPE: DType = DType::F32; #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)] #[serde(rename_all = "lowerca...
candle/candle-transformers/src/models/bert.rs/0
{ "file_path": "candle/candle-transformers/src/models/bert.rs", "repo_id": "candle", "token_count": 7941 }
69
"""Pandas toolkit."""
langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/pandas/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/pandas/__init__.py", "repo_id": "langchain", "token_count": 8 }
441
from typing import ( Dict, Optional, Sequence, Type, Union, ) from langchain_core.output_parsers import ( BaseGenerationOutputParser, BaseOutputParser, ) from langchain_core.prompts import BasePromptTemplate from langchain_core.pydantic_v1 import BaseModel from langchain_core.runnables impo...
langchain/libs/partners/google-vertexai/langchain_google_vertexai/chains.py/0
{ "file_path": "langchain/libs/partners/google-vertexai/langchain_google_vertexai/chains.py", "repo_id": "langchain", "token_count": 1723 }
686
"""Test Pipeline Cloud API wrapper.""" from langchain_community.llms.pipelineai import PipelineAI def test_pipelineai_call() -> None: """Test valid call to Pipeline Cloud.""" llm = PipelineAI() output = llm("Say foo:") assert isinstance(output, str)
langchain/libs/community/tests/integration_tests/llms/test_pipelineai.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_pipelineai.py", "repo_id": "langchain", "token_count": 90 }
373
[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 = ["GmailToolSpec", "GoogleCalendarToolSpec", "GoogleSearchToolSpec", "QUERY_URL_TMPL"] conta...
llama_index/llama-index-integrations/tools/llama-index-tools-google/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-google/pyproject.toml", "repo_id": "llama_index", "token_count": 737 }
1,568
"""Integration test for self ask with search.""" from langchain_community.llms.openai import OpenAI from langchain_community.utilities.searchapi import SearchApiAPIWrapper from langchain.agents.self_ask_with_search.base import SelfAskWithSearchChain def test_self_ask_with_search() -> None: """Test functionality ...
langchain/libs/langchain/tests/integration_tests/chains/test_self_ask_with_search.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/chains/test_self_ask_with_search.py", "repo_id": "langchain", "token_count": 249 }
615
python_sources() python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/beautiful_soup_web/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/beautiful_soup_web/BUILD", "repo_id": "llama_index", "token_count": 24 }
1,454
# flake8: noqa from langchain_core.prompts import PromptTemplate prompt_template = """Write a concise summary of the following: "{text}" CONCISE SUMMARY:""" PROMPT = PromptTemplate(template=prompt_template, input_variables=["text"])
langchain/libs/langchain/langchain/chains/summarize/map_reduce_prompt.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/summarize/map_reduce_prompt.py", "repo_id": "langchain", "token_count": 77 }
476
import pytest from importlib_resources import files from typing import Generator, List, Callable import chromadb.db.migrations as migrations from chromadb.db.impl.sqlite import SqliteDB from chromadb.config import System, Settings from pytest import FixtureRequest import copy def sqlite() -> Generator[migrations.Migr...
chroma/chromadb/test/db/test_migrations.py/0
{ "file_path": "chroma/chromadb/test/db/test_migrations.py", "repo_id": "chroma", "token_count": 2014 }
21
import multiprocessing import numbers import random import numpy import threading import pytest import pandas as pd import decimal from decimal import Decimal, getcontext from time import sleep import heapq from pymilvus import DataType from base.client_base import TestcaseBase from utils.util_log import test_log as l...
milvus/tests/python_client/milvus_client/test_milvus_client_collection.py/0
{ "file_path": "milvus/tests/python_client/milvus_client/test_milvus_client_collection.py", "repo_id": "milvus", "token_count": 24531 }
2,124
--- hide_table_of_contents: true --- # MultiVector Retriever It can often be beneficial to store multiple vectors per document. LangChain has a base MultiVectorRetriever which makes querying this type of setup easier! A lot of the complexity lies in how to create the multiple vectors per document. This notebook cove...
langchainjs/docs/core_docs/docs/modules/data_connection/retrievers/multi-vector-retriever.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/retrievers/multi-vector-retriever.mdx", "repo_id": "langchainjs", "token_count": 640 }
788
from neo4j_semantic_layer.agent import agent_executor __all__ = ["agent_executor"]
langchain/templates/neo4j-semantic-layer/neo4j_semantic_layer/__init__.py/0
{ "file_path": "langchain/templates/neo4j-semantic-layer/neo4j_semantic_layer/__init__.py", "repo_id": "langchain", "token_count": 29 }
677
import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import { Document } from "@langchain/core/documents"; const text = `Some other considerations include: - Do you deploy your backend and frontend together, or separately? - Do you deploy your backend co-located with your database, or separately?...
langchainjs/examples/src/indexes/recursive_text_splitter_custom_separators.ts/0
{ "file_path": "langchainjs/examples/src/indexes/recursive_text_splitter_custom_separators.ts", "repo_id": "langchainjs", "token_count": 966 }
844
"""**Docstores** are classes to store and load Documents. The **Docstore** is a simplified version of the Document Loader. **Class hierarchy:** .. code-block:: Docstore --> <name> # Examples: InMemoryDocstore, Wikipedia **Main helpers:** .. code-block:: Document, AddableMixin """ from langchain_community...
langchain/libs/community/langchain_community/docstore/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/docstore/__init__.py", "repo_id": "langchain", "token_count": 162 }
242
from typing import TYPE_CHECKING from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 TreeSitterSegmenter, ) if TYPE_CHECKING: from tree_sitter import Language CHUNK_QUERY = """ [ (function_declaration) @function (class_declaration) @cla...
langchain/libs/community/langchain_community/document_loaders/parsers/language/kotlin.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/parsers/language/kotlin.py", "repo_id": "langchain", "token_count": 281 }
255
"""Test Vertex AI API wrapper. In order to run this test, you need to install VertexAI SDK pip install google-cloud-aiplatform>=1.35.0 Your end-user credentials would be used to make the calls (make sure you've run `gcloud auth login` first). """ import pytest from langchain_community.embeddings import VertexAIEmbedd...
langchain/libs/community/tests/integration_tests/embeddings/test_vertexai.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/embeddings/test_vertexai.py", "repo_id": "langchain", "token_count": 804 }
363
import type { Conversation } from "$lib/types/Conversation"; import type { TextGenerationStreamOutput } from "@huggingface/inference"; import { endpointTgi, endpointTgiParametersSchema } from "./tgi/endpointTgi"; import { z } from "zod"; import endpointAws, { endpointAwsParametersSchema } from "./aws/endpointAws"; impo...
chat-ui/src/lib/server/endpoints/endpoints.ts/0
{ "file_path": "chat-ui/src/lib/server/endpoints/endpoints.ts", "repo_id": "chat-ui", "token_count": 495 }
101
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-everlyai/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-everlyai/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,220
"""Unit tests for ReAct.""" from typing import Union from langchain_community.llms.fake import FakeListLLM from langchain_core.agents import AgentAction from langchain_core.documents import Document from langchain_core.prompts.prompt import PromptTemplate from langchain_core.tools import Tool from langchain.agents.r...
langchain/libs/langchain/tests/unit_tests/agents/test_react.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/agents/test_react.py", "repo_id": "langchain", "token_count": 859 }
601
# coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. # Copyright (c) 2022, 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 # # http://www.a...
diffusers/src/diffusers/pipelines/onnx_utils.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/onnx_utils.py", "repo_id": "diffusers", "token_count": 3622 }
262
version: "3.8" services: neo4j: image: neo4j:5.11.0 restart: on-failure:0 hostname: neo4j-test container_name: neo4j-test ports: - 7474:7474 - 7687:7687 environment: - NEO4J_AUTH=neo4j/pleaseletmein
langchain/libs/community/tests/integration_tests/vectorstores/docker-compose/neo4j.yml/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/docker-compose/neo4j.yml", "repo_id": "langchain", "token_count": 128 }
371
from sql_ollama.chain import chain __all__ = ["chain"]
langchain/templates/sql-ollama/sql_ollama/__init__.py/0
{ "file_path": "langchain/templates/sql-ollama/sql_ollama/__init__.py", "repo_id": "langchain", "token_count": 19 }
704
include Cargo.toml include pyproject.toml include rust-toolchain include ../../LICENSE recursive-include src * recursive-include tokenizers-lib * recursive-exclude tokenizers-lib/target *
tokenizers/bindings/python/MANIFEST.in/0
{ "file_path": "tokenizers/bindings/python/MANIFEST.in", "repo_id": "tokenizers", "token_count": 57 }
439
[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 = ["MangoppsGuidesReader"] contains_example = false import_path = "llama_index.readers.mangoa...
llama_index/llama-index-integrations/readers/llama-index-readers-mangoapps-guides/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mangoapps-guides/pyproject.toml", "repo_id": "llama_index", "token_count": 695 }
1,518
<jupyter_start><jupyter_text>Xorbits InferenceIn this demo notebook, we show how to use Xorbits Inference (Xinference for short) to deploy local LLMs in three steps.We will be using the Llama 2 chat model in GGML format in the example, but the code should be easily transfrerable to all LLM chat models supported by Xinf...
llama_index/docs/examples/llm/xinference_local_deployment.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/xinference_local_deployment.ipynb", "repo_id": "llama_index", "token_count": 2182 }
1,197
import abc import copy import dataclasses from dataclasses import dataclass from typing import ClassVar, Dict, Type, TypeVar from ..features import Features T = TypeVar("T", bound="TaskTemplate") @dataclass(frozen=True) class TaskTemplate(abc.ABC): # `task` is not a ClassVar since we want it to be part of the ...
datasets/src/datasets/tasks/base.py/0
{ "file_path": "datasets/src/datasets/tasks/base.py", "repo_id": "datasets", "token_count": 417 }
156
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/query_pipeline/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/query_pipeline/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,514
from typing import Optional from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import Field from langchain_core.tools import BaseTool from langchain_community.utilities.pubmed import PubMedAPIWrapper class PubmedQueryRun(BaseTool): """Tool that searches the PubMed API...
langchain/libs/community/langchain_community/tools/pubmed/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/pubmed/tool.py", "repo_id": "langchain", "token_count": 331 }
293
# neo4j-semantic-layer This template is designed to implement an agent capable of interacting with a graph database like Neo4j through a semantic layer using OpenAI function calling. The semantic layer equips the agent with a suite of robust tools, allowing it to interact with the graph databas based on the user's int...
langchain/templates/neo4j-semantic-layer/README.md/0
{ "file_path": "langchain/templates/neo4j-semantic-layer/README.md", "repo_id": "langchain", "token_count": 1113 }
651
from llama_index.packs.llama_guard_moderator.base import LlamaGuardModeratorPack __all__ = ["LlamaGuardModeratorPack"]
llama_index/llama-index-packs/llama-index-packs-llama-guard-moderator/llama_index/packs/llama_guard_moderator/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-llama-guard-moderator/llama_index/packs/llama_guard_moderator/__init__.py", "repo_id": "llama_index", "token_count": 43 }
1,574
from llama_index.legacy.indices.managed.base import BaseManagedIndex from llama_index.legacy.indices.managed.vectara.base import VectaraIndex from llama_index.legacy.indices.managed.vectara.retriever import VectaraRetriever from llama_index.legacy.indices.managed.zilliz.base import ZillizCloudPipelineIndex from llama_i...
llama_index/llama-index-legacy/llama_index/legacy/indices/managed/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/managed/__init__.py", "repo_id": "llama_index", "token_count": 216 }
1,498
version: "3.8" services: meilisearch: image: getmeili/meilisearch:latest environment: - MEILI_MASTER_KEY=${MEILI_MASTER_KEY:-masterKey} - MEILI_NO_ANALYTICS=${MEILI_NO_ANALYTICS:-true} - MEILI_ENV=${MEILI_ENV:-development} ports: - ${MEILI_PORT:-7700}:7700 restart: unless-stop...
langchain/libs/community/tests/integration_tests/vectorstores/docker-compose/meilisearch.yaml/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/docker-compose/meilisearch.yaml", "repo_id": "langchain", "token_count": 227 }
379
from llama_index.storage.kvstore.dynamodb.base import DynamoDBKVStore __all__ = ["DynamoDBKVStore"]
llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-dynamodb/llama_index/storage/kvstore/dynamodb/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-dynamodb/llama_index/storage/kvstore/dynamodb/__init__.py", "repo_id": "llama_index", "token_count": 40 }
1,466
from langchain_community.chat_models.human import ( HumanInputChatModel, ) __all__ = ["HumanInputChatModel"]
langchain/libs/langchain/langchain/chat_models/human.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_models/human.py", "repo_id": "langchain", "token_count": 37 }
474
import re import unittest from typing import Tuple import pytest from langchain_experimental.tot.base import ToTChain from langchain_experimental.tot.checker import ToTChecker from langchain_experimental.tot.controller import ToTController from langchain_experimental.tot.memory import ToTDFSMemory from langchain_expe...
langchain/libs/experimental/tests/unit_tests/test_tot.py/0
{ "file_path": "langchain/libs/experimental/tests/unit_tests/test_tot.py", "repo_id": "langchain", "token_count": 2725 }
460
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/unispeech_sat/convert_unispeech_original_s3prl_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/unispeech_sat/convert_unispeech_original_s3prl_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 1692 }
743
from __future__ import annotations from typing import Any, List, Literal from langchain_core.load.serializable import Serializable from langchain_core.pydantic_v1 import Field class Document(Serializable): """Class for storing a piece of text and associated metadata.""" page_content: str """String text...
langchain/libs/core/langchain_core/documents/base.py/0
{ "file_path": "langchain/libs/core/langchain_core/documents/base.py", "repo_id": "langchain", "token_count": 355 }
411
from langchain_core.exceptions import OutputParserException from langchain.output_parsers import ResponseSchema, StructuredOutputParser def test_parse() -> None: response_schemas = [ ResponseSchema(name="name", description="desc"), ResponseSchema(name="age", description="desc"), ] parser ...
langchain/libs/langchain/tests/unit_tests/output_parsers/test_structured_parser.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/output_parsers/test_structured_parser.py", "repo_id": "langchain", "token_count": 331 }
601
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/examples/legacy/seq2seq/seq2seq_training_args.py/0
{ "file_path": "transformers/examples/legacy/seq2seq/seq2seq_training_args.py", "repo_id": "transformers", "token_count": 888 }
511
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/commands/serving.py/0
{ "file_path": "transformers/src/transformers/commands/serving.py", "repo_id": "transformers", "token_count": 3477 }
591
from langchain_core.messages import AIMessage, HumanMessage from langchain_community.chat_models.baichuan import ChatBaichuan # For testing, run: # TEST_FILE=tests/integration_tests/chat_models/test_baichuan.py make test def test_chat_baichuan_default() -> None: chat = ChatBaichuan(streaming=True) message =...
langchain/libs/community/tests/integration_tests/chat_models/test_baichuan.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_models/test_baichuan.py", "repo_id": "langchain", "token_count": 795 }
335
from typing import Any, Dict from llama_index.core.agent import ReActAgent from llama_index.core.llama_pack.base import BaseLlamaPack class CogniswitchAgentPack(BaseLlamaPack): def __init__(self, cogniswitch_tool_kwargs: Dict[str, Any]) -> None: """Init params.""" try: from llama_inde...
llama_index/llama-index-packs/llama-index-packs-cogniswitch-agent/llama_index/packs/cogniswitch_agent/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-cogniswitch-agent/llama_index/packs/cogniswitch_agent/base.py", "repo_id": "llama_index", "token_count": 360 }
1,695
""" Pytorch Inception-V4 implementation Sourced from https://github.com/Cadene/tensorflow-model-zoo.torch (MIT License) which is based upon Google's Tensorflow implementation and pretrained weights (Apache 2.0 License) """ from functools import partial import torch import torch.nn as nn from timm.data import IMAGENET...
pytorch-image-models/timm/models/inception_v4.py/0
{ "file_path": "pytorch-image-models/timm/models/inception_v4.py", "repo_id": "pytorch-image-models", "token_count": 5528 }
386
// 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/rootcoord/create_partition_task_test.go/0
{ "file_path": "milvus/internal/rootcoord/create_partition_task_test.go", "repo_id": "milvus", "token_count": 2460 }
2,055
# StripeDocs Loader This loader asynchronously loads data from the [Stripe documentation](https://stripe.com/docs). It iterates through the Stripe sitemap to get all `/docs` references. It is based on the [Async Website Loader](https://llamahub.ai/l/web-async_web). ## Usage ```python from llama_index import VectorS...
llama_index/llama-index-integrations/readers/llama-index-readers-stripe-docs/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-stripe-docs/README.md", "repo_id": "llama_index", "token_count": 335 }
1,424
<jupyter_start><jupyter_text>Fine-Tuning and GuidanceIn this notebook, we're going to cover two main approaches for adapting existing diffusion models:* With **fine-tuning**, we'll re-train existing models on new data to change the type of output they produce* With **guidance**, we'll take an existing model and steer t...
diffusion-models-class/unit2/01_finetuning_and_guidance.ipynb/0
{ "file_path": "diffusion-models-class/unit2/01_finetuning_and_guidance.ipynb", "repo_id": "diffusion-models-class", "token_count": 11877 }
292
"""Web base loader class.""" import asyncio import logging import warnings from typing import Any, Dict, Iterator, List, Optional, Sequence, Union import aiohttp import requests from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader logger = logging.getLogger(_...
langchain/libs/community/langchain_community/document_loaders/web_base.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/web_base.py", "repo_id": "langchain", "token_count": 4893 }
251
import { expect, test } from "@jest/globals"; import chroma from "./initClient"; import { DOCUMENTS, EMBEDDINGS, IDS, METADATAS } from "./data"; test("it should get a collection", async () => { await chroma.reset(); const collection = await chroma.createCollection({ name: "test" }); await collection.add({ ids: I...
chroma/clients/js/test/get.collection.test.ts/0
{ "file_path": "chroma/clients/js/test/get.collection.test.ts", "repo_id": "chroma", "token_count": 880 }
34
from langchain_community.retrievers.chaindesk import ChaindeskRetriever __all__ = ["ChaindeskRetriever"]
langchain/libs/langchain/langchain/retrievers/chaindesk.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/chaindesk.py", "repo_id": "langchain", "token_count": 35 }
529
package msgstream import "context" type MockMqFactory struct { Factory NewMsgStreamFunc func(ctx context.Context) (MsgStream, error) } func NewMockMqFactory() *MockMqFactory { return &MockMqFactory{} } func (m MockMqFactory) NewMsgStream(ctx context.Context) (MsgStream, error) { return m.NewMsgStreamFunc(ctx) }...
milvus/pkg/mq/msgstream/mock_mq_factory.go/0
{ "file_path": "milvus/pkg/mq/msgstream/mock_mq_factory.go", "repo_id": "milvus", "token_count": 158 }
2,093
from llama_index.question_gen.guidance.base import GuidanceQuestionGenerator __all__ = ["GuidanceQuestionGenerator"]
llama_index/llama-index-integrations/question_gen/llama-index-question-gen-guidance/llama_index/question_gen/guidance/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/question_gen/llama-index-question-gen-guidance/llama_index/question_gen/guidance/__init__.py", "repo_id": "llama_index", "token_count": 36 }
1,273
"""Utilities for running language models or Chains over datasets.""" from __future__ import annotations import dataclasses import functools import inspect import logging import uuid from datetime import datetime, timezone from enum import Enum from typing import ( TYPE_CHECKING, Any, Callable, Dict, ...
langchain/libs/langchain/langchain/smith/evaluation/runner_utils.py/0
{ "file_path": "langchain/libs/langchain/langchain/smith/evaluation/runner_utils.py", "repo_id": "langchain", "token_count": 23346 }
551
.PHONY: quality style test docs check_dirs := src tests examples docs scripts docker # Check that source code meets quality standards # this target runs checks on all files quality: ruff $(check_dirs) ruff format --check $(check_dirs) doc-builder style src/peft tests docs/source --max_len 119 --check_only # Form...
peft/Makefile/0
{ "file_path": "peft/Makefile", "repo_id": "peft", "token_count": 909 }
332
from langchain_community.callbacks.tracers.comet import ( CometTracer, import_comet_llm_api, ) __all__ = ["import_comet_llm_api", "CometTracer"]
langchain/libs/langchain/langchain/callbacks/tracers/comet.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/tracers/comet.py", "repo_id": "langchain", "token_count": 64 }
459
package kvfactory import ( "fmt" "sync" clientv3 "go.etcd.io/etcd/client/v3" "github.com/milvus-io/milvus/pkg/util/etcd" "github.com/milvus-io/milvus/pkg/util/paramtable" ) var clientCreator = &etcdClientCreator{} var getEtcdAndPathFunction = getEtcdAndPath type etcdClientCreator struct { mu sync.Mute...
milvus/internal/util/dependency/kv/kv_client_handler.go/0
{ "file_path": "milvus/internal/util/dependency/kv/kv_client_handler.go", "repo_id": "milvus", "token_count": 844 }
1,895
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
transformers/src/transformers/tools/agent_types.py/0
{ "file_path": "transformers/src/transformers/tools/agent_types.py", "repo_id": "transformers", "token_count": 3899 }
731
<jupyter_start><jupyter_text>Metal Vector Store Creating a Metal Vector Store 1. Register an account for [Metal](https://app.getmetal.io/)2. Generate an API key in [Metal's Settings](https://app.getmetal.io/settings/organization). Save the `api_key` + `client_id`3. Generate an Index in [Metal's Dashboard](https://app....
llama_index/docs/examples/vector_stores/MetalIndexDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/MetalIndexDemo.ipynb", "repo_id": "llama_index", "token_count": 619 }
1,090
from __future__ import annotations import asyncio import json from pathlib import Path from typing import TYPE_CHECKING, Dict, List, Optional, Union from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader if TYPE_CHECKING: import pandas as pd from telet...
langchain/libs/community/langchain_community/document_loaders/telegram.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/telegram.py", "repo_id": "langchain", "token_count": 4179 }
249
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/rembert/test_modeling_tf_rembert.py/0
{ "file_path": "transformers/tests/models/rembert/test_modeling_tf_rembert.py", "repo_id": "transformers", "token_count": 12938 }
784
"""Callback Handler that prints to std out.""" import threading from typing import Any, Dict, List from langchain_core.callbacks import BaseCallbackHandler from langchain_core.outputs import LLMResult MODEL_COST_PER_1K_TOKENS = { # GPT-4 input "gpt-4": 0.03, "gpt-4-0314": 0.03, "gpt-4-0613": 0.03, ...
langchain/libs/community/langchain_community/callbacks/openai_info.py/0
{ "file_path": "langchain/libs/community/langchain_community/callbacks/openai_info.py", "repo_id": "langchain", "token_count": 3978 }
231
<jupyter_start><jupyter_text>Gradient Model Adapter<jupyter_code>%pip install llama-index-embeddings-langchain %pip install llama-index-llms-gradient %pip install llama-index --quiet %pip install gradientai --quiet import os os.environ["GRADIENT_ACCESS_TOKEN"] = "{GRADIENT_ACCESS_TOKEN}" os.environ["GRADIENT_WORKSPACE...
llama_index/docs/examples/llm/gradient_model_adapter.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/gradient_model_adapter.ipynb", "repo_id": "llama_index", "token_count": 725 }
1,193
from langchain import storage from tests.unit_tests import assert_all_importable EXPECTED_ALL = [ "EncoderBackedStore", "InMemoryStore", "InMemoryByteStore", "LocalFileStore", "RedisStore", "create_lc_store", "create_kv_docstore", "UpstashRedisByteStore", "UpstashRedisStore", ] de...
langchain/libs/langchain/tests/unit_tests/storage/test_imports.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/storage/test_imports.py", "repo_id": "langchain", "token_count": 176 }
654
#!/bin/bash # 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...
milvus/build/build_image.sh/0
{ "file_path": "milvus/build/build_image.sh", "repo_id": "milvus", "token_count": 646 }
1,700
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,482
from langchain_community.graphs.hugegraph import HugeGraph __all__ = ["HugeGraph"]
langchain/libs/langchain/langchain/graphs/hugegraph.py/0
{ "file_path": "langchain/libs/langchain/langchain/graphs/hugegraph.py", "repo_id": "langchain", "token_count": 26 }
532
import { HandlebarsPromptTemplate } from "../handlebars.js"; describe.each([ ["{{foo}}", { foo: "bar" }, "bar"], ["pre{{foo}}post", { foo: "bar" }, "prebarpost"], ["{{{foo}}}", { foo: "bar" }, "bar"], ["text", {}, "text"], ["}}", {}, "}}"], ["{{first}}_{{second}}", { first: "foo", second: "bar" }, "foo_bar...
langchainjs/langchain/src/experimental/prompts/tests/handlebars.test.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/prompts/tests/handlebars.test.ts", "repo_id": "langchainjs", "token_count": 319 }
926
import { load as coreLoad } from "@langchain/core/load"; import { optionalImportEntrypoints } from "./import_constants.js"; import * as importMap from "./import_map.js"; import { OptionalImportMap } from "./import_type.js"; /** * Load a LangChain module from a serialized text representation. * NOTE: This functionali...
langchainjs/langchain/src/load/index.ts/0
{ "file_path": "langchainjs/langchain/src/load/index.ts", "repo_id": "langchainjs", "token_count": 302 }
931
import { GithubRepoLoader } from "langchain/document_loaders/web/github"; export const run = async () => { const loader = new GithubRepoLoader( "https://github.com/langchain-ai/langchainjs", { branch: "main", recursive: false, unknown: "warn", maxConcurrency: 3, // Defaults to 2 }...
langchainjs/examples/src/document_loaders/github_stream.ts/0
{ "file_path": "langchainjs/examples/src/document_loaders/github_stream.ts", "repo_id": "langchainjs", "token_count": 169 }
795
kind: NetworkChaos apiVersion: chaos-mesh.org/v1alpha1 metadata: name: test-pulsar-network-latency namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: release: milvus-chaos app: pulsar mode: all action: delay delay: latency: 200ms correlatio...
milvus/tests/python_client/chaos/chaos_objects/network_latency/chaos_pulsar_network_latency.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/network_latency/chaos_pulsar_network_latency.yaml", "repo_id": "milvus", "token_count": 218 }
1,989
from langchain_community.document_loaders.iugu import IuguLoader __all__ = ["IuguLoader"]
langchain/libs/langchain/langchain/document_loaders/iugu.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/iugu.py", "repo_id": "langchain", "token_count": 29 }
483
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/convbert/modeling_convbert.py/0
{ "file_path": "transformers/src/transformers/models/convbert/modeling_convbert.py", "repo_id": "transformers", "token_count": 25449 }
637
import { NIBittensorLLM } from "langchain/experimental/llms/bittensor"; const model = new NIBittensorLLM(); const res = await model.call(`What is Bittensor?`); console.log({ res }); /* { res: "\nBittensor is opensource protocol..." } */
langchainjs/examples/src/models/llm/ni_bittensor.ts/0
{ "file_path": "langchainjs/examples/src/models/llm/ni_bittensor.ts", "repo_id": "langchainjs", "token_count": 92 }
904
#[macro_use] extern crate criterion; use criterion::Criterion; use std::collections::HashMap; use std::fs::read_to_string; use std::time::{Duration, Instant}; use tokenizers::models::unigram::Unigram; use tokenizers::models::unigram::UnigramTrainer; pub fn bench_train(c: &mut Criterion) { let trainer = UnigramTra...
tokenizers/tokenizers/benches/unigram_benchmark.rs/0
{ "file_path": "tokenizers/tokenizers/benches/unigram_benchmark.rs", "repo_id": "tokenizers", "token_count": 1174 }
453
from __future__ import annotations from typing import Any, List, Optional, Sequence from langchain_core.language_models import BaseLanguageModel from langchain_core.pydantic_v1 import Field from langchain_core.tools import BaseTool from langchain_community.agent_toolkits.base import BaseToolkit from langchain_commun...
langchain/libs/community/langchain_community/agent_toolkits/nla/toolkit.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/nla/toolkit.py", "repo_id": "langchain", "token_count": 1902 }
207
label: 'Adapters'
langchain/docs/docs/integrations/adapters/_category_.yml/0
{ "file_path": "langchain/docs/docs/integrations/adapters/_category_.yml", "repo_id": "langchain", "token_count": 7 }
92
import { JsonForms } from "@jsonforms/react"; import { JsonFormsCore, JsonSchema } from "@jsonforms/core"; import { renderers, cells } from "../renderers"; export type ConfigValue = Pick<JsonFormsCore, "data" | "errors"> & { defaults: boolean; }; export function SectionConfigure(props: { config: JsonSchema | unde...
langserve/langserve/playground/src/sections/SectionConfigure.tsx/0
{ "file_path": "langserve/langserve/playground/src/sections/SectionConfigure.tsx", "repo_id": "langserve", "token_count": 742 }
1,046
/****************************************************************************** * Copyright (c) 2023, Tri Dao. ******************************************************************************/ #pragma once namespace flash { /////////////////////////////////////////////////////////////////////////////////////////////...
candle/candle-flash-attn/kernels/block_info.h/0
{ "file_path": "candle/candle-flash-attn/kernels/block_info.h", "repo_id": "candle", "token_count": 851 }
53
# ChatGPT Plugin Integrations **NOTE**: This is a work-in-progress, stay tuned for more exciting updates on this front! ## ChatGPT Retrieval Plugin Integrations The [OpenAI ChatGPT Retrieval Plugin](https://github.com/openai/chatgpt-retrieval-plugin) offers a centralized API specification for any document storage sy...
llama_index/docs/community/integrations/chatgpt_plugins.md/0
{ "file_path": "llama_index/docs/community/integrations/chatgpt_plugins.md", "repo_id": "llama_index", "token_count": 1493 }
1,099