text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
// 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/querycoordv2/job/job.go/0
{ "file_path": "milvus/internal/querycoordv2/job/job.go", "repo_id": "milvus", "token_count": 738 }
1,860
from llama_index.packs.zephyr_query_engine.base import ZephyrQueryEnginePack __all__ = ["ZephyrQueryEnginePack"]
llama_index/llama-index-packs/llama-index-packs-zephyr-query-engine/llama_index/packs/zephyr_query_engine/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-zephyr-query-engine/llama_index/packs/zephyr_query_engine/__init__.py", "repo_id": "llama_index", "token_count": 39 }
1,829
python_sources()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-ollama/llama_index/embeddings/ollama/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-ollama/llama_index/embeddings/ollama/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,271
[tool.poetry] name = "rewrite-retrieve-read" version = "0.0.1" description = "Query transformation using the rewrite-retrieve-read to improve retrieval" authors = [] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" duckduckgo-search = "^3.9.3" openai = "<2" [tool.poetry.group...
langchain/templates/rewrite-retrieve-read/pyproject.toml/0
{ "file_path": "langchain/templates/rewrite-retrieve-read/pyproject.toml", "repo_id": "langchain", "token_count": 272 }
679
import { test, expect, jest } from "@jest/globals"; import { insecureHash } from "@langchain/core/utils/hash"; import { StoredGeneration } from "@langchain/core/messages"; import { UpstashRedisCache } from "../upstash_redis.js"; const sha1 = (str: string) => insecureHash(str); test("UpstashRedisCache", async () => {...
langchainjs/libs/langchain-community/src/caches/tests/upstash_redis.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/caches/tests/upstash_redis.test.ts", "repo_id": "langchainjs", "token_count": 288 }
980
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-bedrock/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-bedrock/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,234
# 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/schedulers/test_scheduler_flax.py/0
{ "file_path": "diffusers/tests/schedulers/test_scheduler_flax.py", "repo_id": "diffusers", "token_count": 18869 }
281
// 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/proxy/data_coord_mock_test.go/0
{ "file_path": "milvus/internal/proxy/data_coord_mock_test.go", "repo_id": "milvus", "token_count": 4787 }
1,825
# Copyright 2023-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 applicable law or...
peft/src/peft/tuners/prompt_tuning/config.py/0
{ "file_path": "peft/src/peft/tuners/prompt_tuning/config.py", "repo_id": "peft", "token_count": 1090 }
327
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-singlestore/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-singlestore/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,429
import type { SupabaseFilterRPCCall, SupabaseMetadata, SupabaseVectorStore, } from "@langchain/community/vectorstores/supabase"; import { Comparator, Comparators, Comparison, Operation, Operator, Operators, StructuredQuery, } from "../../chains/query_constructor/ir.js"; import { BaseTranslator } fro...
langchainjs/langchain/src/retrievers/self_query/supabase.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/self_query/supabase.ts", "repo_id": "langchainjs", "token_count": 3862 }
960
from typing import List import pytest from llama_index.legacy.indices.document_summary.base import DocumentSummaryIndex from llama_index.legacy.response_synthesizers import get_response_synthesizer from llama_index.legacy.schema import Document from llama_index.legacy.service_context import ServiceContext from tests....
llama_index/llama-index-legacy/tests/indices/document_summary/conftest.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/document_summary/conftest.py", "repo_id": "llama_index", "token_count": 470 }
1,660
from llama_index.core.storage.docstore.keyval_docstore import KVDocumentStore from llama_index.storage.docstore.mongodb import MongoDocumentStore def test_class(): names_of_base_classes = [b.__name__ for b in MongoDocumentStore.__mro__] assert KVDocumentStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-mongodb/tests/test_storage_docstore_mongodb.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-mongodb/tests/test_storage_docstore_mongodb.py", "repo_id": "llama_index", "token_count": 101 }
1,490
import { NextRequest, NextResponse } from "next/server"; import { Message as VercelChatMessage, StreamingTextResponse } from "ai"; import { ChatOpenAI } from "@langchain/openai"; import { PromptTemplate } from "@langchain/core/prompts"; import { HttpResponseOutputParser } from "langchain/output_parsers"; export const...
langchain-nextjs-template/app/api/chat/route.ts/0
{ "file_path": "langchain-nextjs-template/app/api/chat/route.ts", "repo_id": "langchain-nextjs-template", "token_count": 781 }
65
# we define a fixture function below and it will be "used" by # referencing its name from tests import os import pytest from attr import dataclass os.environ["AWS_DEFAULT_REGION"] = "us-east-1" # defaults region @dataclass class SageMakerTestEnvironment: framework: str role = "arn:aws:iam::558105141721:r...
transformers/tests/sagemaker/conftest.py/0
{ "file_path": "transformers/tests/sagemaker/conftest.py", "repo_id": "transformers", "token_count": 1035 }
788
- title: Get started sections: - local: index title: 🤗 PEFT - local: quicktour title: Quicktour - local: install title: Installation - title: Tutorial sections: - local: tutorial/peft_model_config title: Configurations and models - local: tutorial/peft_integrations title: Integration...
peft/docs/source/_toctree.yml/0
{ "file_path": "peft/docs/source/_toctree.yml", "repo_id": "peft", "token_count": 1041 }
319
from langchain_community.chat_models.javelin_ai_gateway import ( ChatJavelinAIGateway, ChatParams, ) __all__ = ["ChatJavelinAIGateway", "ChatParams"]
langchain/libs/langchain/langchain/chat_models/javelin_ai_gateway.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_models/javelin_ai_gateway.py", "repo_id": "langchain", "token_count": 65 }
471
# Copyright 2024 FABRIC authors 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 re...
diffusers/examples/community/pipeline_fabric.py/0
{ "file_path": "diffusers/examples/community/pipeline_fabric.py", "repo_id": "diffusers", "token_count": 16483 }
201
# Text Generation Inference Python gRPC Server A Python gRPC server for Text Generation Inference ## Install ```shell make install ``` ## Run ```shell make run-dev ```
text-generation-inference/server/README.md/0
{ "file_path": "text-generation-inference/server/README.md", "repo_id": "text-generation-inference", "token_count": 55 }
375
"""Database Tool.""" from typing import Any, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.core.utilities.sql_wrapper import SQLDatabase from sqlalchemy import MetaData, t...
llama_index/llama-index-integrations/tools/llama-index-tools-database/llama_index/tools/database/base.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-database/llama_index/tools/database/base.py", "repo_id": "llama_index", "token_count": 2047 }
1,619
<jupyter_start><jupyter_text>Custom MemoryAlthough there are a few predefined types of memory in LangChain, it is highly possible you will want to add your own type of memory that is optimal for your application. This notebook covers how to do that. For this notebook, we will add a custom memory type to `ConversationCh...
langchain/docs/docs/modules/memory/custom_memory.ipynb/0
{ "file_path": "langchain/docs/docs/modules/memory/custom_memory.ipynb", "repo_id": "langchain", "token_count": 1661 }
203
// 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/pkg/util/paramtable/runtime.go/0
{ "file_path": "milvus/pkg/util/paramtable/runtime.go", "repo_id": "milvus", "token_count": 858 }
2,065
syntax = "proto3"; package milvus.proto.internal; option go_package = "github.com/milvus-io/milvus/internal/proto/internalpb"; import "common.proto"; import "schema.proto"; message GetTimeTickChannelRequest { } message GetStatisticsChannelRequest { } message GetDdChannelRequest { } message NodeInfo { common.Addr...
milvus/internal/proto/internal.proto/0
{ "file_path": "milvus/internal/proto/internal.proto", "repo_id": "milvus", "token_count": 2368 }
1,737
""" SGDP Optimizer Implementation copied from https://github.com/clovaai/AdamP/blob/master/adamp/sgdp.py Paper: `Slowing Down the Weight Norm Increase in Momentum-based Optimizers` - https://arxiv.org/abs/2006.08217 Code: https://github.com/clovaai/AdamP Copyright (c) 2020-present NAVER Corp. MIT license """ import ...
pytorch-image-models/timm/optim/sgdp.py/0
{ "file_path": "pytorch-image-models/timm/optim/sgdp.py", "repo_id": "pytorch-image-models", "token_count": 1186 }
382
"""Test Baichuan LLM Endpoint.""" from langchain_core.outputs import LLMResult from langchain_community.llms.baichuan import BaichuanLLM def test_call() -> None: """Test valid call to baichuan.""" llm = BaichuanLLM() output = llm("Who won the second world war?") assert isinstance(output, str) def t...
langchain/libs/community/tests/integration_tests/llms/test_baichuan.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_baichuan.py", "repo_id": "langchain", "token_count": 199 }
335
import { OllamaFunctions } from "langchain/experimental/chat_models/ollama_functions"; import { HumanMessage } from "@langchain/core/messages"; const model = new OllamaFunctions({ temperature: 0.1, model: "mistral", }).bind({ functions: [ { name: "get_current_weather", description: "Get the curre...
langchainjs/examples/src/models/chat/ollama_functions/function_calling.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/ollama_functions/function_calling.ts", "repo_id": "langchainjs", "token_count": 477 }
870
[tool.poetry] name = "openai-functions-agent-gmail" version = "0.1.0" description = "Agent using OpenAI function calling to execute functions, including search" authors = [ "Lance Martin <lance@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = ">=0.0.349,<0.1.0"...
langchain/templates/openai-functions-agent-gmail/pyproject.toml/0
{ "file_path": "langchain/templates/openai-functions-agent-gmail/pyproject.toml", "repo_id": "langchain", "token_count": 402 }
661
import pandas as pd import pytest from langchain_core.documents import Document from langchain_community.document_loaders import DataFrameLoader @pytest.fixture def sample_data_frame() -> pd.DataFrame: data = { "text": ["Hello", "World"], "author": ["Alice", "Bob"], "date": ["2022-01-01",...
langchain/libs/community/tests/integration_tests/document_loaders/test_dataframe.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_dataframe.py", "repo_id": "langchain", "token_count": 537 }
340
# coding=utf-8 # Copyright 2020 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 clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/tests/generation/test_beam_constraints.py/0
{ "file_path": "transformers/tests/generation/test_beam_constraints.py", "repo_id": "transformers", "token_count": 1723 }
779
/* eslint-disable import/no-extraneous-dependencies */ import { async as glob } from "fast-glob"; import fs from "fs"; import path from "path"; interface CopyOption { cwd?: string; rename?: (basename: string) => string; parents?: boolean; } const identity = (x: string) => x; export const copy = async ( src: ...
langchainjs/libs/create-langchain-integration/helpers/copy.ts/0
{ "file_path": "langchainjs/libs/create-langchain-integration/helpers/copy.ts", "repo_id": "langchainjs", "token_count": 477 }
1,036
from langchain_community.tools.arxiv.tool import ArxivInput, ArxivQueryRun __all__ = ["ArxivInput", "ArxivQueryRun"]
langchain/libs/langchain/langchain/tools/arxiv/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/arxiv/tool.py", "repo_id": "langchain", "token_count": 44 }
545
import * as readline from "readline"; import { JsonOutputToolsParser } from "langchain/output_parsers"; import { callToolList, model } from "./helpers.js"; // Use readline to ask the user for approval function askQuestion(question: string): Promise<string> { const rl = readline.createInterface({ input: process.s...
langchainjs/examples/src/use_cases/human_in_the_loop/accept-feedback.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/human_in_the_loop/accept-feedback.ts", "repo_id": "langchainjs", "token_count": 740 }
825
import json import os from ghapi.all import GhApi FOLDER_STRING = os.environ.get("FOLDER_STRING", "") folder = f"benchmark/trl/{FOLDER_STRING}" host_url = f"https://huggingface.co/datasets/trl-internal-testing/example-images/resolve/main/images/benchmark/{FOLDER_STRING}" # Create a GitHub API instance github_contex...
trl/benchmark/post_github_comment.py/0
{ "file_path": "trl/benchmark/post_github_comment.py", "repo_id": "trl", "token_count": 358 }
770
from skeleton_of_thought.chain import chain __all__ = ["chain"]
langchain/templates/skeleton-of-thought/skeleton_of_thought/__init__.py/0
{ "file_path": "langchain/templates/skeleton-of-thought/skeleton_of_thought/__init__.py", "repo_id": "langchain", "token_count": 20 }
700
import json import sys def format_json_to_md(input_json_file, output_md_file): with open(input_json_file, encoding="utf-8") as f: results = json.load(f) output_md = ["<details>", "<summary>Show updated benchmarks!</summary>", " "] for benchmark_name in sorted(results): benchmark_res = re...
datasets/benchmarks/format.py/0
{ "file_path": "datasets/benchmarks/format.py", "repo_id": "datasets", "token_count": 746 }
118
"""Simple reader that reads wikipedia.""" from typing import Any, List from llama_index.core.readers.base import BasePydanticReader from llama_index.core.schema import Document class WikipediaReader(BasePydanticReader): """Wikipedia reader. Reads a page. """ is_remote: bool = True def __init_...
llama_index/llama-index-integrations/readers/llama-index-readers-wikipedia/llama_index/readers/wikipedia/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-wikipedia/llama_index/readers/wikipedia/base.py", "repo_id": "llama_index", "token_count": 502 }
1,544
""" Image to Patch Embedding using Conv2d A convolution based approach to patchifying a 2D image w/ embedding projection. Based on code in: * https://github.com/google-research/vision_transformer * https://github.com/google-research/big_vision/tree/main/big_vision Hacked together by / Copyright 2020 Ross Wightma...
pytorch-image-models/timm/layers/patch_embed.py/0
{ "file_path": "pytorch-image-models/timm/layers/patch_embed.py", "repo_id": "pytorch-image-models", "token_count": 4705 }
335
from typing import Any, Dict, Optional, Type from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.language_models import BaseLanguageModel from langchain_core.pydantic_v1 import BaseModel, Field, root_validator from langchain_community.chat_models import ChatOpenAI from langchain_communi...
langchain/libs/community/langchain_community/tools/amadeus/closest_airport.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/amadeus/closest_airport.py", "repo_id": "langchain", "token_count": 891 }
292
# Quicktour Let's have a quick look at the 🤗 Tokenizers library features. The library provides an implementation of today's most used tokenizers that is both easy to use and blazing fast. ## Build a tokenizer from scratch To illustrate how fast the 🤗 Tokenizers library is, let's train a new tokenizer on [wikitext-...
tokenizers/docs/source-doc-builder/quicktour.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/quicktour.mdx", "repo_id": "tokenizers", "token_count": 7936 }
423
# PyTorch Image Models - [What's New](#whats-new) - [Introduction](#introduction) - [Models](#models) - [Features](#features) - [Results](#results) - [Getting Started (Documentation)](#getting-started-documentation) - [Train, Validation, Inference Scripts](#train-validation-inference-scripts) - [Awesome PyTorch Resourc...
pytorch-image-models/README.md/0
{ "file_path": "pytorch-image-models/README.md", "repo_id": "pytorch-image-models", "token_count": 19602 }
332
# Würstchen text-to-image fine-tuning ## Running locally with PyTorch Before running the scripts, make sure to install the library's training dependencies: **Important** To make sure you can successfully run the latest versions of the example scripts, we highly recommend **installing from source** and keeping the i...
diffusers/examples/wuerstchen/text_to_image/README.md/0
{ "file_path": "diffusers/examples/wuerstchen/text_to_image/README.md", "repo_id": "diffusers", "token_count": 1206 }
223
--- sidebar_label: OpenAI --- import CodeBlock from "@theme/CodeBlock"; # ChatOpenAI You can use OpenAI's chat models as follows: import OpenAI from "@examples/models/chat/integration_openai.ts"; import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <IntegrationInstallTooltip></...
langchainjs/docs/core_docs/docs/integrations/chat/openai.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/chat/openai.mdx", "repo_id": "langchainjs", "token_count": 861 }
754
package allocator import ( "sync" "testing" "github.com/stretchr/testify/assert" ) func TestAllocatorFromList(t *testing.T) { t.Run("de asc", func(t *testing.T) { s := []int64{100000, 10000, 1000} alloc := NewAllocatorFromList(s, true, true) n := 100 wg := &sync.WaitGroup{} for i := 0; i < n; i++ { ...
milvus/cmd/tools/migration/allocator/allocator_from_list_test.go/0
{ "file_path": "milvus/cmd/tools/migration/allocator/allocator_from_list_test.go", "repo_id": "milvus", "token_count": 280 }
1,629
from llama_index.llms.anyscale.base import Anyscale __all__ = ["Anyscale"]
llama_index/llama-index-integrations/llms/llama-index-llms-anyscale/llama_index/llms/anyscale/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-anyscale/llama_index/llms/anyscale/__init__.py", "repo_id": "llama_index", "token_count": 30 }
1,276
import multiprocessing from typing import Any, Dict, Generator, Optional, Tuple import pytest from chromadb import CloudClient from chromadb.api import ServerAPI from chromadb.auth.token import TokenTransportHeader from chromadb.config import DEFAULT_DATABASE, DEFAULT_TENANT, Settings, System from chromadb.errors impor...
chroma/chromadb/test/client/test_cloud_client.py/0
{ "file_path": "chroma/chromadb/test/client/test_cloud_client.py", "repo_id": "chroma", "token_count": 1408 }
25
// 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/core/src/log/Log.cpp/0
{ "file_path": "milvus/internal/core/src/log/Log.cpp", "repo_id": "milvus", "token_count": 1365 }
1,875
"""Helper functions for Titanic GPT-3 experiments.""" # form prompt, run GPT import re from typing import List, Optional, Tuple import pandas as pd from llama_index.indices.utils import extract_numbers_given_response from llama_index.llms import OpenAI from llama_index.prompts import BasePromptTemplate, PromptTemplat...
llama_index/experimental/classifier/utils.py/0
{ "file_path": "llama_index/experimental/classifier/utils.py", "repo_id": "llama_index", "token_count": 2116 }
1,154
# 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/speech_encoder_decoder/convert_mbart_wav2vec2_seq2seq_original_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/speech_encoder_decoder/convert_mbart_wav2vec2_seq2seq_original_to_pytorch.py", "repo_id": "transformers", "token_count": 6577 }
743
pub const LANGUAGES: [(&str, &str); 99] = [ ("en", "english"), ("zh", "chinese"), ("de", "german"), ("es", "spanish"), ("ru", "russian"), ("ko", "korean"), ("fr", "french"), ("ja", "japanese"), ("pt", "portuguese"), ("tr", "turkish"), ("pl", "polish"), ("ca", "catalan"), ...
candle/candle-wasm-examples/whisper/src/languages.rs/0
{ "file_path": "candle/candle-wasm-examples/whisper/src/languages.rs", "repo_id": "candle", "token_count": 1175 }
79
# Non-core Model Serving TGI supports various LLM architectures (see full list [here](../supported_models)). If you wish to serve a model that is not one of the supported models, TGI will fallback to the `transformers` implementation of that model. This means you will be unable to use some of the features introduced b...
text-generation-inference/docs/source/basic_tutorials/non_core_models.md/0
{ "file_path": "text-generation-inference/docs/source/basic_tutorials/non_core_models.md", "repo_id": "text-generation-inference", "token_count": 475 }
401
#!python from meta_gen import * import re def assemble(template, **kwargs): pattern = re.compile("@@@@(.*?)\n((.|\n)*?)\n####", re.MULTILINE) temp_info = pattern.findall(template) # print(temp_info) mapping = dict() rep_map = dict() # drop repetive field from mapping for k, v in kwargs.ite...
milvus/tools/core_gen/assemble.py/0
{ "file_path": "milvus/tools/core_gen/assemble.py", "repo_id": "milvus", "token_count": 522 }
2,134
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-astra-db/llama_index/readers/astra_db/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-astra-db/llama_index/readers/astra_db/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,464
import type { OpenAIClientOptions, AzureExtensionsOptions, ChatRequestMessage, } from "@azure/openai"; import type { BaseLanguageModelCallOptions } from "@langchain/core/language_models/base"; import type { TiktokenModel } from "js-tiktoken/lite"; import type { EmbeddingsParams } from "@langchain/core/embeddings"...
langchainjs/libs/langchain-azure-openai/src/types.ts/0
{ "file_path": "langchainjs/libs/langchain-azure-openai/src/types.ts", "repo_id": "langchainjs", "token_count": 1993 }
931
<jupyter_start><jupyter_text>Tool error handlingUsing a model to invoke a tool has some obvious potential failure modes. Firstly, the model needs to return a output that can be parsed at all. Secondly, the model needs to return tool arguments that are valid.We can build error handling into our chains to mitigate these ...
langchain/docs/docs/use_cases/tool_use/tool_error_handling.ipynb/0
{ "file_path": "langchain/docs/docs/use_cases/tool_use/tool_error_handling.ipynb", "repo_id": "langchain", "token_count": 2323 }
218
import { ChatMistralAI } from "@langchain/mistralai"; import { ChatPromptTemplate } from "@langchain/core/prompts"; import { StringOutputParser } from "@langchain/core/output_parsers"; const model = new ChatMistralAI({ apiKey: process.env.MISTRAL_API_KEY, modelName: "mistral-small", }); const prompt = ChatPromptTe...
langchainjs/examples/src/models/chat/chat_stream_mistralai.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/chat_stream_mistralai.ts", "repo_id": "langchainjs", "token_count": 325 }
827
from __future__ import annotations import logging import os import uuid import warnings from typing import TYPE_CHECKING, Any, Callable, Iterable, List, Optional, Tuple, Union import numpy as np from langchain_core._api.deprecation import deprecated from langchain_core.documents import Document from langchain_core.em...
langchain/libs/community/langchain_community/vectorstores/pinecone.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/pinecone.py", "repo_id": "langchain", "token_count": 7871 }
334
FROM debian:buster # arg that specifies the image name (for debugging) ARG IMAGE_ARG # arg that specifies the go version to install ARG GO_VERSION # add envs: # - so we can debug with the image name:tag # - adding gsutil etc. to path (where we will install them) # - disabling prompts when installing gsutil etc. # - ...
milvus/build/docker/krte/Dockerfile/0
{ "file_path": "milvus/build/docker/krte/Dockerfile", "repo_id": "milvus", "token_count": 1823 }
1,704
- sections: - local: index title: 🤗 Transformers - local: quicktour title: త్వరిత పర్యటన title: ప్రారంభించడానికి
transformers/docs/source/te/_toctree.yml/0
{ "file_path": "transformers/docs/source/te/_toctree.yml", "repo_id": "transformers", "token_count": 125 }
512
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/plbart.md/0
{ "file_path": "transformers/docs/source/en/model_doc/plbart.md", "repo_id": "transformers", "token_count": 1586 }
514
<jupyter_start><jupyter_text>News URLThis covers how to load HTML news articles from a list of URLs into a document format that we can use downstream.<jupyter_code>from langchain_community.document_loaders import NewsURLLoader urls = [ "https://www.bbc.com/news/world-us-canada-66388172", "https://www.bbc.com/ne...
langchain/docs/docs/integrations/document_loaders/news.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/news.ipynb", "repo_id": "langchain", "token_count": 568 }
103
# (Tensorflow) EfficientNet CondConv **EfficientNet** is a convolutional neural network architecture and scaling method that uniformly scales all dimensions of depth/width/resolution using a *compound coefficient*. Unlike conventional practice that arbitrary scales these factors, the EfficientNet scaling method unifo...
pytorch-image-models/hfdocs/source/models/tf-efficientnet-condconv.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/tf-efficientnet-condconv.mdx", "repo_id": "pytorch-image-models", "token_count": 3303 }
382
<jupyter_start><jupyter_text>OpenAI ToolsThese output parsers extract tool calls from OpenAI's function calling API responses. This means they are only usable with models that support function calling, and specifically the latest `tools` and `tool_choice` parameters. We recommend familiarizing yourself with [function c...
langchain/docs/docs/modules/model_io/output_parsers/types/openai_tools.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/output_parsers/types/openai_tools.ipynb", "repo_id": "langchain", "token_count": 1265 }
197
# coding=utf-8 # Copyright 2022 Meta Platforms 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/LICEN...
transformers/src/transformers/models/data2vec/modeling_tf_data2vec_vision.py/0
{ "file_path": "transformers/src/transformers/models/data2vec/modeling_tf_data2vec_vision.py", "repo_id": "transformers", "token_count": 32320 }
597
from __future__ import annotations import asyncio import functools import logging import uuid from abc import ABC, abstractmethod from concurrent.futures import ThreadPoolExecutor from contextlib import asynccontextmanager, contextmanager from contextvars import copy_context from typing import ( TYPE_CHECKING, ...
langchain/libs/core/langchain_core/callbacks/manager.py/0
{ "file_path": "langchain/libs/core/langchain_core/callbacks/manager.py", "repo_id": "langchain", "token_count": 31740 }
398
<jupyter_start><jupyter_text>Google Generative AI EmbeddingsConnect to Google's generative AI embeddings service using the `GoogleGenerativeAIEmbeddings` class, found in the [langchain-google-genai](https://pypi.org/project/langchain-google-genai/) package. Installation<jupyter_code>%pip install --upgrade --quiet lan...
langchain/docs/docs/integrations/text_embedding/google_generative_ai.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/google_generative_ai.ipynb", "repo_id": "langchain", "token_count": 647 }
172
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base"; import { AgentStep } from "@langchain/core/agents"; import { ChainValues } from "@langchain/core/utils/types"; import { BaseCallbackConfig, Callbacks, } from "@langchain/core/callbacks/manager"; import { BaseChain, LLMChain, LLM...
langchainjs/langchain/src/evaluation/base.ts/0
{ "file_path": "langchainjs/langchain/src/evaluation/base.ts", "repo_id": "langchainjs", "token_count": 3417 }
918
import { z } from "zod"; import type { ChatPromptTemplate } from "@langchain/core/prompts"; import { ChatOpenAI } from "@langchain/openai"; import { AgentExecutor, createOpenAIFunctionsAgent } from "langchain/agents"; import { pull } from "langchain/hub"; import { DynamicStructuredTool } from "@langchain/core/tools"; ...
langchainjs/examples/src/agents/handle_parsing_error.ts/0
{ "file_path": "langchainjs/examples/src/agents/handle_parsing_error.ts", "repo_id": "langchainjs", "token_count": 1014 }
756
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/sam/test_modeling_tf_sam.py/0
{ "file_path": "transformers/tests/models/sam/test_modeling_tf_sam.py", "repo_id": "transformers", "token_count": 11717 }
748
<jupyter_start><jupyter_text>Structured output parserThis output parser can be used when you want to return multiple fields. While the Pydantic/JSON parser is more powerful, this is useful for less powerful models.<jupyter_code>from langchain.output_parsers import ResponseSchema, StructuredOutputParser from langchain.p...
langchain/docs/docs/modules/model_io/output_parsers/types/structured.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/output_parsers/types/structured.ipynb", "repo_id": "langchain", "token_count": 453 }
206
import json from typing import Iterator, List, Mapping, Optional, Sequence, Union from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class HuggingFaceDatasetLoader(BaseLoader): """Load from `Hugging Face Hub` datasets.""" def __init__( sel...
langchain/libs/community/langchain_community/document_loaders/hugging_face_dataset.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/hugging_face_dataset.py", "repo_id": "langchain", "token_count": 1475 }
252
<jupyter_start><jupyter_text>Reasoning without ObservationIn [ReWOO](https://arxiv.org/abs/2305.18323), Xu, et. al, propose an agent that combines a multi-step planner and variable substitution for effective tool use. It was designed to improve on the ReACT-style agent architecture in the following ways:1. Reduce token...
langgraph/examples/rewoo/rewoo.ipynb/0
{ "file_path": "langgraph/examples/rewoo/rewoo.ipynb", "repo_id": "langgraph", "token_count": 2919 }
1,031
<!--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/luke.md/0
{ "file_path": "transformers/docs/source/en/model_doc/luke.md", "repo_id": "transformers", "token_count": 2521 }
465
"""Internal representation of a structured query language.""" from __future__ import annotations from abc import ABC, abstractmethod from enum import Enum from typing import Any, List, Optional, Sequence, Union from langchain_core.pydantic_v1 import BaseModel class Visitor(ABC): """Defines interface for IR tran...
langchain/libs/langchain/langchain/chains/query_constructor/ir.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/query_constructor/ir.py", "repo_id": "langchain", "token_count": 1270 }
497
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/convnextv2/convert_convnextv2_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/convnextv2/convert_convnextv2_to_pytorch.py", "repo_id": "transformers", "token_count": 5402 }
584
"""Relevancy evaluation.""" from __future__ import annotations import asyncio from typing import Any, Optional, Sequence, Union from llama_index.core import ServiceContext from llama_index.core.evaluation.base import BaseEvaluator, EvaluationResult from llama_index.core.indices import SummaryIndex from llama_index.co...
llama_index/llama-index-core/llama_index/core/evaluation/relevancy.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/evaluation/relevancy.py", "repo_id": "llama_index", "token_count": 2090 }
1,210
package coordinator import ( "context" "github.com/chroma/chroma-coordinator/internal/common" "github.com/chroma/chroma-coordinator/internal/metastore" "github.com/chroma/chroma-coordinator/internal/model" "github.com/chroma/chroma-coordinator/internal/notification" "github.com/chroma/chroma-coordinator/interna...
chroma/go/coordinator/internal/metastore/coordinator/memory_catalog.go/0
{ "file_path": "chroma/go/coordinator/internal/metastore/coordinator/memory_catalog.go", "repo_id": "chroma", "token_count": 4908 }
48
use crate::infer::InferError; use crate::infer::InferStreamResponse; use crate::validation::ValidGenerateRequest; use nohash_hasher::{BuildNoHashHasher, IntMap}; use std::cmp::min; use std::collections::VecDeque; use text_generation_client::{Batch, Request}; use tokio::sync::{mpsc, oneshot}; use tokio::time::Instant; u...
text-generation-inference/router/src/queue.rs/0
{ "file_path": "text-generation-inference/router/src/queue.rs", "repo_id": "text-generation-inference", "token_count": 9950 }
431
# Model arguments model_name_or_path: alignment-handbook/zephyr-7b-sft-full torch_dtype: null # Data training arguments dataset_mixer: HuggingFaceH4/ultrafeedback_binarized: 1.0 dataset_splits: - train_prefs - test_prefs preprocessing_num_workers: 12 # Training arguments with sensible defaults bf16: true beta: 0.01...
alignment-handbook/recipes/pref_align_scan/dpo/config_zephyr.yaml/0
{ "file_path": "alignment-handbook/recipes/pref_align_scan/dpo/config_zephyr.yaml", "repo_id": "alignment-handbook", "token_count": 359 }
19
# Overview These examples show how to run [Diffuser](https://arxiv.org/abs/2205.09991) in Diffusers. There are two ways to use the script, `run_diffuser_locomotion.py`. The key option is a change of the variable `n_guide_steps`. When `n_guide_steps=0`, the trajectories are sampled from the diffusion model, but not ...
diffusers/examples/reinforcement_learning/README.md/0
{ "file_path": "diffusers/examples/reinforcement_learning/README.md", "repo_id": "diffusers", "token_count": 352 }
216
<jupyter_start><jupyter_text>Airtable<jupyter_code>%pip install --upgrade --quiet pyairtable from langchain_community.document_loaders import AirtableLoader<jupyter_output><empty_output><jupyter_text>* Get your API key [here](https://support.airtable.com/docs/creating-and-using-api-keys-and-access-tokens).* Get ID of ...
langchain/docs/docs/integrations/document_loaders/airtable.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/airtable.ipynb", "repo_id": "langchain", "token_count": 344 }
96
"""OpenAPI spec agent."""
langchain/libs/community/langchain_community/agent_toolkits/openapi/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/openapi/__init__.py", "repo_id": "langchain", "token_count": 8 }
226
from pathlib import Path from typing import TYPE_CHECKING, Dict, List, Optional from llama_index.legacy.readers.base import BaseReader from llama_index.legacy.schema import Document if TYPE_CHECKING: from bs4 import Tag class HTMLTagReader(BaseReader): """ Read HTML files and extract text from a specifi...
llama_index/llama-index-legacy/llama_index/legacy/readers/file/html_reader.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/file/html_reader.py", "repo_id": "llama_index", "token_count": 1054 }
1,594
import copy import itertools from typing import List, Optional, Tuple import torch import torch.nn.functional as F from transformers import BartConfig from transformers.generation import GenerationMixin def _convert_past_list_to_tuple(past_key_values): """ In Bart model, the type of past_key_values is tuple...
transformers/examples/research_projects/onnx/summarization/bart_onnx/generation_onnx.py/0
{ "file_path": "transformers/examples/research_projects/onnx/summarization/bart_onnx/generation_onnx.py", "repo_id": "transformers", "token_count": 15163 }
549
"""GitHub Toolkit.""" from typing import Dict, List from langchain_core.pydantic_v1 import BaseModel, Field from langchain_community.agent_toolkits.base import BaseToolkit from langchain_community.tools import BaseTool from langchain_community.tools.github.prompt import ( COMMENT_ON_ISSUE_PROMPT, CREATE_BRANC...
langchain/libs/community/langchain_community/agent_toolkits/github/toolkit.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/github/toolkit.py", "repo_id": "langchain", "token_count": 4910 }
210
import argparse import logging import os import sys import tempfile from pathlib import Path import lightning_base import pytest import pytorch_lightning as pl import torch from convert_pl_checkpoint_to_hf import convert_pl_to_hf from distillation import distill_main from finetune import SummarizationModule, main from...
transformers/examples/research_projects/seq2seq-distillation/_test_seq2seq_examples.py/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/_test_seq2seq_examples.py", "repo_id": "transformers", "token_count": 7908 }
615
from llama_index.core.extractors.interface import BaseExtractor from llama_index.core.extractors.metadata_extractors import ( KeywordExtractor, PydanticProgramExtractor, QuestionsAnsweredExtractor, SummaryExtractor, TitleExtractor, ) __all__ = [ "SummaryExtractor", "QuestionsAnsweredExtract...
llama_index/llama-index-core/llama_index/core/extractors/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/extractors/__init__.py", "repo_id": "llama_index", "token_count": 157 }
1,174
/* eslint-disable no-process-env */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { test, expect } from "@jest/globals"; import { MotorheadMemory } from "../motorhead_memory.js"; test("Test managed motörhead memory", async () => { const memory = new MotorheadMemory({ sessionId: new Date()....
langchainjs/libs/langchain-community/src/memory/tests/motorhead_memory.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/memory/tests/motorhead_memory.int.test.ts", "repo_id": "langchainjs", "token_count": 284 }
950
# langchain-cli This package implements the official CLI for LangChain. Right now, it is most useful for getting started with LangChain Templates! [CLI Docs](https://github.com/langchain-ai/langchain/blob/master/libs/cli/DOCS.md) [LangServe Templates Quickstart](https://github.com/langchain-ai/langchain/blob/master/...
langchain/libs/cli/README.md/0
{ "file_path": "langchain/libs/cli/README.md", "repo_id": "langchain", "token_count": 111 }
197
import logging import os from typing import Generator import pytest from llama_index.legacy.schema import TextNode from llama_index.legacy.vector_stores import SingleStoreVectorStore from llama_index.legacy.vector_stores.types import ( ExactMatchFilter, MetadataFilters, VectorStoreQuery, ) logger = loggin...
llama_index/llama-index-legacy/tests/vector_stores/test_singlestoredb.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/vector_stores/test_singlestoredb.py", "repo_id": "llama_index", "token_count": 1104 }
1,637
python_sources()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-jinaai/llama_index/embeddings/jinaai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-jinaai/llama_index/embeddings/jinaai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,367
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datanode/binlog_io_test.go/0
{ "file_path": "milvus/internal/datanode/binlog_io_test.go", "repo_id": "milvus", "token_count": 5056 }
1,698
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/tools/tool_spec/load_and_search/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/tools/tool_spec/load_and_search/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,780
<jupyter_start><jupyter_text>Tokenizers (PyTorch) Installez la bibliothèque 🤗 *Transformers* pour exécuter ce *notebook*.<jupyter_code>!pip install transformers[sentencepiece] tokenized_text = "Jim Henson était marionnettiste".split() print(tokenized_text) from transformers import CamembertTokenizer tokenizer = Camem...
notebooks/course/fr/chapter2/section4_pt.ipynb/0
{ "file_path": "notebooks/course/fr/chapter2/section4_pt.ipynb", "repo_id": "notebooks", "token_count": 314 }
288
// Code generated by mockery v2.32.4. DO NOT EDIT. package eventlog import mock "github.com/stretchr/testify/mock" // MockLogger is an autogenerated mock type for the Logger type type MockLogger struct { mock.Mock } type MockLogger_Expecter struct { mock *mock.Mock } func (_m *MockLogger) EXPECT() *MockLogger_Ex...
milvus/pkg/eventlog/mock_logger.go/0
{ "file_path": "milvus/pkg/eventlog/mock_logger.go", "repo_id": "milvus", "token_count": 1484 }
2,088
from langchain_community.vectorstores.hologres import ( Hologres, ) __all__ = ["Hologres"]
langchain/libs/langchain/langchain/vectorstores/hologres.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/hologres.py", "repo_id": "langchain", "token_count": 36 }
582
package typeutil type CacheOpType int32 const ( CacheAddUserToRole CacheOpType = iota + 1 CacheRemoveUserFromRole CacheGrantPrivilege CacheRevokePrivilege CacheDeleteUser CacheDropRole CacheRefresh ) type CacheOp struct { OpType CacheOpType OpKey string }
milvus/pkg/util/typeutil/cache.go/0
{ "file_path": "milvus/pkg/util/typeutil/cache.go", "repo_id": "milvus", "token_count": 90 }
2,122
"""Test Baidu Qianfan LLM Endpoint.""" from typing import Generator from langchain_core.outputs import LLMResult from langchain_community.llms.baidu_qianfan_endpoint import QianfanLLMEndpoint def test_call() -> None: """Test valid call to qianfan.""" llm = QianfanLLMEndpoint() output = llm("write a joke...
langchain/libs/community/tests/integration_tests/llms/test_qianfan_endpoint.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_qianfan_endpoint.py", "repo_id": "langchain", "token_count": 473 }
344
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-ollama/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-ollama/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,310
from typing import Any, List from llama_index.legacy.ingestion import IngestionCache from llama_index.legacy.ingestion.pipeline import get_transformation_hash from llama_index.legacy.schema import BaseNode, TextNode, TransformComponent class DummyTransform(TransformComponent): def __call__(self, nodes: List[Base...
llama_index/llama-index-legacy/tests/ingestion/test_cache.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/ingestion/test_cache.py", "repo_id": "llama_index", "token_count": 483 }
1,638
python_sources()
llama_index/llama-index-packs/llama-index-packs-rag-cli-local/llama_index/packs/rag_cli_local/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-rag-cli-local/llama_index/packs/rag_cli_local/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,717