text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
import { LunaryHandler } from "@langchain/community/callbacks/handlers/lunary"; import { ChatOpenAI } from "@langchain/openai"; import { HumanMessage, SystemMessage } from "@langchain/core/messages"; import lunary from "lunary"; const chat = new ChatOpenAI({ modelName: "gpt-4", callbacks: [new LunaryHandler()], }...
langchainjs/examples/src/callbacks/lunary_custom_agent.ts/0
{ "file_path": "langchainjs/examples/src/callbacks/lunary_custom_agent.ts", "repo_id": "langchainjs", "token_count": 293 }
816
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is...
diffusers/src/diffusers/pipelines/pia/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/pia/__init__.py", "repo_id": "diffusers", "token_count": 515 }
251
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
accelerate/tests/test_metrics.py/0
{ "file_path": "accelerate/tests/test_metrics.py", "repo_id": "accelerate", "token_count": 750 }
16
"""ReAct agent. Simple wrapper around AgentRunner + ReActAgentWorker. For the legacy implementation see: ```python from llama_index.legacy.agent.legacy.react.base import ReActAgent ``` """ from typing import ( Any, List, Optional, Sequence, Type, ) from llama_index.legacy.agent.react.formatter ...
llama_index/llama-index-legacy/llama_index/legacy/agent/react/base.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/agent/react/base.py", "repo_id": "llama_index", "token_count": 1924 }
1,545
# order by contributions reviewers: - cydrain - bigsheeper - czs007 - godchen0212 - yhmo approvers: - maintainers
milvus/internal/rootcoord/OWNERS/0
{ "file_path": "milvus/internal/rootcoord/OWNERS", "repo_id": "milvus", "token_count": 51 }
1,999
<jupyter_start><jupyter_text>Mastodon>[Mastodon](https://joinmastodon.org/) is a federated social media and social networking service.This loader fetches the text from the "toots" of a list of `Mastodon` accounts, using the `Mastodon.py` Python package.Public accounts can the queried by default without any authenticati...
langchain/docs/docs/integrations/document_loaders/mastodon.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/mastodon.ipynb", "repo_id": "langchain", "token_count": 591 }
117
from .asymmetric_loss import AsymmetricLossMultiLabel, AsymmetricLossSingleLabel from .binary_cross_entropy import BinaryCrossEntropy from .cross_entropy import LabelSmoothingCrossEntropy, SoftTargetCrossEntropy from .jsd import JsdCrossEntropy
pytorch-image-models/timm/loss/__init__.py/0
{ "file_path": "pytorch-image-models/timm/loss/__init__.py", "repo_id": "pytorch-image-models", "token_count": 70 }
337
/* eslint-disable @typescript-eslint/no-explicit-any */ import { ActorCallOptions, ApifyClient, ApifyClientOptions, TaskCallOptions, } from "apify-client"; import { Document } from "@langchain/core/documents"; import { AsyncCaller, AsyncCallerParams, } from "@langchain/core/utils/async_caller"; import { g...
langchainjs/langchain/src/document_loaders/web/apify_dataset.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/web/apify_dataset.ts", "repo_id": "langchainjs", "token_count": 2054 }
883
import setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( name="fsner", version="0.0.1", author="msi sayef", author_email="msi.sayef@gmail.com", description="Few-shot Named Entity Recognition", long_description=long_description, ...
transformers/examples/research_projects/fsner/setup.py/0
{ "file_path": "transformers/examples/research_projects/fsner/setup.py", "repo_id": "transformers", "token_count": 341 }
535
import argparse import os import torch from PIL import Image, ImageFilter from transformers import CLIPTextModel from diffusers import DPMSolverMultistepScheduler, StableDiffusionInpaintPipeline, UNet2DConditionModel parser = argparse.ArgumentParser(description="Inference") parser.add_argument( "--model_path", ...
diffusers/examples/research_projects/realfill/infer.py/0
{ "file_path": "diffusers/examples/research_projects/realfill/infer.py", "repo_id": "diffusers", "token_count": 984 }
200
<jupyter_start><jupyter_text>Polygon IO ToolkitThis notebook shows how to use agents to interact with the [Polygon IO](https://polygon.io/) toolkit. The toolkit provides access to Polygon's Stock Market Data API. Example Use Setup<jupyter_code>%pip install --upgrade --quiet langchain-community > /dev/null<jupyter_outp...
langchain/docs/docs/integrations/toolkits/polygon.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/toolkits/polygon.ipynb", "repo_id": "langchain", "token_count": 637 }
179
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/pipelines/test_pipelines_audio_classification.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_audio_classification.py", "repo_id": "transformers", "token_count": 2077 }
760
// Import a few things we'll use to test the exports import { LLMChain } from "langchain/chains"; import { ChatOpenAI } from "langchain/chat_models/openai"; import { ChatPromptTemplate, HumanMessagePromptTemplate, } from "langchain/prompts"; import { CallbackManager } from "langchain/callbacks"; export function se...
langchainjs/environment_tests/test-exports-vite/src/chain.ts/0
{ "file_path": "langchainjs/environment_tests/test-exports-vite/src/chain.ts", "repo_id": "langchainjs", "token_count": 426 }
775
Tree Retrievers ======================= .. automodule:: llama_index.core.indices.tree.all_leaf_retriever :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper .. automodule:: llama_index.core.indices.tree.select_leaf_retriever :members: :inherited-...
llama_index/docs/api_reference/query/retrievers/tree.rst/0
{ "file_path": "llama_index/docs/api_reference/query/retrievers/tree.rst", "repo_id": "llama_index", "token_count": 237 }
1,163
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "schema/document", newEntrypointName: "documents", newPackageName: "@langchain/core", }); export { BaseDocumentTransformer, MappingDocumentTransformer, } from...
langchainjs/langchain/src/schema/document.ts/0
{ "file_path": "langchainjs/langchain/src/schema/document.ts", "repo_id": "langchainjs", "token_count": 109 }
1,014
import { JsonSchema } from "@jsonforms/core"; type JsonSchemaExtra = JsonSchema & { extra: { widget: { type: string; [key: string]: string | number | Array<string | number>; }; }; }; export function isJsonSchemaExtra(x: JsonSchema): x is JsonSchemaExtra { if (!("extra" in x && typeof x.extra...
langserve/langserve/playground/src/utils/schema.ts/0
{ "file_path": "langserve/langserve/playground/src/utils/schema.ts", "repo_id": "langserve", "token_count": 228 }
1,004
from langchain_core.prompts.chat import ChatPromptTemplate, MessagesPlaceholder from langchain_core.prompts.pipeline import PipelinePromptTemplate from langchain_core.prompts.prompt import PromptTemplate def test_get_input_variables() -> None: prompt_a = PromptTemplate.from_template("{foo}") prompt_b = Prompt...
langchain/libs/core/tests/unit_tests/prompts/test_pipeline_prompt.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/prompts/test_pipeline_prompt.py", "repo_id": "langchain", "token_count": 655 }
409
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-mondaydotcom/llama_index/readers/mondaydotcom/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mondaydotcom/llama_index/readers/mondaydotcom/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,488
from __future__ import annotations import logging import os import pathlib import platform from typing import Optional, Tuple from langchain_core.env import get_runtime_environment from langchain_core.pydantic_v1 import BaseModel from langchain_community.document_loaders.base import BaseLoader logger = logging.getL...
langchain/libs/community/langchain_community/utilities/pebblo.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/pebblo.py", "repo_id": "langchain", "token_count": 2719 }
301
# Exa Search The Exa Search API provides a new search experience designed for LLMs. ## Usage First, install the LangChain integration package for Exa: import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <IntegrationInstallTooltip></IntegrationInstallTooltip> ```bash npm2yarn n...
langchainjs/docs/core_docs/docs/integrations/retrievers/exa.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/retrievers/exa.mdx", "repo_id": "langchainjs", "token_count": 191 }
766
<script lang="ts"> import { webSearchParameters } from "$lib/stores/webSearchParameters"; import CarbonInformation from "~icons/carbon/information"; import Switch from "./Switch.svelte"; const toggle = () => ($webSearchParameters.useSearch = !$webSearchParameters.useSearch); </script> <div class="flex h-8 cursor...
chat-ui/src/lib/components/WebSearchToggle.svelte/0
{ "file_path": "chat-ui/src/lib/components/WebSearchToggle.svelte", "repo_id": "chat-ui", "token_count": 447 }
98
import jax import jax.numpy as jnp from bigbird_flax import FlaxBigBirdForNaturalQuestions from datasets import load_from_disk from transformers import BigBirdTokenizerFast CATEGORY_MAPPING = {0: "null", 1: "short", 2: "long", 3: "yes", 4: "no"} PUNCTUATION_SET_TO_EXCLUDE = set("".join(["‘", "’", "´", "`", ".", ",",...
transformers/examples/research_projects/jax-projects/big_bird/evaluate.py/0
{ "file_path": "transformers/examples/research_projects/jax-projects/big_bird/evaluate.py", "repo_id": "transformers", "token_count": 2748 }
544
import json from typing import Dict, List, Type, Union from langchain_core.exceptions import OutputParserException from langchain_core.output_parsers import BaseOutputParser from langchain_core.outputs import ChatGeneration, Generation from langchain_core.pydantic_v1 import BaseModel from langchain_core.tools import B...
langchain/libs/partners/google-vertexai/langchain_google_vertexai/functions_utils.py/0
{ "file_path": "langchain/libs/partners/google-vertexai/langchain_google_vertexai/functions_utils.py", "repo_id": "langchain", "token_count": 2310 }
646
# OpenAI All functionality related to OpenAI > [OpenAI](https://en.wikipedia.org/wiki/OpenAI) is American artificial intelligence (AI) research laboratory > consisting of the non-profit `OpenAI Incorporated` > and its for-profit subsidiary corporation `OpenAI Limited Partnership`. > `OpenAI` conducts AI research with...
langchainjs/docs/core_docs/docs/integrations/platforms/openai.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/platforms/openai.mdx", "repo_id": "langchainjs", "token_count": 534 }
720
# Image classification Image classification datasets are used to train a model to classify an entire image. There are a wide variety of applications enabled by these datasets such as identifying endangered wildlife species or screening for disease in medical images. This guide will show you how to apply transformation...
datasets/docs/source/image_classification.mdx/0
{ "file_path": "datasets/docs/source/image_classification.mdx", "repo_id": "datasets", "token_count": 1043 }
117
import { prependNormalizer, stripAccentsNormalizer, stripNormalizer } from '../../' describe('stripNormalizer', () => { it('instantiates with no parameters', () => { const normalizer = stripNormalizer() expect(normalizer.constructor.name).toEqual('Normalizer') }) it('accepts `undefined` as first paramet...
tokenizers/bindings/node/lib/bindings/normalizers.test.ts/0
{ "file_path": "tokenizers/bindings/node/lib/bindings/normalizers.test.ts", "repo_id": "tokenizers", "token_count": 468 }
394
import pytest from langchain.evaluation.string_distance import ( PairwiseStringDistanceEvalChain, StringDistance, StringDistanceEvalChain, ) @pytest.mark.requires("rapidfuzz") @pytest.mark.parametrize("distance", list(StringDistance)) def test_zero_distance(distance: StringDistance) -> None: eval_cha...
langchain/libs/langchain/tests/unit_tests/evaluation/string_distance/test_base.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/evaluation/string_distance/test_base.py", "repo_id": "langchain", "token_count": 1428 }
657
import {IEmbeddingFunction} from "./IEmbeddingFunction"; let OpenAIApi: any; let openAiVersion = null; let openAiMajorVersion = null; interface OpenAIAPI { createEmbedding: (params: { model: string; input: string[]; user?: string; }) => Promise<number[][]>; } class OpenAIAPIv3 impleme...
chroma/clients/js/src/embeddings/OpenAIEmbeddingFunction.ts/0
{ "file_path": "chroma/clients/js/src/embeddings/OpenAIEmbeddingFunction.ts", "repo_id": "chroma", "token_count": 2091 }
29
import { SEARXNG_QUERY_URL } from "$env/static/private"; export async function searchSearxng(query: string) { const abortController = new AbortController(); setTimeout(() => abortController.abort(), 10000); // Insert the query into the URL template let url = SEARXNG_QUERY_URL.replace("<query>", query); // Check...
chat-ui/src/lib/server/websearch/searchSearxng.ts/0
{ "file_path": "chat-ui/src/lib/server/websearch/searchSearxng.ts", "repo_id": "chat-ui", "token_count": 362 }
100
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.multidoc_autoretrieval import MultiDocAutoRetrieverPack def test_class(): names_of_base_classes = [b.__name__ for b in MultiDocAutoRetrieverPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-multidoc-autoretrieval/tests/test_packs_multidoc_autoretrieval.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-multidoc-autoretrieval/tests/test_packs_multidoc_autoretrieval.py", "repo_id": "llama_index", "token_count": 107 }
1,801
docker_build('coordinator', context='.', dockerfile='./go/coordinator/Dockerfile' ) docker_build('server', context='.', dockerfile='./Dockerfile', ) docker_build('worker', context='.', dockerfile='./rust/worker/Dockerfile' ) k8s_yaml(['k8...
chroma/Tiltfile/0
{ "file_path": "chroma/Tiltfile", "repo_id": "chroma", "token_count": 497 }
10
from typing import List import pytest from llama_index.legacy.core.llms.types import ChatMessage, MessageRole try: import cohere except ImportError: cohere = None # type: ignore try: import langchain class LC: from llama_index.legacy.bridge.langchain import ( AIMessage, ...
llama_index/llama-index-legacy/tests/llms/test_langchain.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/llms/test_langchain.py", "repo_id": "llama_index", "token_count": 1382 }
1,537
# Troubleshooting This guide aims to provide you the tools and knowledge required to navigate some common issues. If the suggestions listed in this guide do not cover your such situation, please refer to the [Asking for Help](#asking-for-help) section to learn where to find help with your specific issue. ## Issues w...
datasets/docs/source/troubleshoot.mdx/0
{ "file_path": "datasets/docs/source/troubleshoot.mdx", "repo_id": "datasets", "token_count": 1470 }
115
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-zendesk/llama_index/readers/zendesk/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-zendesk/llama_index/readers/zendesk/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,402
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/main_classes/backbones.md/0
{ "file_path": "transformers/docs/source/en/main_classes/backbones.md", "repo_id": "transformers", "token_count": 689 }
447
import { test, expect } from "@jest/globals"; import { SystemMessage, HumanMessage } from "@langchain/core/messages"; import { ChatBaiduWenxin } from "../baiduwenxin.js"; interface TestConfig { modelName: string | undefined; config: { description?: string; temperature?: number; topP?: number; penal...
langchainjs/libs/langchain-community/src/chat_models/tests/chatbaiduwenxin.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/chat_models/tests/chatbaiduwenxin.int.test.ts", "repo_id": "langchainjs", "token_count": 1296 }
963
# coding=utf-8 # Copyright 2023 Microsoft Research and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
transformers/tests/models/kosmos2/test_modeling_kosmos2.py/0
{ "file_path": "transformers/tests/models/kosmos2/test_modeling_kosmos2.py", "repo_id": "transformers", "token_count": 15813 }
751
from langchain_community.tools.multion.close_session import ( CloseSessionSchema, MultionCloseSession, ) __all__ = ["CloseSessionSchema", "MultionCloseSession"]
langchain/libs/langchain/langchain/tools/multion/close_session.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/multion/close_session.py", "repo_id": "langchain", "token_count": 55 }
583
export { PlanAndExecuteAgentExecutor } from "./agent_executor.js"; export { BasePlanner, BaseStepContainer, BaseStepExecutor, type StepAction, type StepResult, type Step, type Plan, ListStepContainer, LLMPlanner, ChainStepExecutor, } from "./base.js"; export { PlanOutputParser } from "./outputParser...
langchainjs/langchain/src/experimental/plan_and_execute/index.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/plan_and_execute/index.ts", "repo_id": "langchainjs", "token_count": 109 }
886
from llama_index.core.readers.base import BaseReader from llama_index.readers.docugami import DocugamiReader def test_class(): names_of_base_classes = [b.__name__ for b in DocugamiReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-docugami/tests/test_readers_docugami.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-docugami/tests/test_readers_docugami.py", "repo_id": "llama_index", "token_count": 91 }
1,485
"""Integration test for Outline API Wrapper.""" from typing import List import pytest import responses from langchain_core.documents import Document from langchain_community.utilities import OutlineAPIWrapper OUTLINE_INSTANCE_TEST_URL = "https://app.getoutline.com" OUTLINE_SUCCESS_RESPONSE = { "data": [ ...
langchain/libs/community/tests/integration_tests/utilities/test_outline.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/utilities/test_outline.py", "repo_id": "langchain", "token_count": 1434 }
375
<jupyter_start><jupyter_text>Neo4j Graph Store<jupyter_code>%pip install llama-index-llms-openai %pip install llama-index-graph-stores-neo4j %pip install llama-index-embeddings-openai %pip install llama-index-llms-azure-openai # For OpenAI import os os.environ["OPENAI_API_KEY"] = "API_KEY_HERE" import logging import...
llama_index/docs/examples/index_structs/knowledge_graph/Neo4jKGIndexDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/index_structs/knowledge_graph/Neo4jKGIndexDemo.ipynb", "repo_id": "llama_index", "token_count": 2220 }
1,108
# LlamaIndex Llms Integration: Huggingface
llama_index/llama-index-integrations/llms/llama-index-llms-huggingface/README.md/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-huggingface/README.md", "repo_id": "llama_index", "token_count": 12 }
1,225
"""Database Reader.""" from typing import Any, List, Optional from sqlalchemy import text from sqlalchemy.engine import Engine from llama_index.legacy.readers.base import BaseReader from llama_index.legacy.schema import Document from llama_index.legacy.utilities.sql_wrapper import SQLDatabase class DatabaseReader(...
llama_index/llama-index-legacy/llama_index/legacy/readers/database.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/database.py", "repo_id": "llama_index", "token_count": 1426 }
1,702
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, IterableDatasetDict, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.info import DatasetInfo from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get...
datasets/tests/io/test_parquet.py/0
{ "file_path": "datasets/tests/io/test_parquet.py", "repo_id": "datasets", "token_count": 3621 }
164
#ifndef _matrix_view_cuh #define _matrix_view_cuh #include <cuda_runtime.h> #include <cuda_fp16.h> #include "quant/qdq_util.cuh" class MatrixView_half { public: const half* data; const int height; const int width; __device__ __forceinline__ MatrixView_half(const half* data, const int height, const i...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/matrix_view.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/matrix_view.cuh", "repo_id": "text-generation-inference", "token_count": 1861 }
416
import { ChatOpenAI } from "@langchain/openai"; import { ChatPromptTemplate } from "@langchain/core/prompts"; import { StringOutputParser } from "@langchain/core/output_parsers"; const prompt = ChatPromptTemplate.fromMessages([ ["human", "Tell me a short joke about {topic}"], ]); const model = new ChatOpenAI({}); co...
langchainjs/examples/src/guides/expression_language/get_started/basic.ts/0
{ "file_path": "langchainjs/examples/src/guides/expression_language/get_started/basic.ts", "repo_id": "langchainjs", "token_count": 179 }
779
<jupyter_start><jupyter_text>EmbedchainEmbedchain is a RAG framework to create data pipelines. It loads, indexes, retrieves and syncs all the data.It is available as an [open source package](https://github.com/embedchain/embedchain) and as a [hosted platform solution](https://app.embedchain.ai/).This notebook shows how...
langchain/docs/docs/integrations/retrievers/embedchain.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/embedchain.ipynb", "repo_id": "langchain", "token_count": 701 }
153
from langchain_core.exceptions import OutputParserException from langchain_core.output_parsers import ( BaseCumulativeTransformOutputParser, BaseGenerationOutputParser, BaseLLMOutputParser, BaseOutputParser, BaseTransformOutputParser, StrOutputParser, ) from langchain_core.output_parsers.base im...
langchain/libs/langchain/langchain/schema/output_parser.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/output_parser.py", "repo_id": "langchain", "token_count": 216 }
539
import { loadEvaluator } from "langchain/evaluation"; const customCriterion = { numeric: "Does the output contain numeric or mathematical information?", }; const evaluator = await loadEvaluator("criteria", { criteria: customCriterion, }); const query = "Tell me a joke"; const prediction = "I ate some square pie ...
langchainjs/examples/src/guides/evaluation/string/custom_criteria.ts/0
{ "file_path": "langchainjs/examples/src/guides/evaluation/string/custom_criteria.ts", "repo_id": "langchainjs", "token_count": 569 }
818
import { Redis } from "ioredis"; import { BufferMemory } from "langchain/memory"; import { RedisChatMessageHistory } from "@langchain/community/stores/message/ioredis"; import { ChatOpenAI } from "@langchain/openai"; import { ConversationChain } from "langchain/chains"; // Uses ioredis to facilitate Sentinel Connectio...
langchainjs/examples/src/memory/redis-sentinel.ts/0
{ "file_path": "langchainjs/examples/src/memory/redis-sentinel.ts", "repo_id": "langchainjs", "token_count": 404 }
860
from langchain_community.document_loaders.hugging_face_dataset import ( HuggingFaceDatasetLoader, ) __all__ = ["HuggingFaceDatasetLoader"]
langchain/libs/langchain/langchain/document_loaders/hugging_face_dataset.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/hugging_face_dataset.py", "repo_id": "langchain", "token_count": 52 }
516
package kafka import ( "context" "fmt" "math/rand" "testing" "time" "github.com/cockroachdb/errors" "github.com/confluentinc/confluent-kafka-go/kafka" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus/pkg/mq/msgstream/mqwrapper" ) func TestKafkaProducer_SendSuccess(t *testing.T) { kafkaAdd...
milvus/pkg/mq/msgstream/mqwrapper/kafka/kafka_producer_test.go/0
{ "file_path": "milvus/pkg/mq/msgstream/mqwrapper/kafka/kafka_producer_test.go", "repo_id": "milvus", "token_count": 1018 }
1,899
from langchain.chains.ernie_functions.base import ( convert_to_ernie_function, create_ernie_fn_chain, create_ernie_fn_runnable, create_structured_output_chain, create_structured_output_runnable, get_ernie_output_parser, ) __all__ = [ "convert_to_ernie_function", "create_structured_outpu...
langchain/libs/langchain/langchain/chains/ernie_functions/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/ernie_functions/__init__.py", "repo_id": "langchain", "token_count": 198 }
482
from langchain_community.document_loaders.quip import QuipLoader __all__ = ["QuipLoader"]
langchain/libs/langchain/langchain/document_loaders/quip.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/quip.py", "repo_id": "langchain", "token_count": 29 }
523
from llama_index.readers.github.collaborators.base import ( GitHubRepositoryCollaboratorsReader, ) from llama_index.readers.github.issues.base import ( GitHubIssuesClient, GitHubRepositoryIssuesReader, ) from llama_index.readers.github.repository.base import ( GithubClient, GithubRepositoryReader, )...
llama_index/llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/__init__.py", "repo_id": "llama_index", "token_count": 179 }
1,498
python_tests( name="tests", )
llama_index/llama-index-core/tests/callbacks/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/callbacks/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,307
# 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_logits_process.py/0
{ "file_path": "transformers/tests/generation/test_logits_process.py", "repo_id": "transformers", "token_count": 16668 }
700
accuracy: collections: - server: db_config.primary_path: /test/milvus/db_data_gpu/sift_1b_2048_128_l2_sq8 cache_config.cpu_cache_capacity: 150 engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: true gpu_res...
milvus/tests/benchmark/milvus_benchmark/suites/gpu_accuracy_sift1b.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/gpu_accuracy_sift1b.yaml", "repo_id": "milvus", "token_count": 1049 }
1,953
from __future__ import annotations from typing import TYPE_CHECKING, Iterator, List, Optional from langchain_core.utils import get_from_env if TYPE_CHECKING: from odps import ODPS class MaxComputeAPIWrapper: """Interface for querying Alibaba Cloud MaxCompute tables.""" def __init__(self, client: ODPS)...
langchain/libs/community/langchain_community/utilities/max_compute.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/max_compute.py", "repo_id": "langchain", "token_count": 1180 }
301
import os import cassio import langchain from langchain.cache import CassandraCache from langchain.schema import BaseMessage from langchain_community.chat_models import ChatOpenAI from langchain_core.prompts import ChatPromptTemplate from langchain_core.runnables import RunnableLambda use_cassandra = int(os.environ.g...
langchain/templates/cassandra-synonym-caching/cassandra_synonym_caching/__init__.py/0
{ "file_path": "langchain/templates/cassandra-synonym-caching/cassandra_synonym_caching/__init__.py", "repo_id": "langchain", "token_count": 443 }
685
# coding=utf-8 # Copyright 2020 Microsoft and 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...
transformers/src/transformers/models/deberta_v2/tokenization_deberta_v2_fast.py/0
{ "file_path": "transformers/src/transformers/models/deberta_v2/tokenization_deberta_v2_fast.py", "repo_id": "transformers", "token_count": 4688 }
655
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "vectorstores/tigris", }); export * from "@langchain/community/vectorstores/tigris";
langchainjs/langchain/src/vectorstores/tigris.ts/0
{ "file_path": "langchainjs/langchain/src/vectorstores/tigris.ts", "repo_id": "langchainjs", "token_count": 74 }
1,034
"""spark toolkit"""
langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/spark/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/spark/__init__.py", "repo_id": "langchain", "token_count": 7 }
412
// 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/pkg/config/config_test.go/0
{ "file_path": "milvus/pkg/config/config_test.go", "repo_id": "milvus", "token_count": 1603 }
2,085
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ const OFF = 0; const WARNING = 1; const ERROR = 2; module.exports = { root: true, env: { browser: true, ...
langchainjs/docs/core_docs/.eslintrc.js/0
{ "file_path": "langchainjs/docs/core_docs/.eslintrc.js", "repo_id": "langchainjs", "token_count": 469 }
692
// 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/datacoord/services.go/0
{ "file_path": "milvus/internal/datacoord/services.go", "repo_id": "milvus", "token_count": 22575 }
1,916
from langchain_community.chat_models import __all__ EXPECTED_ALL = [ "ChatOpenAI", "BedrockChat", "AzureChatOpenAI", "FakeListChatModel", "PromptLayerChatOpenAI", "ChatEverlyAI", "ChatAnthropic", "ChatCohere", "ChatDatabricks", "ChatDeepInfra", "ChatGooglePalm", "ChatHug...
langchain/libs/community/tests/unit_tests/chat_models/test_imports.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/chat_models/test_imports.py", "repo_id": "langchain", "token_count": 466 }
400
<!--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 applicable law or agreed...
transformers/docs/source/en/model_doc/encoder-decoder.md/0
{ "file_path": "transformers/docs/source/en/model_doc/encoder-decoder.md", "repo_id": "transformers", "token_count": 2640 }
461
# Minimal makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build SOURCEDIR = source BUILDDIR = _build # Put it first so that "make" without argument is like "make help". help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" ...
accelerate/docs/Makefile/0
{ "file_path": "accelerate/docs/Makefile", "repo_id": "accelerate", "token_count": 237 }
0
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/rootcoord/quota_center_test.go/0
{ "file_path": "milvus/internal/rootcoord/quota_center_test.go", "repo_id": "milvus", "token_count": 12253 }
1,855
from __future__ import annotations import re from abc import abstractmethod from typing import Any, Dict, List, Optional, Sequence, Tuple import numpy as np from langchain_community.llms.openai import OpenAI from langchain_core.callbacks import ( CallbackManagerForChainRun, ) from langchain_core.language_models i...
langchain/libs/langchain/langchain/chains/flare/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/flare/base.py", "repo_id": "langchain", "token_count": 3925 }
457
"""Question-answering with sources over a vector database.""" import warnings from typing import Any, Dict, List from langchain_core.callbacks import ( AsyncCallbackManagerForChainRun, CallbackManagerForChainRun, ) from langchain_core.documents import Document from langchain_core.pydantic_v1 import Field, roo...
langchain/libs/langchain/langchain/chains/qa_with_sources/vector_db.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/qa_with_sources/vector_db.py", "repo_id": "langchain", "token_count": 1085 }
464
import torch from exllama_kernels import make_q4, q4_matmul, prepare_buffers, set_tuning_params # Dummy tensor to pass instead of g_idx since there is no way to pass "None" to a C++ extension none_tensor = torch.empty((1, 1), device="meta") def ext_make_q4(qweight, qzeros, scales, g_idx, device): """Construct Q4...
text-generation-inference/server/text_generation_server/utils/gptq/exllama.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/gptq/exllama.py", "repo_id": "text-generation-inference", "token_count": 1833 }
420
from typing import Callable, Optional from unittest import mock import pytest from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.llm_predictor.vellum import ( VellumPredictor, VellumPromptRegistry, ) from llama_index.legacy.prompts.base import PromptTemplate @pytest.fixture() de...
llama_index/llama-index-legacy/tests/llm_predictor/vellum/conftest.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/llm_predictor/vellum/conftest.py", "repo_id": "llama_index", "token_count": 1818 }
1,557
import { type LLMResult } from "langchain/schema"; import { ChatOpenAI } from "@langchain/openai"; import { HumanMessage } from "@langchain/core/messages"; import { Serialized } from "@langchain/core/load/serializable"; // We can pass in a list of CallbackHandlers to the LLM constructor to get callbacks for various ev...
langchainjs/examples/src/models/chat/chat_debugging.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/chat_debugging.ts", "repo_id": "langchainjs", "token_count": 528 }
842
from langchain_core.agents import AgentAction from langchain.agents.format_scratchpad.log import format_log_to_str def test_single_agent_action_observation() -> None: intermediate_steps = [ (AgentAction(tool="Tool1", tool_input="input1", log="Log1"), "Observation1") ] expected_result = "Log1\nObs...
langchain/libs/langchain/tests/unit_tests/agents/format_scratchpad/test_log.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/agents/format_scratchpad/test_log.py", "repo_id": "langchain", "token_count": 568 }
598
from langchain_community.agent_toolkits.json.toolkit import JsonToolkit __all__ = ["JsonToolkit"]
langchain/libs/langchain/langchain/agents/agent_toolkits/json/toolkit.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/json/toolkit.py", "repo_id": "langchain", "token_count": 34 }
459
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/agent/llama-index-agent-openai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/agent/llama-index-agent-openai/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,241
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-upstash/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-upstash/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,630
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
accelerate/tests/xla_spawn.py/0
{ "file_path": "accelerate/tests/xla_spawn.py", "repo_id": "accelerate", "token_count": 917 }
19
from typing import List import pytest from langchain_core.documents import Document from langchain_community.document_loaders.arxiv import ArxivLoader def assert_docs(docs: List[Document]) -> None: for doc in docs: assert doc.page_content assert doc.metadata assert set(doc.metadata) == {...
langchain/libs/community/tests/integration_tests/document_loaders/test_arxiv.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_arxiv.py", "repo_id": "langchain", "token_count": 909 }
346
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-elasticsearch/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-elasticsearch/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,226
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-litellm/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-litellm/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,263
/** * Prompts for comparing the outputs of two models for a given question. * * This prompt is used to compare two responses and evaluate which one best follows the instructions * and answers the question. The prompt is based on the paper from * Zheng, et. al. https://arxiv.org/abs/2306.05685 */ import { PromptT...
langchainjs/langchain/src/evaluation/comparison/prompt.ts/0
{ "file_path": "langchainjs/langchain/src/evaluation/comparison/prompt.ts", "repo_id": "langchainjs", "token_count": 668 }
890
import numpy as np def approximate_mode(class_counts, n_draws, rng): """Computes approximate mode of multivariate hypergeometric. This is an approximation to the mode of the multivariate hypergeometric given by class_counts and n_draws. It shouldn't be off by more than one. It is the mostly likely...
datasets/src/datasets/utils/stratify.py/0
{ "file_path": "datasets/src/datasets/utils/stratify.py", "repo_id": "datasets", "token_count": 1674 }
160
<jupyter_start><jupyter_text>College Confidential>[College Confidential](https://www.collegeconfidential.com/) gives information on 3,800+ colleges and universities.This covers how to load `College Confidential` webpages into a document format that we can use downstream.<jupyter_code>from langchain_community.document_l...
langchain/docs/docs/integrations/document_loaders/college_confidential.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/college_confidential.ipynb", "repo_id": "langchain", "token_count": 143 }
107
from typing import Any, List, Optional, Type, cast import pandas as pd from llama_index.core.bridge.pydantic import BaseModel, Field from llama_index.core.program.llm_prompt_program import BaseLLMFunctionProgram from llama_index.core.types import BasePydanticProgram from llama_index.program.openai import OpenAIPydanti...
llama_index/llama-index-integrations/program/llama-index-program-evaporate/llama_index/program/evaporate/df.py/0
{ "file_path": "llama_index/llama-index-integrations/program/llama-index-program-evaporate/llama_index/program/evaporate/df.py", "repo_id": "llama_index", "token_count": 3137 }
1,329
"""Retriever that generates and executes structured queries over its own data source.""" import logging from typing import Any, Dict, List, Optional, Sequence, Tuple, Type, Union from langchain_community.vectorstores import ( AstraDB, Chroma, DashVector, DeepLake, ElasticsearchStore, Milvus, ...
langchain/libs/langchain/langchain/retrievers/self_query/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/self_query/base.py", "repo_id": "langchain", "token_count": 3733 }
537
// 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/importutil/collection_info.go/0
{ "file_path": "milvus/internal/util/importutil/collection_info.go", "repo_id": "milvus", "token_count": 1193 }
1,879
from langchain_community.llms.manifest import ManifestWrapper __all__ = ["ManifestWrapper"]
langchain/libs/langchain/langchain/llms/manifest.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/manifest.py", "repo_id": "langchain", "token_count": 28 }
517
import os from typing import AsyncIterable, Iterable import pytest from langchain_community.chat_message_histories.astradb import ( AstraDBChatMessageHistory, ) from langchain_community.utilities.astradb import SetupMode from langchain_core.messages import AIMessage, HumanMessage from langchain.memory import Conv...
langchain/libs/langchain/tests/integration_tests/memory/test_astradb.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/memory/test_astradb.py", "repo_id": "langchain", "token_count": 2508 }
591
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-graphql/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-graphql/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,569
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def get_jobs(workflow_run_id, token=None): """Extract jobs in a GitHub Actions workflow run""" headers = None if token is not None: headers = {"Accept": "...
transformers/utils/get_ci_error_statistics.py/0
{ "file_path": "transformers/utils/get_ci_error_statistics.py", "repo_id": "transformers", "token_count": 4815 }
869
from llama_index.packs.gradio_agent_chat.base import GradioAgentChatPack __all__ = ["GradioAgentChatPack"]
llama_index/llama-index-packs/llama-index-packs-gradio-agent-chat/llama_index/packs/gradio_agent_chat/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-gradio-agent-chat/llama_index/packs/gradio_agent_chat/__init__.py", "repo_id": "llama_index", "token_count": 36 }
1,655
# MEP: Default Value Current state: Under Discussion ISSUE: [[Feature]: Support Default Value #23337](https://github.com/milvus-io/milvus/issues/23337) Keywords: Default, Insert, Upsert Released: v2.3.1 ## Summary Support Default Value when input data. ## Motivation For now, Milvus don't support Default functi...
milvus/docs/design_docs/20230405-default_value.md/0
{ "file_path": "milvus/docs/design_docs/20230405-default_value.md", "repo_id": "milvus", "token_count": 1118 }
1,907
# compound experiments: gpt2xl + grad_accu python benchmark/benchmark.py \ --command "python examples/scripts/ppo.py --exp_name ppo_gpt2xl_grad_accu --model_name gpt2-xl --mini_batch_size 16 --gradient_accumulation_steps 8 --log_with wandb" \ --num-seeds 3 \ --start-seed 1 \ --workers 10 \ --slurm-n...
trl/benchmark/benchmark_level2.sh/0
{ "file_path": "trl/benchmark/benchmark_level2.sh", "repo_id": "trl", "token_count": 479 }
814
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-azstorage-blob/llama_index/readers/azstorage_blob/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-azstorage-blob/llama_index/readers/azstorage_blob/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,341
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/xlm/convert_xlm_original_pytorch_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/xlm/convert_xlm_original_pytorch_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 1106 }
679
<!--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...
accelerate/docs/source/concept_guides/big_model_inference.md/0
{ "file_path": "accelerate/docs/source/concept_guides/big_model_inference.md", "repo_id": "accelerate", "token_count": 4832 }
1