text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from __future__ import annotations from typing import TYPE_CHECKING, List, Optional from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader from langchain_community.utilities.vertexai import get_client_info if TYPE_CHECKING: from google.auth.credentials imp...
langchain/libs/community/langchain_community/document_loaders/bigquery.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/bigquery.py", "repo_id": "langchain", "token_count": 1512 }
232
import { ChatFireworks } from "@langchain/community/chat_models/fireworks"; const model = new ChatFireworks({ temperature: 0.9, // In Node.js defaults to process.env.FIREWORKS_API_KEY fireworksApiKey: "YOUR-API-KEY", });
langchainjs/examples/src/models/chat/integration_fireworks.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/integration_fireworks.ts", "repo_id": "langchainjs", "token_count": 77 }
803
import { test } from "@jest/globals"; import { ChatOpenAI } from "@langchain/openai"; import { Client, Example, Run } from "langsmith"; import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager"; import { BaseChatModel } from "@langchain/core/language_models/chat_models"; import { LLM } from "@langch...
langchainjs/langchain/src/smith/tests/runner_utils.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/smith/tests/runner_utils.int.test.ts", "repo_id": "langchainjs", "token_count": 3405 }
936
"""Init params.""" from llama_index.legacy.core.response.schema import Response __all__ = ["Response"]
llama_index/llama-index-legacy/llama_index/legacy/response/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/response/__init__.py", "repo_id": "llama_index", "token_count": 34 }
1,597
# Amazon Product Extraction Pack This LlamaPack provides an example of our Amazon product extraction pack. It loads in a website URL, screenshots the page. Then we use OpenAI GPT-4V + prompt engineering to extract the screenshot into a structured JSON output. Check out the [notebook here](https://github.com/run-llam...
llama_index/llama-index-packs/llama-index-packs-amazon-product-extraction/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-amazon-product-extraction/README.md", "repo_id": "llama_index", "token_count": 542 }
1,641
#!/usr/bin/env python # coding=utf-8 # Copyright The HuggingFace Team 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.ap...
transformers/examples/pytorch/multiple-choice/run_swag_no_trainer.py/0
{ "file_path": "transformers/examples/pytorch/multiple-choice/run_swag_no_trainer.py", "repo_id": "transformers", "token_count": 11876 }
550
import CodeBlock from "@theme/CodeBlock"; # Chroma > [Chroma](https://docs.trychroma.com/getting-started) is a AI-native open-source vector database focused on developer productivity and happiness. Chroma is licensed under Apache 2.0. <a href="https://discord.gg/MMeYNTmh3x" target="_blank"> <img src="https://img.s...
langchainjs/docs/core_docs/docs/integrations/vectorstores/chroma.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/vectorstores/chroma.mdx", "repo_id": "langchainjs", "token_count": 838 }
717
# coding=utf-8 # Copyright The HuggingFace Team 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/LICE...
transformers/src/transformers/models/rembert/tokenization_rembert.py/0
{ "file_path": "transformers/src/transformers/models/rembert/tokenization_rembert.py", "repo_id": "transformers", "token_count": 4632 }
652
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base"; import type { StructuredToolInterface, ToolInterface, } from "@langchain/core/tools"; import { CallbackManager } from "@langchain/core/callbacks/manager"; import { BufferMemory } from "../memory/buffer_memory.js"; import { ChatA...
langchainjs/langchain/src/agents/initialize.ts/0
{ "file_path": "langchainjs/langchain/src/agents/initialize.ts", "repo_id": "langchainjs", "token_count": 3108 }
839
from pathlib import Path from langchain.llms import OpenAI import pickle from langchain.chains import RetrievalQA DIR_PATH = Path(__file__).parent def get_chain(): with open(DIR_PATH / "vectorstore.pkl", "rb") as f: vectorstore = pickle.load(f) return RetrievalQA.from_chain_type( llm=OpenAI(t...
langchain-aiplugin/retrieval_qa/chain.py/0
{ "file_path": "langchain-aiplugin/retrieval_qa/chain.py", "repo_id": "langchain-aiplugin", "token_count": 169 }
61
"""Init params."""
llama_index/llama-index-legacy/llama_index/legacy/finetuning/openai/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/finetuning/openai/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,709
"""Json agent."""
langchain/libs/langchain/langchain/agents/agent_toolkits/json/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/json/__init__.py", "repo_id": "langchain", "token_count": 7 }
479
<jupyter_start><jupyter_text>Chat Engine - Context Mode ContextChatEngine is a simple chat mode built on top of a retriever over your data. For each chat interaction:* first retrieve text from the index using the user message* set the retrieved text as context in the system prompt* return an answer to the user message ...
llama_index/docs/examples/chat_engine/chat_engine_context.ipynb/0
{ "file_path": "llama_index/docs/examples/chat_engine/chat_engine_context.ipynb", "repo_id": "llama_index", "token_count": 1378 }
1,091
{% set redirect = pathto(redirects[pagename]) %} <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="Refresh" content="0; url={{ redirect }}" /> <meta name="robots" content="follow, index"> <meta name="Descri...
langchain/docs/api_reference/templates/redirects.html/0
{ "file_path": "langchain/docs/api_reference/templates/redirects.html", "repo_id": "langchain", "token_count": 226 }
80
"""Init params.""" from llama_index.readers.huggingface_fs.base import HuggingFaceFSReader __all__ = ["HuggingFaceFSReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-huggingface-fs/llama_index/readers/huggingface_fs/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-huggingface-fs/llama_index/readers/huggingface_fs/__init__.py", "repo_id": "llama_index", "token_count": 43 }
1,414
# 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 required by appl...
transformers/src/transformers/models/fuyu/convert_fuyu_model_weights_to_hf.py/0
{ "file_path": "transformers/src/transformers/models/fuyu/convert_fuyu_model_weights_to_hf.py", "repo_id": "transformers", "token_count": 1851 }
610
[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 = ["SimpleArangoDBReader"] contains_example = false import_path = "llama_index.readers.arango...
llama_index/llama-index-integrations/readers/llama-index-readers-arango-db/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-arango-db/pyproject.toml", "repo_id": "llama_index", "token_count": 663 }
1,463
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.resume_screener import ResumeScreenerPack def test_class(): names_of_base_classes = [b.__name__ for b in ResumeScreenerPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-resume-screener/tests/test_packs_resume_screener.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-resume-screener/tests/test_packs_resume_screener.py", "repo_id": "llama_index", "token_count": 103 }
1,697
import { MemoryVectorStore } from "langchain/vectorstores/memory"; import { CohereEmbeddings } from "@langchain/community/embeddings/cohere"; import { MultiQueryRetriever } from "langchain/retrievers/multi_query"; import { LLMChain } from "langchain/chains"; import { pull } from "langchain/hub"; import { BaseOutputPars...
langchainjs/examples/src/retrievers/multi_query_custom.ts/0
{ "file_path": "langchainjs/examples/src/retrievers/multi_query_custom.ts", "repo_id": "langchainjs", "token_count": 1138 }
848
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
transformers/src/transformers/benchmark/benchmark.py/0
{ "file_path": "transformers/src/transformers/benchmark/benchmark.py", "repo_id": "transformers", "token_count": 4892 }
589
"""Test AI21LLM llm.""" from langchain_ai21.llms import AI21LLM def _generate_llm() -> AI21LLM: """ Testing AI21LLm using non default parameters with the following parameters """ return AI21LLM( model="j2-ultra", max_tokens=2, # Use less tokens for a faster response temperat...
langchain/libs/partners/ai21/tests/integration_tests/test_llms.py/0
{ "file_path": "langchain/libs/partners/ai21/tests/integration_tests/test_llms.py", "repo_id": "langchain", "token_count": 1071 }
617
from langchain_community.vectorstores.vald import Vald __all__ = ["Vald"]
langchain/libs/langchain/langchain/vectorstores/vald.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/vald.py", "repo_id": "langchain", "token_count": 24 }
610
# PNASNet **Progressive Neural Architecture Search**, or **PNAS**, is a method for learning the structure of convolutional neural networks (CNNs). It uses a sequential model-based optimization (SMBO) strategy, where we search the space of cell structures, starting with simple (shallow) models and progressing to comple...
pytorch-image-models/docs/models/.templates/models/pnasnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/pnasnet.md", "repo_id": "pytorch-image-models", "token_count": 813 }
359
import uuid from typing import Callable, Optional import pytest from langchain_core.embeddings import Embeddings from langchain_community.vectorstores import Qdrant from tests.integration_tests.vectorstores.fake_embeddings import ( ConsistentFakeEmbeddings, ) @pytest.mark.parametrize( ["embeddings", "embedd...
langchain/libs/community/tests/integration_tests/vectorstores/qdrant/test_embedding_interface.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/qdrant/test_embedding_interface.py", "repo_id": "langchain", "token_count": 656 }
352
<jupyter_start><jupyter_text>Wikipedia>[Wikipedia](https://wikipedia.org/) is a multilingual free online encyclopedia written and maintained by a community of volunteers, known as Wikipedians, through open collaboration and using a wiki-based editing system called MediaWiki. `Wikipedia` is the largest and most-read ref...
langchain/docs/docs/integrations/tools/wikipedia.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/wikipedia.ipynb", "repo_id": "langchain", "token_count": 172 }
172
import { StreamEvent } from "../tracers/log_stream.js"; /** * Utility to filter the root event in the streamEvents implementation. * This is simply binding the arguments to the namespace to make save on * a bit of typing in the streamEvents implementation. * * TODO: Refactor and remove. */ export class _RootEven...
langchainjs/langchain-core/src/runnables/utils.ts/0
{ "file_path": "langchainjs/langchain-core/src/runnables/utils.ts", "repo_id": "langchainjs", "token_count": 667 }
904
from .rl import ValueGuidedRLPipeline
diffusers/src/diffusers/experimental/__init__.py/0
{ "file_path": "diffusers/src/diffusers/experimental/__init__.py", "repo_id": "diffusers", "token_count": 12 }
220
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/speecht5/test_modeling_speecht5.py/0
{ "file_path": "transformers/tests/models/speecht5/test_modeling_speecht5.py", "repo_id": "transformers", "token_count": 35083 }
825
import { HumanMessage, SystemMessage } from "@langchain/core/messages"; import { AutoGPTPrompt } from "../prompt.js"; // Mock token counter function const mockTokenCounter = async (text: string): Promise<number> => text.length; // Mock vector store retriever interface // Todo: replace any with actual interface // esl...
langchainjs/langchain/src/experimental/autogpt/tests/prompt.test.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/autogpt/tests/prompt.test.ts", "repo_id": "langchainjs", "token_count": 1012 }
919
# LlamaIndex Vector_Stores Integration: Faiss
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-faiss/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-faiss/README.md", "repo_id": "llama_index", "token_count": 13 }
1,606
from typing import Any, Dict, List, Optional, Sequence, Tuple from llama_index.legacy.core.llms.types import ChatMessage, MessageRole from llama_index.legacy.llms.generic_utils import get_from_param_or_env DEFAULT_ANYSCALE_API_BASE = "https://api.endpoints.anyscale.com/v1" DEFAULT_ANYSCALE_API_VERSION = "" LLAMA_MOD...
llama_index/llama-index-legacy/llama_index/legacy/llms/anyscale_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/anyscale_utils.py", "repo_id": "llama_index", "token_count": 1507 }
1,677
import { Drawer } from "vaul"; import { ReactNode, useEffect, useMemo, useRef, useState } from "react"; import CodeIcon from "../assets/CodeIcon.svg?react"; import PadlockIcon from "../assets/PadlockIcon.svg?react"; import CopyIcon from "../assets/CopyIcon.svg?react"; import CheckCircleIcon from "../assets/CheckCircleI...
langserve/langserve/playground/src/components/ShareDialog.tsx/0
{ "file_path": "langserve/langserve/playground/src/components/ShareDialog.tsx", "repo_id": "langserve", "token_count": 2444 }
1,050
import type { MessageUpdate } from "./MessageUpdate"; import type { Timestamps } from "./Timestamps"; import type { WebSearch } from "./WebSearch"; export type Message = Partial<Timestamps> & { from: "user" | "assistant" | "system"; id: ReturnType<typeof crypto.randomUUID>; content: string; updates?: MessageUpdate...
chat-ui/src/lib/types/Message.ts/0
{ "file_path": "chat-ui/src/lib/types/Message.ts", "repo_id": "chat-ui", "token_count": 210 }
102
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use candle::{DType, IndexOp, D}; use candle_nn::{Module, VarBuilder}; use candle_transformers::models::resnet; use clap::{Parser, ValueEnum}; #[derive(Clone, Copy, Debug, ValueEnum)] enum Which { #[val...
candle/candle-examples/examples/resnet/main.rs/0
{ "file_path": "candle/candle-examples/examples/resnet/main.rs", "repo_id": "candle", "token_count": 1281 }
47
# candle-trocr `TrOCR` is a transformer OCR Model. In this example it is used to transcribe image text. See the associated [model card](https://huggingface.co/microsoft/trocr-base-printed) for details on the model itself. Supported models include: - `--which base`: small handwritten OCR model. - `--which large`: lar...
candle/candle-examples/examples/trocr/readme.md/0
{ "file_path": "candle/candle-examples/examples/trocr/readme.md", "repo_id": "candle", "token_count": 360 }
49
from typing import Any, List, Optional from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.callbacks.schema import CBEventType, EventPayload from llama_index.legacy.core.base_query_engine import BaseQueryEngine from llama_index.legacy.core.base_retriever import BaseRetriever from llam...
llama_index/llama-index-legacy/llama_index/legacy/indices/managed/vectara/query.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/managed/vectara/query.py", "repo_id": "llama_index", "token_count": 2266 }
1,566
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/ko/optimization/mps.md/0
{ "file_path": "diffusers/docs/source/ko/optimization/mps.md", "repo_id": "diffusers", "token_count": 2532 }
178
import logging import random import gevent # import gevent.monkey # gevent.monkey.patch_all() from locust import User, between, events, stats from locust.env import Environment import locust.stats import math from locust import LoadTestShape from locust.stats import stats_printer, print_stats # from locust.log import s...
milvus/tests/benchmark/milvus_benchmark/runners/locust_user.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/runners/locust_user.py", "repo_id": "milvus", "token_count": 1765 }
1,993
use crate::models::with_tracing::{conv2d, linear, linear_no_bias, Conv2d, Linear}; use candle::{IndexOp, Module, Result, Tensor, D}; use candle_nn::{layer_norm, LayerNorm, VarBuilder}; // https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit/configuration_vit.py #[derive(Debug, Clone, serde...
candle/candle-transformers/src/models/vit.rs/0
{ "file_path": "candle/candle-transformers/src/models/vit.rs", "repo_id": "candle", "token_count": 5870 }
79
"""Google Finance API Toolkit.""" from langchain_community.tools.google_finance.tool import GoogleFinanceQueryRun __all__ = ["GoogleFinanceQueryRun"]
langchain/libs/langchain/langchain/tools/google_finance/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/google_finance/__init__.py", "repo_id": "langchain", "token_count": 44 }
602
import fs from "fs"; import { GoogleVertexAIMultimodalEmbeddings } from "langchain/experimental/multimodal_embeddings/googlevertexai"; import { FaissStore } from "@langchain/community/vectorstores/faiss"; import { Document } from "@langchain/core/documents"; const embeddings = new GoogleVertexAIMultimodalEmbeddings();...
langchainjs/examples/src/models/embeddings/googlevertexai_multimodal_advanced.ts/0
{ "file_path": "langchainjs/examples/src/models/embeddings/googlevertexai_multimodal_advanced.ts", "repo_id": "langchainjs", "token_count": 613 }
851
# 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/amused/test_amused_img2img.py/0
{ "file_path": "diffusers/tests/pipelines/amused/test_amused_img2img.py", "repo_id": "diffusers", "token_count": 3982 }
286
--- sidebar_class_name: hidden --- # Stores Storing data in key value format is quick and efficient, and can be a powerful tool for LLM applications. The `BaseStore` class provides a simple interface for getting, setting, deleting and iterating over lists of key value pairs. The public API of `BaseStore` in LangChai...
langchainjs/docs/core_docs/docs/integrations/stores/index.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/stores/index.mdx", "repo_id": "langchainjs", "token_count": 1706 }
735
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-arango-db/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-arango-db/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,462
from llama_index.core.readers.base import BaseReader from llama_index.readers.telegram import TelegramReader def test_class(): names_of_base_classes = [b.__name__ for b in TelegramReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-telegram/tests/test_readers_telegram.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-telegram/tests/test_readers_telegram.py", "repo_id": "llama_index", "token_count": 86 }
1,559
""" Bring-Your-Own-Attention Network A flexible network w/ dataclass based config for stacking NN blocks including self-attention (or similar) layers. Currently used to implement experimental variants of: * Bottleneck Transformers * Lambda ResNets * HaloNets Consider all of the models definitions here as exper...
pytorch-image-models/timm/models/byoanet.py/0
{ "file_path": "pytorch-image-models/timm/models/byoanet.py", "repo_id": "pytorch-image-models", "token_count": 9703 }
340
<jupyter_start><jupyter_text>IntroductionThis notebook is going to cover the basics of how to use Stable Diffusion to create and modify images using existing pipelines. We'll also take a brief look at the key components within the pipeline, while leaving further exploration of them to the deep dive notebook. Specifical...
diffusion-models-class/units/en/unit3/stable_diffusion_introduction.ipynb/0
{ "file_path": "diffusion-models-class/units/en/unit3/stable_diffusion_introduction.ipynb", "repo_id": "diffusion-models-class", "token_count": 6232 }
306
import os from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain_community.document_loaders import PyPDFLoader from langchain_community.embeddings import OpenAIEmbeddings from langchain_community.vectorstores import MongoDBAtlasVectorSearch from pymongo import MongoClient MONGO_URI = os.env...
langchain/templates/rag-mongo/ingest.py/0
{ "file_path": "langchain/templates/rag-mongo/ingest.py", "repo_id": "langchain", "token_count": 453 }
664
# 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/wav2vec2/processing_wav2vec2.py/0
{ "file_path": "transformers/src/transformers/models/wav2vec2/processing_wav2vec2.py", "repo_id": "transformers", "token_count": 2839 }
674
<jupyter_start><jupyter_text>Interacting with Embeddings deployed in Amazon SageMaker Endpoint with LlamaIndexAn Amazon SageMaker endpoint is a fully managed resource that enables the deployment of machine learning models, for making predictions on new data.This notebook demonstrates how to interact with Embedding endp...
llama_index/docs/examples/embeddings/sagemaker_embedding_endpoint.ipynb/0
{ "file_path": "llama_index/docs/examples/embeddings/sagemaker_embedding_endpoint.ipynb", "repo_id": "llama_index", "token_count": 985 }
1,054
<jupyter_start><jupyter_code>import os os.environ["CUDA_VISIBLE_DEVICES"] = "1" from peft import PeftConfig, PeftModel from peft import PeftModel, PeftConfig from transformers import AutoModelForCausalLM, AutoTokenizer from datasets import load_dataset import torch import random peft_model_id = "smangrul/tinyllama_lo...
peft/examples/multi_adapter_examples/Lora_Merging.ipynb/0
{ "file_path": "peft/examples/multi_adapter_examples/Lora_Merging.ipynb", "repo_id": "peft", "token_count": 1305 }
330
accuracy: collections: - milvus: db_config.primary_path: /test/milvus/db_data_011/sift_10m_128_l2_sq8 cache_config.cpu_cache_capacity: 32GB engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: true gpu_resour...
milvus/tests/benchmark/milvus_benchmark/suites/2_cpu_accuracy.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/2_cpu_accuracy.yaml", "repo_id": "milvus", "token_count": 333 }
2,147
Verify user is able to easily customize Milvus deployment with various configuration items. To be updated...
milvus/tests/python_client/customize/README.md/0
{ "file_path": "milvus/tests/python_client/customize/README.md", "repo_id": "milvus", "token_count": 23 }
1,967
# coding=utf-8 # Copyright 2023 The HuggingFace Team 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 ...
transformers/tests/bettertransformer/test_integration.py/0
{ "file_path": "transformers/tests/bettertransformer/test_integration.py", "repo_id": "transformers", "token_count": 1117 }
697
/* * 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...
milvus/pkg/util/expr/expr.go/0
{ "file_path": "milvus/pkg/util/expr/expr.go", "repo_id": "milvus", "token_count": 725 }
1,826
<jupyter_start><jupyter_text>Building Evaluation from ScratchWe show how you can build evaluation modules from scratch. This includes both evaluation of the final generated response (where the output is plain text), as well as the evaluation of retrievers (where the output is a ranked list of items).We have in-house mo...
llama_index/docs/examples/low_level/evaluation.ipynb/0
{ "file_path": "llama_index/docs/examples/low_level/evaluation.ipynb", "repo_id": "llama_index", "token_count": 5132 }
1,147
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.rag_cli_local import LocalRAGCLIPack def test_class(): names_of_base_classes = [b.__name__ for b in LocalRAGCLIPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-rag-cli-local/tests/test_packs_rag_cli_local.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-rag-cli-local/tests/test_packs_rag_cli_local.py", "repo_id": "llama_index", "token_count": 100 }
1,718
<jupyter_start><jupyter_text>**Fine-tuning for Image Classification with 🤗 Transformers**This notebook shows how to fine-tune any pretrained Vision model for Image Classification on a custom dataset. The idea is to add a randomly initialized classification head on top of a pre-trained encoder, and fine-tune the model ...
notebooks/examples/image_classification_albumentations.ipynb/0
{ "file_path": "notebooks/examples/image_classification_albumentations.ipynb", "repo_id": "notebooks", "token_count": 7695 }
300
<!--- 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 ...
transformers/examples/pytorch/semantic-segmentation/README.md/0
{ "file_path": "transformers/examples/pytorch/semantic-segmentation/README.md", "repo_id": "transformers", "token_count": 3408 }
589
# LlamaIndex Program Integration: Lmformatenforcer
llama_index/llama-index-integrations/program/llama-index-program-lmformatenforcer/README.md/0
{ "file_path": "llama_index/llama-index-integrations/program/llama-index-program-lmformatenforcer/README.md", "repo_id": "llama_index", "token_count": 13 }
1,330
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-streamlit-chatbot/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-streamlit-chatbot/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,608
from __future__ import annotations from typing import TYPE_CHECKING, Any, Iterable, List, Optional if TYPE_CHECKING: from pyspark.sql import DataFrame, Row, SparkSession class SparkSQL: """SparkSQL is a utility class for interacting with Spark SQL.""" def __init__( self, spark_session: ...
langchain/libs/community/langchain_community/utilities/spark_sql.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/spark_sql.py", "repo_id": "langchain", "token_count": 3289 }
309
// Code generated by mockery v2.32.4. DO NOT EDIT. package writebuffer import ( context "context" msgpb "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" mock "github.com/stretchr/testify/mock" msgstream "github.com/milvus-io/milvus/pkg/mq/msgstream" ) // MockWriteBuffer is an autogenerated mock type for the...
milvus/internal/datanode/writebuffer/mock_write_buffer.go/0
{ "file_path": "milvus/internal/datanode/writebuffer/mock_write_buffer.go", "repo_id": "milvus", "token_count": 4698 }
1,982
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/src/segcore/ConcurrentVector.cpp/0
{ "file_path": "milvus/internal/core/src/segcore/ConcurrentVector.cpp", "repo_id": "milvus", "token_count": 2245 }
1,797
import os from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain_community.chat_models import ChatOpenAI from langchain_community.document_loaders import WebBaseLoader from langchain_community.embeddings import OpenAIEmbeddings from langchain_community.vectorstores import Weaviate from langc...
langchain/templates/rag-weaviate/rag_weaviate/chain.py/0
{ "file_path": "langchain/templates/rag-weaviate/rag_weaviate/chain.py", "repo_id": "langchain", "token_count": 657 }
751
# Model arguments model_name_or_path: alignment-handbook/zephyr-7b-sft-full # Data training arguments # For definitions, see: src/h4/training/config.py dataset_mixer: HuggingFaceH4/ultrafeedback_binarized: 1.0 dataset_splits: - train_prefs - test_prefs preprocessing_num_workers: 12 # DPOTrainer arguments bf16: true...
alignment-handbook/tests/fixtures/config_dpo_full.yaml/0
{ "file_path": "alignment-handbook/tests/fixtures/config_dpo_full.yaml", "repo_id": "alignment-handbook", "token_count": 329 }
30
import type { ObjectId } from "mongodb"; import type { Timestamps } from "./Timestamps"; export interface User extends Timestamps { _id: ObjectId; username?: string; name: string; email?: string; avatarUrl: string; hfUserId: string; }
chat-ui/src/lib/types/User.ts/0
{ "file_path": "chat-ui/src/lib/types/User.ts", "repo_id": "chat-ui", "token_count": 83 }
96
# Metric Card for Code Eval ## Metric description The CodeEval metric estimates the pass@k metric for code synthesis. It implements the evaluation harness for the HumanEval problem solving dataset described in the paper ["Evaluating Large Language Models Trained on Code"](https://arxiv.org/abs/2107.03374). ## How...
datasets/metrics/code_eval/README.md/0
{ "file_path": "datasets/metrics/code_eval/README.md", "repo_id": "datasets", "token_count": 1698 }
123
from typing import Any, List from langchain_core.prompt_values import ImagePromptValue, ImageURL, PromptValue from langchain_core.prompts.base import BasePromptTemplate from langchain_core.pydantic_v1 import Field from langchain_core.utils import image as image_utils class ImagePromptTemplate(BasePromptTemplate[Imag...
langchain/libs/core/langchain_core/prompts/image.py/0
{ "file_path": "langchain/libs/core/langchain_core/prompts/image.py", "repo_id": "langchain", "token_count": 1221 }
417
from typing import Any, Dict, List, Union from langchain_core.messages import BaseMessage, get_buffer_string from langchain.memory.chat_memory import BaseChatMemory class ConversationBufferWindowMemory(BaseChatMemory): """Buffer for storing conversation memory inside a limited size window.""" human_prefix:...
langchain/libs/langchain/langchain/memory/buffer_window.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/buffer_window.py", "repo_id": "langchain", "token_count": 614 }
554
"""Kùzu graph store index.""" from typing import Any, Dict, List, Optional from llama_index.legacy.graph_stores.types import GraphStore class KuzuGraphStore(GraphStore): def __init__( self, database: Any, node_table_name: str = "entity", rel_table_name: str = "links", **k...
llama_index/llama-index-legacy/llama_index/legacy/graph_stores/kuzu.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/graph_stores/kuzu.py", "repo_id": "llama_index", "token_count": 4551 }
1,567
python_tests()
llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-dynamodb/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-dynamodb/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,604
from text_generation.errors import ( parse_error, GenerationError, IncompleteGenerationError, OverloadedError, ValidationError, BadRequestError, ShardNotReadyError, ShardTimeoutError, NotFoundError, RateLimitExceededError, UnknownError, ) def test_generation_error(): pa...
text-generation-inference/clients/python/tests/test_errors.py/0
{ "file_path": "text-generation-inference/clients/python/tests/test_errors.py", "repo_id": "text-generation-inference", "token_count": 598 }
394
import json import logging import sys from typing import Any, List, Optional from urllib.parse import urlparse from llama_index.core.bridge.pydantic import Field from llama_index.core.llms import ChatMessage from llama_index.core.storage.chat_store.base import BaseChatStore import redis from redis import Redis from r...
llama_index/llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-redis/llama_index/storage/chat_store/redis/base.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-redis/llama_index/storage/chat_store/redis/base.py", "repo_id": "llama_index", "token_count": 4051 }
1,550
from typing import Any, Dict, List class HugeGraph: """HugeGraph wrapper for graph operations. *Security note*: Make sure that the database connection uses credentials that are narrowly-scoped to only include necessary permissions. Failure to do so may result in data corruption or loss, since...
langchain/libs/community/langchain_community/graphs/hugegraph.py/0
{ "file_path": "langchain/libs/community/langchain_community/graphs/hugegraph.py", "repo_id": "langchain", "token_count": 1026 }
257
{ "openapi": "3.0.1", "info": { "title": "Calculator Plugin", "description": "A plugin that allows the user to perform basic arithmetic operations like addition, subtraction, multiplication, division, power, and square root using ChatGPT.", "version": "v1" }, "servers": [ { ...
langchain/libs/langchain/tests/unit_tests/examples/test_specs/calculator/apispec.json/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/examples/test_specs/calculator/apispec.json", "repo_id": "langchain", "token_count": 2147 }
639
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/zh/installation.md/0
{ "file_path": "diffusers/docs/source/zh/installation.md", "repo_id": "diffusers", "token_count": 2455 }
205
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-nvidia-tensorrt/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-nvidia-tensorrt/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,306
# coding=utf-8 # Copyright 2022 The OpenAI 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/L...
transformers/src/transformers/models/whisper/modeling_tf_whisper.py/0
{ "file_path": "transformers/src/transformers/models/whisper/modeling_tf_whisper.py", "repo_id": "transformers", "token_count": 37408 }
741
// Code generated by mockery v2.32.4. DO NOT EDIT. package task import mock "github.com/stretchr/testify/mock" // MockScheduler is an autogenerated mock type for the Scheduler type type MockScheduler struct { mock.Mock } type MockScheduler_Expecter struct { mock *mock.Mock } func (_m *MockScheduler) EXPECT() *Mo...
milvus/internal/querycoordv2/task/mock_scheduler.go/0
{ "file_path": "milvus/internal/querycoordv2/task/mock_scheduler.go", "repo_id": "milvus", "token_count": 4828 }
1,760
# 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/wuerstchen/test_wuerstchen_prior.py/0
{ "file_path": "diffusers/tests/pipelines/wuerstchen/test_wuerstchen_prior.py", "repo_id": "diffusers", "token_count": 4396 }
260
""" **Utility functions** for LangChain. These functions do not depend on any other LangChain module. """ from langchain_core.utils.formatting import StrictFormatter, formatter from langchain_core.utils.input import ( get_bolded_text, get_color_mapping, get_colored_text, print_text, ) from langchain_c...
langchain/libs/langchain/langchain/utils/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/utils/__init__.py", "repo_id": "langchain", "token_count": 499 }
567
# LlamaIndex Readers Integration: Chatgpt Plugin
llama_index/llama-index-integrations/readers/llama-index-readers-chatgpt-plugin/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-chatgpt-plugin/README.md", "repo_id": "llama_index", "token_count": 12 }
1,346
import { OpenAI } from "@langchain/openai"; import { loadSummarizationChain } from "langchain/chains"; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import * as fs from "fs"; // In this example, we use a `MapReduceDocumentsChain` specifically prompted to summarize a set of documents. const ...
langchainjs/examples/src/chains/summarization_map_reduce_intermediate_steps.ts/0
{ "file_path": "langchainjs/examples/src/chains/summarization_map_reduce_intermediate_steps.ts", "repo_id": "langchainjs", "token_count": 648 }
792
locust_insert_performance: collections: - milvus: db_config.primary_path: /test/milvus/db_data_011/insert_sift_1m_128_l2_2 collection_name: local_1m_128_l2 ni_per: 50000 build_index: false index_type: ivf_sq8 index_param: nlist: 1024 task: load_s...
milvus/tests/benchmark/milvus_benchmark/suites/2_locust_load_insert_flush.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/2_locust_load_insert_flush.yaml", "repo_id": "milvus", "token_count": 336 }
1,869
from pymilvus.client.types import CompactionPlans from pymilvus import Role from utils.util_log import test_log as log from common import common_type as ct from common import common_func as cf from common.common_type import CheckTasks, Connect_Object_Name # from common.code_mapping import ErrorCode, ErrorMessage from ...
milvus/tests/python_client/check/func_check.py/0
{ "file_path": "milvus/tests/python_client/check/func_check.py", "repo_id": "milvus", "token_count": 12177 }
2,118
use crate::{op::BackpropOp, op::Op, Error, Result, Tensor}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct ParamsConv1D { pub(crate) b_size: usize, // Maybe we should have a version without l_in as this bit depends on the input and not only on // the weights. pub(crate) l_in: usize, pub(crate) c...
candle/candle-core/src/conv.rs/0
{ "file_path": "candle/candle-core/src/conv.rs", "repo_id": "candle", "token_count": 5388 }
29
from langchain_community.utilities.requests import ( Requests, RequestsWrapper, TextRequestsWrapper, ) __all__ = ["Requests", "TextRequestsWrapper", "RequestsWrapper"]
langchain/libs/langchain/langchain/utilities/requests.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/requests.py", "repo_id": "langchain", "token_count": 65 }
565
"""**Tools** are classes that an Agent uses to interact with the world. Each tool has a **description**. Agent uses the description to choose the right tool for the job. **Class hierarchy:** .. code-block:: ToolMetaclass --> BaseTool --> <name>Tool # Examples: AIPluginTool, BaseGraphQLTool ...
langchain/libs/langchain/langchain/tools/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/__init__.py", "repo_id": "langchain", "token_count": 2290 }
571
from langchain_core.load import __all__ EXPECTED_ALL = ["dumpd", "dumps", "load", "loads", "Serializable"] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
langchain/libs/core/tests/unit_tests/load/test_imports.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/load/test_imports.py", "repo_id": "langchain", "token_count": 71 }
405
# Airbyte Gong Loader The Airbyte Gong Loader allows you to access different Gong objects. ## Installation - Install llama_hub: `pip install llama_hub` - Install the gong source: `pip install airbyte-source-gong` ## Usage Here's an example usage of the AirbyteGongReader. ```python from llama_hub.airbyte_gong impo...
llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-gong/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-gong/README.md", "repo_id": "llama_index", "token_count": 839 }
1,332
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-promptlayer/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-promptlayer/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,213
LICENSE=$1 FOLDER=$2 if [ -z ${FOLDER} ] || [ -z ${LICENSE} ]; then echo "usage $0 <path/to/license> <path/to/code_folder>" exit fi cat ${LICENSE} > /dev/null || exit -1 FILES=`find ${FOLDER} \ | grep -E "(*\.cpp$|*\.h$|*\.cu$)" \ | grep -v thirdparty \ | grep -v cmake_build \ | grep -v cmake-build \ | grep ...
milvus/internal/core/build-support/add_cpp_license.sh/0
{ "file_path": "milvus/internal/core/build-support/add_cpp_license.sh", "repo_id": "milvus", "token_count": 325 }
1,914
[tool.poetry] name = "text-generation-integration-tests" version = "1.4.0" description = "Text Generation Inference integration tests" authors = ["Nicolas Patry <nicolas@huggingface.co>"] [tool.poetry.dependencies] python = ">=3.9,<3.13" syrupy = "4.0.1" text-generation = "^0.6.0" pytest = "^7.4.0" pytest-asyncio = "^...
text-generation-inference/integration-tests/pyproject.toml/0
{ "file_path": "text-generation-inference/integration-tests/pyproject.toml", "repo_id": "text-generation-inference", "token_count": 151 }
371
<p align="center"> <img src="https://raw.githubusercontent.com/huggingface/alignment-handbook/main/assets/handbook.png"> </p> <p align="center"> 🤗 <a href="https://huggingface.co/collections/alignment-handbook/handbook-v01-models-and-datasets-654e424d22e6880da5ebc015" target="_blank">Models & Datasets</a> | 📃 ...
alignment-handbook/README.md/0
{ "file_path": "alignment-handbook/README.md", "repo_id": "alignment-handbook", "token_count": 2053 }
23
# candle-kernels This crate contains CUDA kernels used from candle. Some of these implementations come from the [dfdx crate](https://github.com/coreylowman/dfdx).
candle/candle-kernels/README.md/0
{ "file_path": "candle/candle-kernels/README.md", "repo_id": "candle", "token_count": 45 }
62
[tool.poetry] name = "langchain-monorepo" version = "0.0.1" description = "LangChain mono-repo" authors = [] license = "MIT" readme = "README.md" repository = "https://www.github.com/langchain-ai/langchain" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" [tool.poetry.group.docs.dependencies] langchain = { path = ...
langchain/pyproject.toml/0
{ "file_path": "langchain/pyproject.toml", "repo_id": "langchain", "token_count": 1157 }
665
import { FewShotPromptTemplate, PromptTemplate } from "@langchain/core/prompts"; export const run = async () => { // First, create a list of few-shot examples. const examples = [ { word: "happy", antonym: "sad" }, { word: "tall", antonym: "short" }, ]; // Next, we specify the template to format the ex...
langchainjs/examples/src/prompts/few_shot.ts/0
{ "file_path": "langchainjs/examples/src/prompts/few_shot.ts", "repo_id": "langchainjs", "token_count": 552 }
907
python_sources()
llama_index/llama-index-integrations/evaluation/llama-index-evaluation-tonic-validate/llama_index/evaluation/tonic_validate/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/evaluation/llama-index-evaluation-tonic-validate/llama_index/evaluation/tonic_validate/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,206
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
accelerate/src/accelerate/test_utils/training.py/0
{ "file_path": "accelerate/src/accelerate/test_utils/training.py", "repo_id": "accelerate", "token_count": 1572 }
15