text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# 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/deta/test_modeling_deta.py/0
{ "file_path": "transformers/tests/models/deta/test_modeling_deta.py", "repo_id": "transformers", "token_count": 11996 }
742
# coding=utf-8 # Copyright 2019 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
transformers/examples/research_projects/bertabs/test_utils_summarization.py/0
{ "file_path": "transformers/examples/research_projects/bertabs/test_utils_summarization.py", "repo_id": "transformers", "token_count": 1749 }
569
import { PromptTemplate } from "@langchain/core/prompts"; import { RunnableSequence } from "@langchain/core/runnables"; import { StringOutputParser } from "@langchain/core/output_parsers"; import { ChatAnthropic } from "@langchain/anthropic"; const prompt1 = PromptTemplate.fromTemplate( `What is the city {person} is...
langchainjs/examples/src/guides/expression_language/cookbook_multiple_chains.ts/0
{ "file_path": "langchainjs/examples/src/guides/expression_language/cookbook_multiple_chains.ts", "repo_id": "langchainjs", "token_count": 291 }
865
""" Activations A collection of jit-scripted activations fn and modules with a common interface so that they can easily be swapped. All have an `inplace` arg even if not used. All jit scripted activations are lacking in-place variations on purpose, scripted kernel fusion does not currently work across in-place op bou...
pytorch-image-models/timm/layers/activations_jit.py/0
{ "file_path": "pytorch-image-models/timm/layers/activations_jit.py", "repo_id": "pytorch-image-models", "token_count": 1008 }
361
from enum import Enum from typing import TYPE_CHECKING, Union, overload import numpy as np if TYPE_CHECKING: import torch class Pooling(str, Enum): """Enum of possible pooling choices with pooling behaviors.""" CLS = "cls" MEAN = "mean" def __call__(self, array: np.ndarray) -> np.ndarray: ...
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/llama_index/embeddings/huggingface/pooling.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/llama_index/embeddings/huggingface/pooling.py", "repo_id": "llama_index", "token_count": 624 }
1,312
python_sources()
llama_index/llama-index-core/llama_index/core/agent/react_multimodal/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/agent/react_multimodal/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,161
from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.embeddings.langchain import LangchainEmbedding def test_langchain_embedding_class(): names_of_base_classes = [b.__name__ for b in LangchainEmbedding.__mro__] assert BaseEmbedding.__name__ in names_of_base_classes
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-langchain/tests/test_embeddings_langchain.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-langchain/tests/test_embeddings_langchain.py", "repo_id": "llama_index", "token_count": 106 }
1,267
package storage import ( "testing" "github.com/stretchr/testify/assert" ) func TestParseSegmentIDByBinlog(t *testing.T) { type testCase struct { name string input string rootPath string expectError bool expectID UniqueID isIgnorableError bool } cases := [...
milvus/internal/storage/binlog_util_test.go/0
{ "file_path": "milvus/internal/storage/binlog_util_test.go", "repo_id": "milvus", "token_count": 1002 }
2,008
from typing import Any, Collection, List, Optional, Tuple, Union from llama_index.core.tools.types import AsyncBaseTool from pydantic import BaseModel class LLMCompilerParseResult(BaseModel): """LLMCompiler parser result.""" thought: str idx: int tool_name: str args: str class JoinerOutput(Bas...
llama_index/llama-index-packs/llama-index-packs-agents-llm-compiler/llama_index/packs/agents_llm_compiler/schema.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-agents-llm-compiler/llama_index/packs/agents_llm_compiler/schema.py", "repo_id": "llama_index", "token_count": 1000 }
1,552
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "vectorstores/cassandra", }); export * from "@langchain/community/vectorstores/cassandra";
langchainjs/langchain/src/vectorstores/cassandra.ts/0
{ "file_path": "langchainjs/langchain/src/vectorstores/cassandra.ts", "repo_id": "langchainjs", "token_count": 74 }
964
// 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/util/importutilv2/parquet/field_reader.go/0
{ "file_path": "milvus/internal/util/importutilv2/parquet/field_reader.go", "repo_id": "milvus", "token_count": 6548 }
1,872
export const PREFIX = `Answer the following questions truthfully and as best you can.`; export const AGENT_ACTION_FORMAT_INSTRUCTIONS = `Output a JSON markdown code snippet containing a valid JSON blob (denoted below by $JSON_BLOB). This $JSON_BLOB must have a "action" key (with the name of the tool to use) and an "act...
langchainjs/langchain/src/agents/structured_chat/prompt.ts/0
{ "file_path": "langchainjs/langchain/src/agents/structured_chat/prompt.ts", "repo_id": "langchainjs", "token_count": 727 }
841
# flake8: noqa # 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 requi...
trl/trl/trainer/__init__.py/0
{ "file_path": "trl/trl/trainer/__init__.py", "repo_id": "trl", "token_count": 450 }
787
# coding=utf-8 # Copyright 2021 The OpenAI Team 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/L...
transformers/src/transformers/models/clip/modeling_tf_clip.py/0
{ "file_path": "transformers/src/transformers/models/clip/modeling_tf_clip.py", "repo_id": "transformers", "token_count": 25977 }
658
import { ReActSingleInputOutputParser } from "../react/output_parser.js"; test("ReActSingleInputOutputParser identifies final answer", async () => { const finalAnswerText = `Observation: 2.169459462491557 Thought: I now know the final answer Final Answer: Harry Styles, Olivia Wilde's boyfriend, is 29 years old a...
langchainjs/langchain/src/agents/tests/react.test.ts/0
{ "file_path": "langchainjs/langchain/src/agents/tests/react.test.ts", "repo_id": "langchainjs", "token_count": 643 }
881
python_tests( name="tests", )
llama_index/llama-index-finetuning/tests/cross_encoders/BUILD/0
{ "file_path": "llama_index/llama-index-finetuning/tests/cross_encoders/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,255
<jupyter_start><jupyter_text>Trello>[Trello](https://www.atlassian.com/software/trello) is a web-based project management and collaboration tool that allows individuals and teams to organize and track their tasks and projects. It provides a visual interface known as a "board" where users can create lists and cards to r...
langchain/docs/docs/integrations/document_loaders/trello.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/trello.ipynb", "repo_id": "langchain", "token_count": 866 }
121
Simple Chat Engine ======================= .. automodule:: llama_index.core.chat_engine.simple :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper
llama_index/docs/api_reference/query/chat_engines/simple_chat_engine.rst/0
{ "file_path": "llama_index/docs/api_reference/query/chat_engines/simple_chat_engine.rst", "repo_id": "llama_index", "token_count": 76 }
1,160
# Minimal makefile for Sphinx documentation # # You can set these variables from the command line, and also # from the environment for those with `?=` SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build BUILDDIR ?= build SOURCEDIR = source # Put it first so that "make" without argument is like "make html_all". h...
tokenizers/docs/Makefile/0
{ "file_path": "tokenizers/docs/Makefile", "repo_id": "tokenizers", "token_count": 393 }
448
<jupyter_start><jupyter_text>MongoDB Atlas If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-vector-stores-mongodb !pip install llama-index # Provide URI to constructor, or use environment variable import pymongo from llama_index.vector_stor...
llama_index/docs/examples/vector_stores/MongoDBAtlasVectorSearch.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/MongoDBAtlasVectorSearch.ipynb", "repo_id": "llama_index", "token_count": 645 }
1,216
from llama_index.output_parsers.langchain.base import LangchainOutputParser __all__ = ["LangchainOutputParser"]
llama_index/llama-index-integrations/output_parsers/llama-index-output-parsers-langchain/llama_index/output_parsers/langchain/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/output_parsers/llama-index-output-parsers-langchain/llama_index/output_parsers/langchain/__init__.py", "repo_id": "llama_index", "token_count": 35 }
1,259
"""Tool for interacting with a single API with natural language definition.""" from __future__ import annotations from typing import TYPE_CHECKING, Any, Optional from langchain_core.language_models import BaseLanguageModel from langchain_core.tools import Tool from langchain_community.tools.openapi.utils.api_models...
langchain/libs/community/langchain_community/agent_toolkits/nla/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/nla/tool.py", "repo_id": "langchain", "token_count": 817 }
212
python_requirements( name="reqs", source="notebook-requirements.txt", )
llama_index/llama-index-integrations/readers/llama-index-readers-rayyan/examples/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-rayyan/examples/BUILD", "repo_id": "llama_index", "token_count": 31 }
1,510
from typing import Any, Dict, Optional, Type, Union from langchain.chains.openai_functions import create_structured_output_chain from langchain.prompts import PromptTemplate from langchain.pydantic_v1 import BaseModel from langchain.schema import BaseLLMOutputParser, BasePromptTemplate from langchain_community.chat_mo...
langchain/libs/experimental/langchain_experimental/tabular_synthetic_data/openai.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/tabular_synthetic_data/openai.py", "repo_id": "langchain", "token_count": 775 }
438
# Copyright 2021 The HuggingFace Datasets Authors. # # 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 ...
datasets/metrics/cer/cer.py/0
{ "file_path": "datasets/metrics/cer/cer.py", "repo_id": "datasets", "token_count": 2133 }
115
#ifndef _util_cuh #define _util_cuh #include <cuda_runtime.h> #include <cuda_fp16.h> #include <cstdint> #include <cstdio> #include <ATen/cuda/CUDAContext.h> #define DIVIDE(x, size) (((x) + (size) - 1) / (size)) #define DBGS(__x) printf("%s\n", __x) #define DBGI(__x) printf("%s: %i\n", #__x, __x) #define DBGI2(__x, _...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/util.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/util.cuh", "repo_id": "text-generation-inference", "token_count": 1114 }
423
"""Test query pipeline worker.""" from typing import Any, Dict, Set, Tuple from llama_index.legacy.agent.custom.pipeline_worker import ( QueryPipelineAgentWorker, ) from llama_index.legacy.agent.runner.base import AgentRunner from llama_index.legacy.agent.types import Task from llama_index.legacy.bridge.pydantic ...
llama_index/llama-index-legacy/tests/agent/custom/test_pipeline.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/agent/custom/test_pipeline.py", "repo_id": "llama_index", "token_count": 1286 }
1,791
{ "name": "@langchain/scripts", "version": "0.0.5", "description": "Shared scripts for LangChain.js", "type": "module", "engines": { "node": ">=18" }, "main": "./index.js", "types": "./index.d.ts", "repository": { "type": "git", "url": "git@github.com:langchain-ai/langchainjs.git" }, "...
langchainjs/libs/langchain-scripts/package.json/0
{ "file_path": "langchainjs/libs/langchain-scripts/package.json", "repo_id": "langchainjs", "token_count": 1611 }
1,043
import { OpenAI } from "@langchain/openai"; import { initializeAgentExecutorWithOptions } from "langchain/agents"; import { Calculator } from "langchain/tools/calculator"; import process from "process"; import { SerpAPI } from "@langchain/community/tools/serpapi"; export const run = async () => { process.env.LANGCHA...
langchainjs/examples/src/agents/concurrent_mrkl.ts/0
{ "file_path": "langchainjs/examples/src/agents/concurrent_mrkl.ts", "repo_id": "langchainjs", "token_count": 468 }
752
from langchain_community.document_loaders.github import ( BaseGitHubLoader, GitHubIssuesLoader, ) __all__ = ["BaseGitHubLoader", "GitHubIssuesLoader"]
langchain/libs/langchain/langchain/document_loaders/github.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/github.py", "repo_id": "langchain", "token_count": 57 }
515
<jupyter_start><jupyter_text>Fine-tuning for Semantic Segmentation with 🤗 TransformersThis tutorial shows how to fine-tune a SegFormer model in TensorFlow for the task of semantic segmentation. The tutorial is a TensorFlow port of this [blog post](https://huggingface.co/blog/fine-tune-segformer). As such, the notebook...
notebooks/examples/semantic_segmentation-tf.ipynb/0
{ "file_path": "notebooks/examples/semantic_segmentation-tf.ipynb", "repo_id": "notebooks", "token_count": 7206 }
303
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-gradient/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-gradient/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,397
python_tests()
llama_index/llama-index-packs/llama-index-packs-vectara-rag/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-vectara-rag/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,826
from __future__ import annotations import logging from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union import numpy as np try: import deeplake from deeplake import VectorStore as DeepLakeVectorStore from deeplake.core.fast_forwarding import version_compare _DEEPLAKE_INSTALL...
langchain/libs/community/langchain_community/vectorstores/deeplake.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/deeplake.py", "repo_id": "langchain", "token_count": 18846 }
324
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 338, "logprob": -9.0859375, "text": "is" }, { "id": 21784...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_awq/test_flash_llama_awq_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_awq/test_flash_llama_awq_all_params.json", "repo_id": "text-generation-inference", "token_count": 1165 }
373
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/models/univnet/convert_univnet.py/0
{ "file_path": "transformers/src/transformers/models/univnet/convert_univnet.py", "repo_id": "transformers", "token_count": 2613 }
666
# coding=utf-8 # Copyright 2021 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
transformers/tests/models/clip/test_image_processing_clip.py/0
{ "file_path": "transformers/tests/models/clip/test_image_processing_clip.py", "repo_id": "transformers", "token_count": 1915 }
712
#!/usr/bin/env python # 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/LI...
datasets/src/datasets/utils/_filelock.py/0
{ "file_path": "datasets/src/datasets/utils/_filelock.py", "repo_id": "datasets", "token_count": 903 }
151
<jupyter_start><jupyter_text>Xorbits Inference (Xinference)[Xinference](https://github.com/xorbitsai/inference) is a powerful and versatile library designed to serve LLMs, speech recognition models, and multimodal models, even on your laptop. It supports a variety of models compatible with GGML, such as chatglm, baichu...
langchain/docs/docs/integrations/llms/xinference.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/xinference.ipynb", "repo_id": "langchain", "token_count": 836 }
123
<jupyter_start><jupyter_text>Elasticsearch>[Elasticsearch](https://www.elastic.co/elasticsearch/) is a distributed, RESTful search and analytics engine, capable of performing both vector and lexical search. It is built on top of the Apache Lucene library. This notebook shows how to use functionality related to the `Ela...
langchain/docs/docs/integrations/vectorstores/elasticsearch.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/elasticsearch.ipynb", "repo_id": "langchain", "token_count": 7796 }
181
<jupyter_start><jupyter_text>If you're opening this Notebook on colab, you will probably need to install 🤗 Transformers and 🤗 Datasets. Uncomment the following cell and run it.<jupyter_code>#! pip install datasets transformers<jupyter_output><empty_output><jupyter_text>If you're opening this notebook locally, make su...
notebooks/examples/question_answering.ipynb/0
{ "file_path": "notebooks/examples/question_answering.ipynb", "repo_id": "notebooks", "token_count": 15331 }
307
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-google/llama_index/vector_stores/google/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-google/llama_index/vector_stores/google/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,483
/*! ************************************************************************************************** * Deformable DETR * Copyright (c) 2020 SenseTime. All Rights Reserved. * Licensed under the Apache License, Version 2.0 [see LICENSE for details] ***********************************************************************...
transformers/src/transformers/kernels/deformable_detr/vision.cpp/0
{ "file_path": "transformers/src/transformers/kernels/deformable_detr/vision.cpp", "repo_id": "transformers", "token_count": 220 }
564
# LlamaIndex Managed Integration: Zilliz
llama_index/llama-index-integrations/indices/llama-index-indices-managed-zilliz/README.md/0
{ "file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-zilliz/README.md", "repo_id": "llama_index", "token_count": 12 }
1,245
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/custom_tools.md/0
{ "file_path": "transformers/docs/source/ko/custom_tools.md", "repo_id": "transformers", "token_count": 22819 }
557
# shopping-assistant This template creates a shopping assistant that helps users find products that they are looking for. This template will use `Ionic` to search for products. ## Environment Setup This template will use `OpenAI` by default. Be sure that `OPENAI_API_KEY` is set in your environment. ## Usage To us...
langchain/templates/shopping-assistant/README.md/0
{ "file_path": "langchain/templates/shopping-assistant/README.md", "repo_id": "langchain", "token_count": 602 }
705
import json import sys class Message: def __init__( self, message_id, message_text, author, timestamp, parent_message=None, child_message=None, ): self.message_id = message_id self.message_text = message_text self.author = author ...
llama_index/docs/examples/discover_llamaindex/document_management/group_conversations.py/0
{ "file_path": "llama_index/docs/examples/discover_llamaindex/document_management/group_conversations.py", "repo_id": "llama_index", "token_count": 941 }
1,076
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
transformers/docs/source/de/peft.md/0
{ "file_path": "transformers/docs/source/de/peft.md", "repo_id": "transformers", "token_count": 3175 }
431
package main import ( "fmt" "os" "github.com/chroma/chroma-coordinator/cmd/grpccoordinator" "github.com/chroma/chroma-coordinator/internal/utils" "github.com/rs/zerolog" "github.com/spf13/cobra" "go.uber.org/automaxprocs/maxprocs" ) var ( rootCmd = &cobra.Command{ Use: "chroma", Short: "Chroma root com...
chroma/go/coordinator/cmd/main.go/0
{ "file_path": "chroma/go/coordinator/cmd/main.go", "repo_id": "chroma", "token_count": 317 }
41
#!/bin/bash #Download milvus source code git clone https://github.com/milvus-io/milvus.git cd milvus # $1 is the branch name or commit number git checkout $1 make cd .. #Prepare for milvus-deb mkdir -p milvus-deb/milvus mkdir milvus-deb/milvus/milvus-bin mkdir milvus-deb/milvus/milvus-lib ## binary cp milvus/bin/milv...
milvus/build/deb/build_deb.sh/0
{ "file_path": "milvus/build/deb/build_deb.sh", "repo_id": "milvus", "token_count": 1034 }
1,702
import json from typing import Any, Dict, Optional, Type, Union, cast from llama_index.core.bridge.pydantic import BaseModel from llama_index.core.program.llm_prompt_program import BaseLLMFunctionProgram from llama_index.core.prompts.base import PromptTemplate from llama_index.llms.huggingface import HuggingFaceLLM fr...
llama_index/llama-index-integrations/program/llama-index-program-lmformatenforcer/llama_index/program/lmformatenforcer/base.py/0
{ "file_path": "llama_index/llama-index-integrations/program/llama-index-program-lmformatenforcer/llama_index/program/lmformatenforcer/base.py", "repo_id": "llama_index", "token_count": 1682 }
1,270
import torch from loguru import logger from transformers.configuration_utils import PretrainedConfig from transformers.models.auto import modeling_auto from typing import Optional from text_generation_server.utils.speculate import get_speculate, set_speculate from text_generation_server.models.model import Model from...
text-generation-inference/server/text_generation_server/models/__init__.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/__init__.py", "repo_id": "text-generation-inference", "token_count": 7486 }
439
kind: NetworkChaos apiVersion: chaos-mesh.org/v1alpha1 metadata: name: test-datanode-network-latency namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: app.kubernetes.io/instance: milvus-chaos component: datanode mode: all action: delay delay: ...
milvus/tests/python_client/chaos/chaos_objects/network_latency/chaos_datanode_network_latency.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/network_latency/chaos_datanode_network_latency.yaml", "repo_id": "milvus", "token_count": 228 }
1,955
# Metric Card for XNLI ## Metric description The XNLI metric allows to evaluate a model's score on the [XNLI dataset](https://huggingface.co/datasets/xnli), which is a subset of a few thousand examples from the [MNLI dataset](https://huggingface.co/datasets/glue/viewer/mnli) that have been translated into a 14 differ...
datasets/metrics/xnli/README.md/0
{ "file_path": "datasets/metrics/xnli/README.md", "repo_id": "datasets", "token_count": 1226 }
136
python_tests( name="tests", )
llama_index/llama-index-core/tests/response_synthesizers/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/response_synthesizers/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,231
import json import operator import time import warnings from concurrent.futures import ThreadPoolExecutor from contextlib import contextmanager from typing import Annotated, Generator, Optional, TypedDict, Union import pytest from langchain_core.runnables import RunnablePassthrough from pytest_mock import MockerFixtur...
langgraph/tests/test_pregel.py/0
{ "file_path": "langgraph/tests/test_pregel.py", "repo_id": "langgraph", "token_count": 22966 }
1,036
python_tests()
llama_index/llama-index-packs/llama-index-packs-llama-dataset-metadata/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-llama-dataset-metadata/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,657
<jupyter_start><jupyter_text>Relevancy EvaluatorThis notebook uses the `RelevancyEvaluator` to measure if the response + source nodes match the query. This is useful for measuring if the query was actually answered by the response.<jupyter_code>%pip install llama-index-llms-openai pandas[jinja2] spacy import logging i...
llama_index/docs/examples/evaluation/relevancy_eval.ipynb/0
{ "file_path": "llama_index/docs/examples/evaluation/relevancy_eval.ipynb", "repo_id": "llama_index", "token_count": 1933 }
1,082
import torch import torch.distributed from transformers import AutoTokenizer, PreTrainedTokenizerBase from typing import Optional import os from text_generation_server.models.custom_modeling.mamba_modeling import ( MambaConfig, ) from loguru import logger from text_generation_server.pb import generate_pb2 from text...
text-generation-inference/server/text_generation_server/models/mamba.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/mamba.py", "repo_id": "text-generation-inference", "token_count": 13455 }
399
"""Chain for interacting with SQL Database."""
langchain/libs/langchain/langchain/chains/sql_database/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/sql_database/__init__.py", "repo_id": "langchain", "token_count": 10 }
467
import multiprocessing import pytest from pymilvus import MilvusException, connections from base.collection_wrapper import ApiCollectionWrapper from customize.milvus_operator import MilvusOperator from common import common_func as cf from common.common_type import default_nb from common.common_type import CaseLabel f...
milvus/tests/python_client/scale/test_proxy_scale.py/0
{ "file_path": "milvus/tests/python_client/scale/test_proxy_scale.py", "repo_id": "milvus", "token_count": 1895 }
2,042
# Generated content DO NOT EDIT class AddedToken: """ Represents a token that can be be added to a :class:`~tokenizers.Tokenizer`. It can have special options that defines the way it should behave. Args: content (:obj:`str`): The content of the token single_word (:obj:`bool`, defaults ...
tokenizers/bindings/python/py_src/tokenizers/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/__init__.pyi", "repo_id": "tokenizers", "token_count": 16502 }
413
import re from langchain.chains import LLMChain from langchain.prompts import ChatPromptTemplate, HumanMessagePromptTemplate from langchain_core.language_models import BaseLanguageModel from langchain_core.messages import SystemMessage from langchain_experimental.plan_and_execute.planners.base import LLMPlanner from ...
langchain/libs/experimental/langchain_experimental/plan_and_execute/planners/chat_planner.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/plan_and_execute/planners/chat_planner.py", "repo_id": "langchain", "token_count": 672 }
452
"""Test node mapping.""" from llama_index.core import SQLDatabase from llama_index.core.bridge.pydantic import BaseModel from llama_index.core.objects.base_node_mapping import SimpleObjectNodeMapping from llama_index.core.objects.table_node_mapping import ( SQLTableNodeMapping, SQLTableSchema, ) from llama_ind...
llama_index/llama-index-core/tests/objects/test_node_mapping.py/0
{ "file_path": "llama_index/llama-index-core/tests/objects/test_node_mapping.py", "repo_id": "llama_index", "token_count": 1535 }
1,270
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-database/llama_index/readers/database/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-database/llama_index/readers/database/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,423
use super::with_tracing::{layer_norm, linear_no_bias as linear, LayerNorm, Linear}; use candle::{DType, Device, IndexOp, Result, Tensor}; use candle_nn::{embedding, Embedding, Module, VarBuilder}; use std::collections::{HashMap, HashSet}; fn default_num_attention_heads() -> usize { 64 } // https://huggingface.co/...
candle/candle-transformers/src/models/rwkv_v5.rs/0
{ "file_path": "candle/candle-transformers/src/models/rwkv_v5.rs", "repo_id": "candle", "token_count": 7704 }
74
"""Tool for the DataForSeo SERP API.""" from typing import Optional from langchain_core.callbacks import ( AsyncCallbackManagerForToolRun, CallbackManagerForToolRun, ) from langchain_core.pydantic_v1 import Field from langchain_core.tools import BaseTool from langchain_community.utilities.dataforseo_api_sear...
langchain/libs/community/langchain_community/tools/dataforseo_api_search/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/dataforseo_api_search/tool.py", "repo_id": "langchain", "token_count": 852 }
286
[ { "server": "athena", "suite_params": [ { "suite": "011_cpu_search_binary.yaml", "image_type": "cpu" } ] } ]
milvus/tests/benchmark/milvus_benchmark/scheduler/jaccard.json/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/scheduler/jaccard.json", "repo_id": "milvus", "token_count": 136 }
1,996
from abc import abstractmethod from typing import Any, List, Optional from langchain.callbacks.manager import Callbacks from langchain.chains.llm import LLMChain from langchain_experimental.plan_and_execute.schema import Plan, PlanOutputParser from langchain_experimental.pydantic_v1 import BaseModel class BasePlann...
langchain/libs/experimental/langchain_experimental/plan_and_execute/planners/base.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/plan_and_execute/planners/base.py", "repo_id": "langchain", "token_count": 579 }
465
repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.2.0 hooks: - id: ruff args: [ --fix ] - id: ruff-format # - repo: https://github.com/codespell-project/codespell # rev: v2.1.0 # hooks: # - id: codespell # args: # - --ignore-words-list=n...
trl/.pre-commit-config.yaml/0
{ "file_path": "trl/.pre-commit-config.yaml", "repo_id": "trl", "token_count": 212 }
873
import { test, expect } from "@jest/globals"; import { Document } from "@langchain/core/documents"; import { OpenAIEmbeddings } from "@langchain/openai"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { TurbopufferVectorStore } from "../turbopuffer.js"; beforeEach(async () => { const emb...
langchainjs/libs/langchain-community/src/vectorstores/tests/turbopuffer.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/turbopuffer.int.test.ts", "repo_id": "langchainjs", "token_count": 1273 }
1,054
from __future__ import annotations import os from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Sequence from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader if TYPE_CHECKING: import mastodon def _dependable_mastodon_import() -> mas...
langchain/libs/community/langchain_community/document_loaders/mastodon.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/mastodon.py", "repo_id": "langchain", "token_count": 1412 }
240
# init
llama_index/llama-index-integrations/tools/llama-index-tools-google/llama_index/tools/google/search/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-google/llama_index/tools/google/search/__init__.py", "repo_id": "llama_index", "token_count": 3 }
1,439
package funcutil import "fmt" func MapReduce(results []map[string]string, method map[string]func(string) error) error { // TODO: use generic type to reconstruct map[string]string -> [T any] map[string]T for _, result := range results { for k, v := range result { fn, ok := method[k] if !ok { return fmt.E...
milvus/pkg/util/funcutil/map.go/0
{ "file_path": "milvus/pkg/util/funcutil/map.go", "repo_id": "milvus", "token_count": 170 }
1,901
"""Tool for the Wikipedia API.""" from typing import Optional from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.tools import BaseTool from langchain_community.utilities.stackexchange import StackExchangeAPIWrapper class StackExchangeTool(BaseTool): """Tool that uses StackExchan...
langchain/libs/community/langchain_community/tools/stackexchange/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/stackexchange/tool.py", "repo_id": "langchain", "token_count": 299 }
313
# Protein Data Bank (PDB) publication Loader This loader fetches the abstract of PDB entries using the RCSB (Research Collaboratory for Structural Bioinformatics) or EBI (European Bioinformatics Institute) REST api. ## Usage To use this loader, simply pass an array of PDB ids into `load_data`: ```python from llama_...
llama_index/llama-index-integrations/readers/llama-index-readers-pdb/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-pdb/README.md", "repo_id": "llama_index", "token_count": 238 }
1,358
""" Tensorflow Preprocessing Adapter Allows use of Tensorflow preprocessing pipeline in PyTorch Transform Copyright of original Tensorflow code below. Hacked together by / Copyright 2020 Ross Wightman """ # Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2....
pytorch-image-models/timm/data/tf_preprocessing.py/0
{ "file_path": "pytorch-image-models/timm/data/tf_preprocessing.py", "repo_id": "pytorch-image-models", "token_count": 3775 }
329
"""Test AliCloud Pai Eas Chat Model.""" import os from langchain_core.callbacks import CallbackManager from langchain_core.messages import AIMessage, BaseMessage, HumanMessage from langchain_core.outputs import ChatGeneration, LLMResult from langchain_community.chat_models.pai_eas_endpoint import PaiEasChatEndpoint f...
langchain/libs/community/tests/integration_tests/chat_models/test_pai_eas_chat_endpoint.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_models/test_pai_eas_chat_endpoint.py", "repo_id": "langchain", "token_count": 1018 }
337
#include <ATen/Dispatch.h> #include <THC/THCAtomics.cuh> #include <ATen/ATen.h> #include <torch/torch.h> #include <vector> #include <optional> /** * Friendly reminder of how multithreading works in CUDA: https://developer.nvidia.com/blog/even-easier-introduction-cuda * Check example at https://github.com/thomasw21/Li...
text-generation-inference/server/custom_kernels/custom_kernels/fused_attention_cuda.cu/0
{ "file_path": "text-generation-inference/server/custom_kernels/custom_kernels/fused_attention_cuda.cu", "repo_id": "text-generation-inference", "token_count": 5265 }
388
from typing import Any, List, Optional, Sequence from langchain_core.documents import BaseDocumentTransformer, Document from langchain_core.utils import get_from_env class DoctranPropertyExtractor(BaseDocumentTransformer): """Extract properties from text documents using doctran. Arguments: propertie...
langchain/libs/community/langchain_community/document_transformers/doctran_text_extract.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_transformers/doctran_text_extract.py", "repo_id": "langchain", "token_count": 2034 }
248
from typing import Generator import pytest from llama_index.legacy.data_structs.data_structs import IndexGraph from llama_index.legacy.storage.index_store.dynamodb_index_store import ( DynamoDBIndexStore, ) from llama_index.legacy.storage.kvstore.dynamodb_kvstore import DynamoDBKVStore from pytest import MonkeyPat...
llama_index/llama-index-legacy/tests/storage/index_store/test_dynamodb_index_store.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/storage/index_store/test_dynamodb_index_store.py", "repo_id": "llama_index", "token_count": 799 }
1,759
"""Test vector store indexes.""" import pickle from typing import Any, List, cast from llama_index.core.indices.loading import load_index_from_storage from llama_index.core.indices.vector_store.base import VectorStoreIndex from llama_index.core.llms.mock import MockLLM from llama_index.core.schema import Document from...
llama_index/llama-index-core/tests/indices/vector_store/test_simple.py/0
{ "file_path": "llama_index/llama-index-core/tests/indices/vector_store/test_simple.py", "repo_id": "llama_index", "token_count": 3538 }
1,224
# coding=utf-8 # Copyright 2022 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
transformers/tests/models/blip/test_image_processing_blip.py/0
{ "file_path": "transformers/tests/models/blip/test_image_processing_blip.py", "repo_id": "transformers", "token_count": 2155 }
771
from io import BytesIO from typing import Any, List, Tuple, Union import requests from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class ImageCaptionLoader(BaseLoader): """Load image captions. By default, the loader utilizes the pre-trained ...
langchain/libs/community/langchain_community/document_loaders/image_captions.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/image_captions.py", "repo_id": "langchain", "token_count": 1531 }
239
pre { white-space: break-spaces; } @media (min-width: 1200px) { .container, .container-lg, .container-md, .container-sm, .container-xl { max-width: 2560px !important; } } #my-component-root *, #headlessui-portal-root * { z-index: 10000; } table.longtable code { white-space: normal; } table.lon...
langchain/docs/api_reference/_static/css/custom.css/0
{ "file_path": "langchain/docs/api_reference/_static/css/custom.css", "repo_id": "langchain", "token_count": 151 }
84
from llama_index.readers.guru.base import ( GuruReader, ) __all__ = ["GuruReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-guru/llama_index/readers/guru/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-guru/llama_index/readers/guru/__init__.py", "repo_id": "llama_index", "token_count": 36 }
1,374
<jupyter_start><jupyter_text>Self Correcting Query Engines - Evaluation & Retry In this notebook, we showcase several advanced, self-correcting query engines. They leverage the latest LLM's ability to evaluate its own output, and then self-correct to give better responses. If you're opening this Notebook on colab, yo...
llama_index/docs/examples/evaluation/RetryQuery.ipynb/0
{ "file_path": "llama_index/docs/examples/evaluation/RetryQuery.ipynb", "repo_id": "llama_index", "token_count": 1952 }
1,055
<jupyter_start><jupyter_text>You.com RetrieverThis notebook walks you through how to setup a Retriever that can fetch from You.com<jupyter_code>%pip install llama-index-retrievers-you from llama_index.retrievers.you import YouRetriever you_api_key = "" or os.environ["YOU_API_KEY"] retriever = YouRetriever(api_key=you_...
llama_index/docs/examples/retrievers/you_retriever.ipynb/0
{ "file_path": "llama_index/docs/examples/retrievers/you_retriever.ipynb", "repo_id": "llama_index", "token_count": 418 }
1,212
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/models/camembert/__init__.py/0
{ "file_path": "transformers/src/transformers/models/camembert/__init__.py", "repo_id": "transformers", "token_count": 1824 }
644
from llama_index.packs.rag_fusion_query_pipeline.base import RAGFusionPipelinePack __all__ = ["RAGFusionPipelinePack"]
llama_index/llama-index-packs/llama-index-packs-rag-fusion-query-pipeline/llama_index/packs/rag_fusion_query_pipeline/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-rag-fusion-query-pipeline/llama_index/packs/rag_fusion_query_pipeline/__init__.py", "repo_id": "llama_index", "token_count": 45 }
1,677
import React, { useCallback, useEffect, useMemo, useRef, useState, } from "react"; import { Group, Text, useMantineTheme, Alert, Table, Button, Title, Flex, Stack, Spoiler, Progress, Card, } from "@mantine/core"; import { IconAlertCircle } from "@tabler/icons-react"; import { Experimen...
auto-evaluator/nextjs/components/Demo.tsx/0
{ "file_path": "auto-evaluator/nextjs/components/Demo.tsx", "repo_id": "auto-evaluator", "token_count": 8245 }
1
# Datasets 🤝 Arrow ## What is Arrow? [Arrow](https://arrow.apache.org/) enables large amounts of data to be processed and moved quickly. It is a specific data format that stores data in a columnar memory layout. This provides several significant advantages: * Arrow's standard format allows [zero-copy reads](https:/...
datasets/docs/source/about_arrow.md/0
{ "file_path": "datasets/docs/source/about_arrow.md", "repo_id": "datasets", "token_count": 682 }
109
<jupyter_start><jupyter_text>Opensearch Vector StoreElasticsearch only supports Lucene indices, so only Opensearch is supported. **Note on setup**: We setup a local Opensearch instance through the following doc. https://opensearch.org/docs/1.0/If you run into SSL issues, try the following `docker run` command instead: ...
llama_index/docs/examples/vector_stores/OpensearchDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/OpensearchDemo.ipynb", "repo_id": "llama_index", "token_count": 3143 }
1,112
from typing import Any, List from langchain_core.callbacks import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever from langchain.retrievers.document_compressors.base import ( BaseDocu...
langchain/libs/langchain/langchain/retrievers/contextual_compression.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/contextual_compression.py", "repo_id": "langchain", "token_count": 970 }
565
"""Preprocess Reader.""" import hashlib import os from typing import List from llama_index.core.readers.base import BaseReader from llama_index.core.schema import ( Document, NodeRelationship, RelatedNodeInfo, TextNode, ) class PreprocessReader(BaseReader): def __init__(self, api_key: str, *args,...
llama_index/llama-index-integrations/readers/llama-index-readers-preprocess/llama_index/readers/preprocess/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-preprocess/llama_index/readers/preprocess/base.py", "repo_id": "llama_index", "token_count": 2980 }
1,405
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/indices/llama-index-indices-managed-colbert/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-colbert/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,269
from langchain_core.runnables.config import ( EmptyDict, RunnableConfig, acall_func_with_variable_args, call_func_with_variable_args, ensure_config, get_async_callback_manager_for_config, get_callback_manager_for_config, get_config_list, get_executor_for_config, merge_configs, ...
langchain/libs/langchain/langchain/schema/runnable/config.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/runnable/config.py", "repo_id": "langchain", "token_count": 288 }
549
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/models/blenderbot/__init__.py/0
{ "file_path": "transformers/src/transformers/models/blenderbot/__init__.py", "repo_id": "transformers", "token_count": 1632 }
640
<jupyter_start><jupyter_text>Controllable Agents for RAGAdding agentic capabilities on top of your RAG pipeline can allow you to reason over much more complex questions.But a big pain point for agents is the **lack of steerability/transparency**. An agent may tackle a user query through chain-of-thought/planning, which...
llama_index/docs/examples/agent/agent_runner/agent_runner_rag_controllable.ipynb/0
{ "file_path": "llama_index/docs/examples/agent/agent_runner/agent_runner_rag_controllable.ipynb", "repo_id": "llama_index", "token_count": 3963 }
1,041
import { MessageContent } from "../messages/index.js"; import type { InputValues } from "../utils/types.js"; /** * Type that specifies the format of a template. Only * "f-string" is supported currently. */ export type TemplateFormat = "f-string"; /** * Type that represents a node in a parsed format string. It can...
langchainjs/langchain-core/src/prompts/template.ts/0
{ "file_path": "langchainjs/langchain-core/src/prompts/template.ts", "repo_id": "langchainjs", "token_count": 1889 }
866