text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from langchain_community.tools.dataforseo_api_search.tool import ( DataForSeoAPISearchResults, DataForSeoAPISearchRun, ) __all__ = ["DataForSeoAPISearchRun", "DataForSeoAPISearchResults"]
langchain/libs/langchain/langchain/tools/dataforseo_api_search/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/dataforseo_api_search/tool.py", "repo_id": "langchain", "token_count": 75 }
597
from llama_index.callbacks.wandb.base import WandbCallbackHandler __all__ = ["WandbCallbackHandler"]
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-wandb/llama_index/callbacks/wandb/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-wandb/llama_index/callbacks/wandb/__init__.py", "repo_id": "llama_index", "token_count": 33 }
1,187
from collections import ChainMap from typing import ( Any, Callable, Dict, List, Optional, Protocol, Sequence, get_args, runtime_checkable, ) from llama_index.core.base.llms.types import ( ChatMessage, ChatResponseAsyncGen, ChatResponseGen, CompletionResponseAsyncGen...
llama_index/llama-index-core/llama_index/core/llms/llm.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/llms/llm.py", "repo_id": "llama_index", "token_count": 6636 }
1,160
"""Reader that uses a Github Repo. Repo taken from: https://github.com/mpoon/gpt-repository-loader License attached: MIT License Copyright (c) 2023 mpoon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the...
llama_index/llama-index-integrations/readers/llama-index-readers-gpt-repo/llama_index/readers/gpt_repo/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-gpt-repo/llama_index/readers/gpt_repo/base.py", "repo_id": "llama_index", "token_count": 2241 }
1,372
<!--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/unispeech.md/0
{ "file_path": "transformers/docs/source/en/model_doc/unispeech.md", "repo_id": "transformers", "token_count": 853 }
472
from ... import PretrainedConfig NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class NezhaConfig(PretrainedConfig): r""" This is the configuration class to store the configuration of an [`NezhaModel`]. It is us...
transformers/src/transformers/models/nezha/configuration_nezha.py/0
{ "file_path": "transformers/src/transformers/models/nezha/configuration_nezha.py", "repo_id": "transformers", "token_count": 1967 }
699
# coding=utf-8 # Copyright 2020-present 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 ap...
transformers/src/transformers/trainer.py/0
{ "file_path": "transformers/src/transformers/trainer.py", "repo_id": "transformers", "token_count": 91890 }
733
# Copyright 2024 Katherine Crowson and 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...
diffusers/src/diffusers/schedulers/scheduling_lms_discrete_flax.py/0
{ "file_path": "diffusers/src/diffusers/schedulers/scheduling_lms_discrete_flax.py", "repo_id": "diffusers", "token_count": 4681 }
266
from chromadb.db.impl.sqlite_pool import Connection, LockPool, PerThreadPool, Pool from chromadb.db.migrations import MigratableDB, Migration from chromadb.config import System, Settings import chromadb.db.base as base from chromadb.db.mixins.embeddings_queue import SqlEmbeddingsQueue from chromadb.db.mixins.sysdb impo...
chroma/chromadb/db/impl/sqlite.py/0
{ "file_path": "chroma/chromadb/db/impl/sqlite.py", "repo_id": "chroma", "token_count": 4008 }
18
# (Gluon) Inception v3 **Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifer](https://paperswit...
pytorch-image-models/docs/models/.templates/models/gloun-inception-v3.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/gloun-inception-v3.md", "repo_id": "pytorch-image-models", "token_count": 1073 }
336
import { BaseCumulativeTransformOutputParser } from "./transform.js"; import { Operation, compare } from "../utils/json_patch.js"; import { ChatGeneration, Generation } from "../outputs.js"; /** * Class for parsing the output of an LLM into a JSON object. */ export class JsonOutputParser< // eslint-disable-next-li...
langchainjs/langchain-core/src/output_parsers/json.ts/0
{ "file_path": "langchainjs/langchain-core/src/output_parsers/json.ts", "repo_id": "langchainjs", "token_count": 1340 }
927
# LlamaIndex Llms Integration: Mistral
llama_index/llama-index-integrations/llms/llama-index-llms-mistralai/README.md/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-mistralai/README.md", "repo_id": "llama_index", "token_count": 11 }
1,229
# coding=utf-8 # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
transformers/tests/models/mluke/test_tokenization_mluke.py/0
{ "file_path": "transformers/tests/models/mluke/test_tokenization_mluke.py", "repo_id": "transformers", "token_count": 14687 }
826
package indexnode import ( "fmt" "net/url" "os" "sync" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/server/v3/embed" "go.etcd.io/etcd/server/v3/etcdserver/api/v3client" ) const ( etcdListenPort = 2389 etcdPeerPort = 2390 ) var ( startSvr sync.Once stopSvr sync.Once etcdSvr *embed.Etcd ) fu...
milvus/internal/indexnode/etcd_mock.go/0
{ "file_path": "milvus/internal/indexnode/etcd_mock.go", "repo_id": "milvus", "token_count": 547 }
1,990
from langchain import hub from langchain_community.chat_models import ChatAnthropic from langchain_core.output_parsers import StrOutputParser # Create chain prompt = hub.pull("hwchase17/anthropic-paper-qa") model = ChatAnthropic(model="claude-2", max_tokens=10000) chain = prompt | model | StrOutputParser()
langchain/templates/summarize-anthropic/summarize_anthropic/chain.py/0
{ "file_path": "langchain/templates/summarize-anthropic/summarize_anthropic/chain.py", "repo_id": "langchain", "token_count": 97 }
706
variable "chroma_image_reg_url" { description = "The URL of the chroma-core image registry (e.g. docker.io/chromadb/chroma). The URL must also include the image itself without the tag." type = string default = "docker.io/chromadb/chroma" } variable "chroma_release" { description = "The chroma releas...
chroma/examples/deployments/render-terraform/variables.tf/0
{ "file_path": "chroma/examples/deployments/render-terraform/variables.tf", "repo_id": "chroma", "token_count": 622 }
42
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-openalex/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-openalex/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,358
<!--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/zh/big_models.md/0
{ "file_path": "transformers/docs/source/zh/big_models.md", "repo_id": "transformers", "token_count": 3096 }
513
# How to contribute to Datasets? [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](CODE_OF_CONDUCT.md) Datasets is an open source project, so all contributions and suggestions are welcome. You can contribute in many different ways: giving ideas, answering questions, reporti...
datasets/CONTRIBUTING.md/0
{ "file_path": "datasets/CONTRIBUTING.md", "repo_id": "datasets", "token_count": 1715 }
106
"""Test Alibaba Tongyi Chat Model.""" from langchain_core.callbacks import CallbackManager from langchain_core.messages import AIMessage, BaseMessage, HumanMessage from langchain_core.outputs import ChatGeneration, LLMResult from langchain_community.chat_models.zhipuai import ChatZhipuAI from tests.unit_tests.callbac...
langchain/libs/community/tests/integration_tests/chat_models/test_zhipuai.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_models/test_zhipuai.py", "repo_id": "langchain", "token_count": 857 }
338
from typing import Optional import langsmith _CLIENT = langsmith.Client() def create_dataset( dataset_name: str, descriptions: list, labels: Optional[list] = None ): ds = _CLIENT.create_dataset(dataset_name=dataset_name) labels_ = labels or [None] * len(descriptions) for desc, label in zip(descriptio...
langsmith-cookbook/testing-examples/pytest/_prepare_data.py/0
{ "file_path": "langsmith-cookbook/testing-examples/pytest/_prepare_data.py", "repo_id": "langsmith-cookbook", "token_count": 762 }
1,062
"""Print information about the system and langchain packages for debugging purposes.""" from typing import Sequence def print_sys_info(*, additional_pkgs: Sequence[str] = tuple()) -> None: """Print information about the environment for debugging purposes.""" import pkgutil import platform import sys ...
langchain/libs/core/langchain_core/sys_info.py/0
{ "file_path": "langchain/libs/core/langchain_core/sys_info.py", "repo_id": "langchain", "token_count": 1105 }
397
from datetime import datetime from typing import List, Sequence import orjson from langchain.schema.messages import AnyMessage from langgraph.channels.base import ChannelsManager from langgraph.checkpoint.base import empty_checkpoint from langgraph.pregel import _prepare_next_tasks from app.agent import AgentType, ge...
opengpts/backend/app/storage.py/0
{ "file_path": "opengpts/backend/app/storage.py", "repo_id": "opengpts", "token_count": 2832 }
2,019
import wandb import numpy as np import torch, torchvision import torch.nn.functional as F from PIL import Image from tqdm.auto import tqdm from fastcore.script import call_parse from torchvision import transforms from diffusers import DDPMPipeline from diffusers import DDIMScheduler from datasets import load_dataset fr...
diffusion-models-class/unit2/finetune_model.py/0
{ "file_path": "diffusion-models-class/unit2/finetune_model.py", "repo_id": "diffusion-models-class", "token_count": 2010 }
304
import { OpenAI } from "@langchain/openai"; export const run = async () => { const model = new OpenAI({ modelName: "gpt-4", temperature: 0.7, maxTokens: 1000, maxRetries: 5, }); const res = await model.call( "Question: What would be a good company name a company that makes colorful socks?\nAn...
langchainjs/examples/src/llms/openai.ts/0
{ "file_path": "langchainjs/examples/src/llms/openai.ts", "repo_id": "langchainjs", "token_count": 126 }
813
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import OptionalDependencyNotAvailable, is_torch_available, is_transformers_available try: if not (is_transformers_available() and is_torch_available()): raise Opti...
diffusers/src/diffusers/pipelines/blip_diffusion/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/blip_diffusion/__init__.py", "repo_id": "diffusers", "token_count": 219 }
218
"""An agent designed to hold a conversation in addition to using tools.""" from __future__ import annotations from typing import Any, List, Optional, Sequence from langchain_core._api import deprecated from langchain_core.callbacks import BaseCallbackManager from langchain_core.language_models import BaseLanguageMode...
langchain/libs/langchain/langchain/agents/conversational/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/conversational/base.py", "repo_id": "langchain", "token_count": 2020 }
440
import argparse import copy import itertools import logging import math import os import random from pathlib import Path import numpy as np import torch import torch.nn.functional as F import torch.utils.checkpoint from accelerate import Accelerator from accelerate.logging import get_logger from accelerate.utils impor...
diffusers/examples/research_projects/multi_subject_dreambooth_inpainting/train_multi_subject_dreambooth_inpainting.py/0
{ "file_path": "diffusers/examples/research_projects/multi_subject_dreambooth_inpainting/train_multi_subject_dreambooth_inpainting.py", "repo_id": "diffusers", "token_count": 10829 }
221
{ "github": { "release": true, "autoGenerate": true, "tokenRef": "GITHUB_TOKEN_RELEASE" }, "npm": { "versionArgs": [ "--workspaces-update=false" ] } }
langchainjs/libs/langchain-google-genai/.release-it.json/0
{ "file_path": "langchainjs/libs/langchain-google-genai/.release-it.json", "repo_id": "langchainjs", "token_count": 91 }
1,099
<jupyter_start><jupyter_text>Construire votre première démo Installez les bibliothèques 🤗 Transformers et 🤗 Gradio pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece] !pip install gradio import gradio as gr def greet(name): return "Bonjour " + name demo = gr.Interface(fn=...
notebooks/course/fr/chapter9/section2.ipynb/0
{ "file_path": "notebooks/course/fr/chapter9/section2.ipynb", "repo_id": "notebooks", "token_count": 326 }
312
<jupyter_start><jupyter_text>Hugging Face Transformers BERT fine-tuning using Amazon SageMaker and Training Compiler Compile and fine-tune a Multi-Class Classification Transformers with `Trainer` and `emotion` dataset using Amazon SageMaker Training Compiler Introduction SageMaker Training Compiler Overview[SageMaker ...
notebooks/sagemaker/15_training_compiler/sagemaker-notebook.ipynb/0
{ "file_path": "notebooks/sagemaker/15_training_compiler/sagemaker-notebook.ipynb", "repo_id": "notebooks", "token_count": 3361 }
287
from llama_index.core.readers.base import BaseReader from llama_index.readers.earnings_call_transcript import EarningsCallTranscript def test_class(): names_of_base_classes = [b.__name__ for b in EarningsCallTranscript.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-earnings-call-transcript/tests/test_readers_earnings_call_transcript.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-earnings-call-transcript/tests/test_readers_earnings_call_transcript.py", "repo_id": "llama_index", "token_count": 97 }
1,287
/* eslint-disable @typescript-eslint/no-explicit-any */ import { jest, test, expect } from "@jest/globals"; import { FakeEmbeddings } from "@langchain/core/utils/testing"; import { QdrantVectorStore } from "../qdrant.js"; test("QdrantVectorStore works", async () => { const client = { upsert: jest.fn(), sear...
langchainjs/libs/langchain-community/src/vectorstores/tests/qdrant.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/qdrant.test.ts", "repo_id": "langchainjs", "token_count": 2163 }
1,010
# 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/fnet/convert_fnet_original_flax_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/fnet/convert_fnet_original_flax_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 2770 }
673
from __future__ import annotations from concurrent.futures import Executor, ThreadPoolExecutor from typing import TYPE_CHECKING, Any, ClassVar, Dict, Iterator, List, Optional, Union from langchain_core._api.deprecation import deprecated from langchain_core.callbacks.manager import ( AsyncCallbackManagerForLLMRun,...
langchain/libs/community/langchain_community/llms/vertexai.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/vertexai.py", "repo_id": "langchain", "token_count": 8603 }
287
from langchain.load import __all__ EXPECTED_ALL = [ "dumpd", "dumps", "load", "loads", ] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
langchain/libs/langchain/tests/unit_tests/load/test_imports.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/load/test_imports.py", "repo_id": "langchain", "token_count": 84 }
626
<jupyter_start><jupyter_text>Huggingface Sagemaker-sdk - training with custom metrics Binary Classification with `Trainer` and `imdb` dataset In this demo, we extend the basic classification demo by adding **metrics definition** to capture and visualize training metrics.The documentation of the SageMaker metrics captur...
notebooks/sagemaker/06_sagemaker_metrics/sagemaker-notebook.ipynb/0
{ "file_path": "notebooks/sagemaker/06_sagemaker_metrics/sagemaker-notebook.ipynb", "repo_id": "notebooks", "token_count": 3000 }
329
// 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/querynodev2/delegator/deletebuffer/delete_buffer_test.go/0
{ "file_path": "milvus/internal/querynodev2/delegator/deletebuffer/delete_buffer_test.go", "repo_id": "milvus", "token_count": 702 }
2,041
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/standalone/docker-compose.yml/0
{ "file_path": "milvus/deployments/docker/standalone/docker-compose.yml", "repo_id": "milvus", "token_count": 858 }
1,730
include llama_index/py.typed include llama_index/VERSION include LICENSE
llama_index/llama-index-legacy/MANIFEST.in/0
{ "file_path": "llama_index/llama-index-legacy/MANIFEST.in", "repo_id": "llama_index", "token_count": 23 }
1,546
import { loadPrompt } from "langchain/prompts/load"; export const run = async () => { const prompt = await loadPrompt("lc://prompts/hello-world/prompt.yaml"); const res = await prompt.format({}); console.log({ res }); };
langchainjs/examples/src/prompts/load_from_hub.ts/0
{ "file_path": "langchainjs/examples/src/prompts/load_from_hub.ts", "repo_id": "langchainjs", "token_count": 75 }
908
export function clickOutside(element: HTMLDialogElement, callbackFunction: () => void) { function onClick(event: MouseEvent) { if (!element.contains(event.target as Node)) { callbackFunction(); } } document.body.addEventListener("click", onClick); return { update(newCallbackFunction: () => void) { cal...
chat-ui/src/lib/actions/clickOutside.ts/0
{ "file_path": "chat-ui/src/lib/actions/clickOutside.ts", "repo_id": "chat-ui", "token_count": 143 }
99
# TResNet A **TResNet** is a variant on a [ResNet](https://paperswithcode.com/method/resnet) that aim to boost accuracy while maintaining GPU training and inference efficiency. They contain several design tricks including a SpaceToDepth stem, [Anti-Alias downsampling](https://paperswithcode.com/method/anti-alias-down...
pytorch-image-models/docs/models/.templates/models/tresnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/tresnet.md", "repo_id": "pytorch-image-models", "token_count": 3391 }
349
""" Arize-Phoenix LlamaPack. """ from typing import TYPE_CHECKING, Any, Dict, List from llama_index.core import set_global_handler from llama_index.core.indices.vector_store import VectorStoreIndex from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.schema import TextNode if TYPE_CHECKIN...
llama_index/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/llama_index/packs/arize_phoenix_query_engine/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/llama_index/packs/arize_phoenix_query_engine/base.py", "repo_id": "llama_index", "token_count": 953 }
1,692
from llama_index.core.readers.base import BaseReader from llama_index.readers.airbyte_shopify import AirbyteShopifyReader def test_class(): names_of_base_classes = [b.__name__ for b in AirbyteShopifyReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-shopify/tests/test_readers_airbyte_shopify.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-shopify/tests/test_readers_airbyte_shopify.py", "repo_id": "llama_index", "token_count": 95 }
1,283
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-couchbase/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-couchbase/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,351
#include "cuda_utils.cuh" #include<stdint.h> template <typename S, typename T> __device__ void cast_( const size_t numel, const size_t num_dims, const size_t *info, const S *inp, T *out ) { const size_t *dims = info; const size_t *strides = info + num_dims; if (is_contiguous(num_dims, d...
candle/candle-kernels/src/cast.cu/0
{ "file_path": "candle/candle-kernels/src/cast.cu", "repo_id": "candle", "token_count": 2161 }
52
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.yahoo_finance import YahooFinanceToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in YahooFinanceToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-yahoo-finance/tests/test_tools_yahoo_finance.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-yahoo-finance/tests/test_tools_yahoo_finance.py", "repo_id": "llama_index", "token_count": 98 }
1,504
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use candle::{DType, Device, Result, Tensor}; use candle_nn::{linear, AdamW, Linear, Module, Optimizer, ParamsAdamW, VarBuilder, VarMap}; fn gen_data() -> Result<(Tensor, Tensor)> { // Generate some sam...
candle/candle-nn/examples/basic_optimizer.rs/0
{ "file_path": "candle/candle-nn/examples/basic_optimizer.rs", "repo_id": "candle", "token_count": 595 }
59
<jupyter_start><jupyter_code>! pip install langchain_community tiktoken langchain-openai langchainhub chromadb langchain langgraph tavily-python<jupyter_output><empty_output><jupyter_text>Corrective RAG (CRAG)Self-reflection can enhance RAG, enabling correction of poor quality retrieval or generations.Several recent pa...
langgraph/examples/rag/langgraph_crag.ipynb/0
{ "file_path": "langgraph/examples/rag/langgraph_crag.ipynb", "repo_id": "langgraph", "token_count": 4606 }
1,002
"""Google Lens API Toolkit.""" from langchain_community.tools.google_lens.tool import GoogleLensQueryRun __all__ = ["GoogleLensQueryRun"]
langchain/libs/langchain/langchain/tools/google_lens/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/google_lens/__init__.py", "repo_id": "langchain", "token_count": 42 }
557
import { test, expect } from "@jest/globals"; import * as url from "node:url"; import * as path from "node:path"; import { EPubLoader } from "../fs/epub.js"; test("Test EPub loader from file", async () => { const filePath = path.resolve( path.dirname(url.fileURLToPath(import.meta.url)), "./example_data/atten...
langchainjs/langchain/src/document_loaders/tests/epub.test.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/epub.test.ts", "repo_id": "langchainjs", "token_count": 319 }
904
# CHANGELOG ## [0.1.2] - 2024-02-13 - Add maintainers and keywords from library.json (llamahub)
llama_index/llama-index-integrations/readers/llama-index-readers-azstorage-blob/CHANGELOG.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-azstorage-blob/CHANGELOG.md", "repo_id": "llama_index", "token_count": 40 }
1,468
"""Test query transform.""" from llama_index.legacy.indices.query.query_transform.base import ( DecomposeQueryTransform, ) from llama_index.legacy.service_context import ServiceContext from tests.indices.query.query_transform.mock_utils import MOCK_DECOMPOSE_PROMPT def test_decompose_query_transform(mock_servic...
llama_index/llama-index-legacy/tests/indices/query/query_transform/test_base.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/query/query_transform/test_base.py", "repo_id": "llama_index", "token_count": 286 }
1,800
<!--- Copyright 2021 The Google Flax Team Authors and 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 r...
transformers/examples/flax/text-classification/README.md/0
{ "file_path": "transformers/examples/flax/text-classification/README.md", "repo_id": "transformers", "token_count": 2757 }
520
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-file/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,314
# stepback-qa-prompting This template replicates the "Step-Back" prompting technique that improves performance on complex questions by first asking a "step back" question. This technique can be combined with regular question-answering applications by doing retrieval on both the original and step-back question. Read...
langchain/templates/stepback-qa-prompting/README.md/0
{ "file_path": "langchain/templates/stepback-qa-prompting/README.md", "repo_id": "langchain", "token_count": 763 }
687
#!/usr/bin/env python # coding=utf-8 # 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-...
transformers/examples/flax/image-captioning/run_image_captioning_flax.py/0
{ "file_path": "transformers/examples/flax/image-captioning/run_image_captioning_flax.py", "repo_id": "transformers", "token_count": 24465 }
551
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use text_generation_client::GrammarType as ProtoGrammarType; use text_generation_client::{ Batch, NextTokenChooserParameters, Request, ShardedClient, StoppingCriteriaParameters, }; // Note: Request ids and batch ids cannot collide. const LIVENESS_I...
text-generation-inference/router/src/health.rs/0
{ "file_path": "text-generation-inference/router/src/health.rs", "repo_id": "text-generation-inference", "token_count": 1307 }
393
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-discord/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-discord/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,283
# 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/audioldm2/test_audioldm2.py/0
{ "file_path": "diffusers/tests/pipelines/audioldm2/test_audioldm2.py", "repo_id": "diffusers", "token_count": 10088 }
287
import { LanceDB } from "@langchain/community/vectorstores/lancedb"; import { OpenAIEmbeddings } from "@langchain/openai"; import { TextLoader } from "langchain/document_loaders/fs/text"; import fs from "node:fs/promises"; import path from "node:path"; import os from "node:os"; import { connect } from "vectordb"; // C...
langchainjs/examples/src/indexes/vector_stores/lancedb/fromDocs.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/lancedb/fromDocs.ts", "repo_id": "langchainjs", "token_count": 376 }
828
from __future__ import annotations from typing import TYPE_CHECKING, List, Optional from langchain_core.language_models import BaseLanguageModel from langchain_core.pydantic_v1 import Field from langchain_community.agent_toolkits.base import BaseToolkit from langchain_community.tools import BaseTool from langchain_c...
langchain/libs/community/langchain_community/agent_toolkits/amadeus/toolkit.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/amadeus/toolkit.py", "repo_id": "langchain", "token_count": 374 }
218
from datetime import datetime from time import sleep from langchain.output_parsers.datetime import DatetimeOutputParser def test_datetime_output_parser_parse() -> None: parser = DatetimeOutputParser() # Test valid input date = datetime.now() datestr = date.strftime(parser.format) result = parser...
langchain/libs/langchain/tests/unit_tests/output_parsers/test_datetime_parser.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/output_parsers/test_datetime_parser.py", "repo_id": "langchain", "token_count": 542 }
600
# Discover LlamaIndex Video Series If you like learning from videos, now's a good time to check out our "Discover LlamaIndex" series. If not, we recommend heading on to our [Understanding LlamaIndex](/understanding/understanding.md) tutorial. ## Bottoms-Up Development (Llama Docs Bot) This is a sub-series within Dis...
llama_index/docs/getting_started/discover_llamaindex.md/0
{ "file_path": "llama_index/docs/getting_started/discover_llamaindex.md", "repo_id": "llama_index", "token_count": 666 }
1,140
use crate::models::unigram::{lattice::Lattice, model::Unigram}; use crate::tokenizer::{AddedToken, Result, Trainer}; use crate::utils::parallelism::*; use crate::utils::progress::{ProgressBar, ProgressStyle}; use log::debug; use serde::{Deserialize, Serialize}; use std::cmp::Reverse; use std::collections::{HashMap, Has...
tokenizers/tokenizers/src/models/unigram/trainer.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/unigram/trainer.rs", "repo_id": "tokenizers", "token_count": 15681 }
458
from langchain_ai21 import __all__ EXPECTED_ALL = [ "AI21LLM", "ChatAI21", "AI21Embeddings", ] def test_all_imports() -> None: assert sorted(EXPECTED_ALL) == sorted(__all__)
langchain/libs/partners/ai21/tests/unit_tests/test_imports.py/0
{ "file_path": "langchain/libs/partners/ai21/tests/unit_tests/test_imports.py", "repo_id": "langchain", "token_count": 85 }
622
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
trl/scripts/log_reports.py/0
{ "file_path": "trl/scripts/log_reports.py", "repo_id": "trl", "token_count": 2727 }
784
<jupyter_start><jupyter_text>Weaviate Vector Store Metadata Filter If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-vector-stores-weaviate !pip install llama-index weaviate-client<jupyter_output><empty_output><jupyter_text>Creating a Weavia...
llama_index/docs/examples/vector_stores/WeaviateIndex_metadata_filter.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/WeaviateIndex_metadata_filter.ipynb", "repo_id": "llama_index", "token_count": 1754 }
1,139
--- sidebar_class_name: node-only --- import CodeBlock from "@theme/CodeBlock"; # LanceDB LanceDB is an embedded vector database for AI applications. It is open source and distributed with an Apache-2.0 license. LanceDB datasets are persisted to disk and can be shared between Node.js and Python. ## Setup Install ...
langchainjs/docs/core_docs/docs/integrations/vectorstores/lancedb.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/vectorstores/lancedb.mdx", "repo_id": "langchainjs", "token_count": 390 }
720
from rag_aws_bedrock.chain import chain __all__ = ["chain"]
langchain/templates/rag-aws-bedrock/rag_aws_bedrock/__init__.py/0
{ "file_path": "langchain/templates/rag-aws-bedrock/rag_aws_bedrock/__init__.py", "repo_id": "langchain", "token_count": 21 }
674
<!--- 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 a...
transformers/examples/tensorflow/README.md/0
{ "file_path": "transformers/examples/tensorflow/README.md", "repo_id": "transformers", "token_count": 731 }
581
python_sources() python_tests( name="tests", )
llama_index/llama-index-core/tests/storage/docstore/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/storage/docstore/BUILD", "repo_id": "llama_index", "token_count": 22 }
1,244
interactions: - request: body: '{"input": [[831, 677, 31172, 220, 19, 370, 10718, 830, 1484, 762, 3443, 22, 6043, 2437, 68, 22874, 346, 22, 65, 21, 68, 1927, 712, 2689], [2059, 7341, 527, 264, 1912, 315, 658, 10753, 677, 81, 3581, 7795, 32971, 555, 264, 7558, 321, 351, 61798, 30535, 11, 4330, 311,...
langchain/libs/community/tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts.yaml/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/cassettes/test_pinecone/TestPinecone.test_from_texts.yaml", "repo_id": "langchain", "token_count": 24715 }
372
# 🦜🍎️ @langchain/core [![CI](https://github.com/langchain-ai/langchainjs/actions/workflows/ci.yml/badge.svg)](https://github.com/langchain-ai/langchainjs/actions/workflows/ci.yml) ![npm](https://img.shields.io/npm/dw/@langchain/core) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://open...
langchainjs/langchain-core/README.md/0
{ "file_path": "langchainjs/langchain-core/README.md", "repo_id": "langchainjs", "token_count": 1699 }
856
from abc import abstractmethod from typing import Any, List, Tuple from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.bridge.pydantic import BaseModel from llama_index.core.schema import NodeWithScore, QueryBundle class BaseAutoRetriever(BaseRetriever): """Base auto retriever.""...
llama_index/llama-index-core/llama_index/core/base/base_auto_retriever.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/base/base_auto_retriever.py", "repo_id": "llama_index", "token_count": 616 }
1,177
<!--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...
peft/docs/source/developer_guides/model_merging.md/0
{ "file_path": "peft/docs/source/developer_guides/model_merging.md", "repo_id": "peft", "token_count": 2263 }
313
"""Test dashscope embeddings.""" import numpy as np from langchain_community.embeddings.dashscope import DashScopeEmbeddings def test_dashscope_embedding_documents() -> None: """Test dashscope embeddings.""" documents = ["foo bar"] embedding = DashScopeEmbeddings(model="text-embedding-v1") output = e...
langchain/libs/community/tests/integration_tests/embeddings/test_dashscope.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/embeddings/test_dashscope.py", "repo_id": "langchain", "token_count": 991 }
349
[ { "avatar_url": "https://avatars.githubusercontent.com/u/219938?v=4", "html_url": "https://github.com/sworddish", "login": "sworddish" } ]
milvus/.contributors/0
{ "file_path": "milvus/.contributors", "repo_id": "milvus", "token_count": 73 }
1,605
from typing import Any, Optional, Sequence from llama_index.legacy.evaluation.base import BaseEvaluator, EvaluationResult from llama_index.legacy.prompts.mixin import PromptDictType, PromptMixinType class AnswerConsistencyEvaluator(BaseEvaluator): """Tonic Validate's answer consistency metric. The output sc...
llama_index/llama-index-legacy/llama_index/legacy/evaluation/tonic_validate/answer_consistency.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/evaluation/tonic_validate/answer_consistency.py", "repo_id": "llama_index", "token_count": 955 }
1,591
#include <cmath> #include <cute/tensor.hpp> #include <cutlass/cutlass.h> #include <cutlass/array.h> #include "utils.h" namespace flash { using namespace cute; //////////////////////////////////////////////////////////////////////////////////////////////////// template <bool Is_causal, typename Engine, typename L...
candle/candle-flash-attn/kernels/alibi.h/0
{ "file_path": "candle/candle-flash-attn/kernels/alibi.h", "repo_id": "candle", "token_count": 1367 }
60
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-hubspot/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hubspot/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,458
#!/usr/bin/env 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...
milvus/scripts/run_go_unittest.sh/0
{ "file_path": "milvus/scripts/run_go_unittest.sh", "repo_id": "milvus", "token_count": 2701 }
1,921
--- sidebar_position: 1 --- # Text Splitters Once you've loaded documents, you'll often want to transform them to better suit your application. The simplest example is you may want to split a long document into smaller chunks that can fit into your model's context window. LangChain has a number of built-in document tr...
langchain/docs/docs/modules/data_connection/document_transformers/index.mdx/0
{ "file_path": "langchain/docs/docs/modules/data_connection/document_transformers/index.mdx", "repo_id": "langchain", "token_count": 1769 }
191
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/tools/llama-index-tools-chatgpt-plugin/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-chatgpt-plugin/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,418
[ { "suite_params": [ { "suite": "2_locust_insert_5h.yaml", "image_type": "cpu" } ] } ]
milvus/tests/benchmark/milvus_benchmark/scheduler/loop.json/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/scheduler/loop.json", "repo_id": "milvus", "token_count": 122 }
2,140
python_tests( interpreter_constraints=["==3.9.*", "==3.10.*"], )
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-gemini/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-gemini/tests/BUILD", "repo_id": "llama_index", "token_count": 29 }
1,381
# 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/data/datasets/glue.py/0
{ "file_path": "transformers/src/transformers/data/datasets/glue.py", "repo_id": "transformers", "token_count": 2587 }
631
<jupyter_start><jupyter_text>Unit 3: Deep Q-Learning with Atari Games 👾 using RL Baselines3 ZooIn this notebook, **you'll train a Deep Q-Learning agent** playing Space Invaders using [RL Baselines3 Zoo](https://github.com/DLR-RM/rl-baselines3-zoo), a training framework based on [Stable-Baselines3](https://stable-basel...
deep-rl-class/notebooks/unit3/unit3.ipynb/0
{ "file_path": "deep-rl-class/notebooks/unit3/unit3.ipynb", "repo_id": "deep-rl-class", "token_count": 3982 }
160
from langchain_community.retrievers.zilliz import ZillizRetreiver, ZillizRetriever __all__ = ["ZillizRetriever", "ZillizRetreiver"]
langchain/libs/langchain/langchain/retrievers/zilliz.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/zilliz.py", "repo_id": "langchain", "token_count": 50 }
538
<jupyter_start><jupyter_text>Wikibase AgentThis notebook demonstrates a very simple wikibase agent that uses sparql generation. Although this code is intended to work against anywikibase instance, we use http://wikidata.org for testing.If you are interested in wikibases and sparql, please consider helping to improve th...
langchain/cookbook/wikibase_agent.ipynb/0
{ "file_path": "langchain/cookbook/wikibase_agent.ipynb", "repo_id": "langchain", "token_count": 4313 }
83
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
peft/docs/source/package_reference/p_tuning.md/0
{ "file_path": "peft/docs/source/package_reference/p_tuning.md", "repo_id": "peft", "token_count": 540 }
295
# 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/test_pipelines_combined.py/0
{ "file_path": "diffusers/tests/pipelines/test_pipelines_combined.py", "repo_id": "diffusers", "token_count": 2384 }
277
<jupyter_start><jupyter_text>Semantic Chunker"Semantic chunking" is a new concept proposed Greg Kamradt in his video tutorial on 5 levels of embedding chunking: https://youtu.be/8OJC21T2SL4?t=1933.Instead of chunking text with a **fixed** chunk size, the semantic splitter adaptively picks the breakpoint in-between sent...
llama_index/docs/examples/node_parsers/semantic_chunking.ipynb/0
{ "file_path": "llama_index/docs/examples/node_parsers/semantic_chunking.ipynb", "repo_id": "llama_index", "token_count": 2122 }
1,096
<jupyter_start><jupyter_text>Eden AI Eden AI is revolutionizing the AI landscape by uniting the best AI providers, empowering users to unlock limitless possibilities and tap into the true potential of artificial intelligence. With an all-in-one comprehensive and hassle-free platform, it allows users to deploy AI featur...
langchain/docs/docs/integrations/chat/edenai.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/chat/edenai.ipynb", "repo_id": "langchain", "token_count": 918 }
99
# coding=utf-8 # Copyright 2021 The Fairseq Authors and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/...
transformers/src/transformers/models/wav2vec2/configuration_wav2vec2.py/0
{ "file_path": "transformers/src/transformers/models/wav2vec2/configuration_wav2vec2.py", "repo_id": "transformers", "token_count": 7967 }
766
from typing import Optional import torch from torch import nn from torch import nn, Tensor from torch.nn.modules.transformer import _get_activation_fn def add_ml_decoder_head(model): if hasattr(model, 'global_pool') and hasattr(model, 'fc'): # most CNN models, like Resnet50 model.global_pool = nn.Identi...
pytorch-image-models/timm/layers/ml_decoder.py/0
{ "file_path": "pytorch-image-models/timm/layers/ml_decoder.py", "repo_id": "pytorch-image-models", "token_count": 3177 }
346
from langchain_community.graphs.memgraph_graph import ( MemgraphGraph, ) __all__ = ["MemgraphGraph"]
langchain/libs/langchain/langchain/graphs/memgraph_graph.py/0
{ "file_path": "langchain/libs/langchain/langchain/graphs/memgraph_graph.py", "repo_id": "langchain", "token_count": 37 }
509
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/madlad-400.md/0
{ "file_path": "transformers/docs/source/en/model_doc/madlad-400.md", "repo_id": "transformers", "token_count": 930 }
510
- sections: - local: index title: Text Generation Inference - local: quicktour title: Quick Tour - local: installation title: Installation - local: supported_models title: Supported Models and Hardware - local: messages_api title: Messages API title: Getting started - sections: - local...
text-generation-inference/docs/source/_toctree.yml/0
{ "file_path": "text-generation-inference/docs/source/_toctree.yml", "repo_id": "text-generation-inference", "token_count": 384 }
360