text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from langchain_core.globals import get_debug, set_debug def test_debug_is_settable_via_setter() -> None: from langchain_core import globals from langchain_core.callbacks.manager import _get_debug previous_value = globals._debug previous_fn_reading = _get_debug() assert previous_value == previous_...
langchain/libs/core/tests/unit_tests/test_globals.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/test_globals.py", "repo_id": "langchain", "token_count": 375 }
411
import { test } from "@jest/globals"; import { OpenAI } from "@langchain/openai"; import { Document } from "@langchain/core/documents"; import { loadQAMapReduceChain, loadQARefineChain, loadQAStuffChain, } from "../load.js"; test("Test loadQAStuffChain", async () => { const model = new OpenAI({ modelName: "gpt...
langchainjs/langchain/src/chains/question_answering/tests/load.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/chains/question_answering/tests/load.int.test.ts", "repo_id": "langchainjs", "token_count": 532 }
865
# order by contributions reviewers: - sunby - congqixia - cydrain approvers: - maintainers
milvus/internal/datacoord/OWNERS/0
{ "file_path": "milvus/internal/datacoord/OWNERS", "repo_id": "milvus", "token_count": 39 }
1,908
from typing import Generator, List import pytest from llama_index.legacy.schema import BaseNode, Document, TextNode from llama_index.legacy.storage.docstore.dynamodb_docstore import ( DynamoDBDocumentStore, ) from llama_index.legacy.storage.kvstore.dynamodb_kvstore import DynamoDBKVStore from pytest import MonkeyP...
llama_index/llama-index-legacy/tests/storage/docstore/test_dynamodb_docstore.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/storage/docstore/test_dynamodb_docstore.py", "repo_id": "llama_index", "token_count": 1491 }
1,679
1 00:00:17,580 --> 00:00:21,920 <i>Corruption discovered at the core of the Banking Clan!</i> 2 00:00:21,950 --> 00:00:24,620 <i>Reunited, Rush Clovis and Senator Amidala</i> 3 00:00:24,660 --> 00:00:27,830 <i>discover the full extent of the deception.</i> 4 00:00:27,870 --> 00:00:30,960 <i>Anakin Skywalker is sent...
langchainjs/langchain/src/document_loaders/tests/example_data/Star_Wars_The_Clone_Wars_S06E07_Crisis_at_the_Heart.srt/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/example_data/Star_Wars_The_Clone_Wars_S06E07_Crisis_at_the_Heart.srt", "repo_id": "langchainjs", "token_count": 8877 }
905
"""Test AzureML Chat Endpoint wrapper.""" from langchain_core.messages import AIMessage, BaseMessage, HumanMessage from langchain_core.outputs import ChatGeneration, LLMResult from langchain_community.chat_models.azureml_endpoint import ( AzureMLChatOnlineEndpoint, LlamaChatContentFormatter, ) def test_llam...
langchain/libs/community/tests/integration_tests/chat_models/test_azureml_endpoint.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_models/test_azureml_endpoint.py", "repo_id": "langchain", "token_count": 678 }
342
from llama_index.readers.database.base import DatabaseReader __all__ = ["DatabaseReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-database/llama_index/readers/database/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-database/llama_index/readers/database/__init__.py", "repo_id": "llama_index", "token_count": 26 }
1,390
export const CREATE_EVENT_PROMPT = ` Date format: YYYY-MM-DDThh:mm:ss+00:00 Based on this event description: "Joey birthday tomorrow at 7 pm", output a json of the following parameters: Today's datetime on UTC time 2023-05-02T10:00:00+00:00, it's Tuesday and timezone of the user is -5, take into account the timezone o...
langchainjs/libs/langchain-community/src/tools/google_calendar/prompts/create-event-prompt.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/google_calendar/prompts/create-event-prompt.ts", "repo_id": "langchainjs", "token_count": 693 }
971
"""Test the FileManagementToolkit.""" from tempfile import TemporaryDirectory import pytest from langchain_core.tools import BaseTool from langchain_community.agent_toolkits.file_management.toolkit import ( FileManagementToolkit, ) def test_file_toolkit_get_tools() -> None: """Test the get_tools method of ...
langchain/libs/community/tests/unit_tests/tools/file_management/test_toolkit.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/tools/file_management/test_toolkit.py", "repo_id": "langchain", "token_count": 652 }
413
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/clap/test_modeling_clap.py/0
{ "file_path": "transformers/tests/models/clap/test_modeling_clap.py", "repo_id": "transformers", "token_count": 13255 }
752
"""Arxiv API toolkit."""
langchain/libs/langchain/langchain/tools/arxiv/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/arxiv/__init__.py", "repo_id": "langchain", "token_count": 10 }
554
# Scripts to Train and Evaluate Chat Models ## Fine-tuning In the handbook, we provide three main ways to align LLMs for chat: - Full fine-tuning on a multi-GPU machine with DeepSpeed ZeRO-3 (tested on an 8 x A100 (80GB) node). - LoRA or QLoRA fine-tuning on a single consumer 24GB GPU (tested on an RTX 4090). - LoR...
alignment-handbook/scripts/README.md/0
{ "file_path": "alignment-handbook/scripts/README.md", "repo_id": "alignment-handbook", "token_count": 2926 }
20
use candle::{DType, Device, IndexOp, Result, Tensor, D}; use candle_nn::{ embedding, linear_no_bias as linear, rms_norm, Embedding, Linear, Module, RmsNorm, VarBuilder, }; use std::collections::HashMap; use std::sync::{Arc, Mutex}; #[derive(Debug, Clone)] pub struct Config { pub dim: usize, // transform...
candle/candle-wasm-examples/llama2-c/src/model.rs/0
{ "file_path": "candle/candle-wasm-examples/llama2-c/src/model.rs", "repo_id": "candle", "token_count": 5272 }
82
"""Light weight unit test that attempts to import RedisStore. The actual code is tested in integration tests. This test is intended to catch errors in the import process. """ def test_import_storage() -> None: """Attempt to import storage modules.""" from langchain_community.storage.redis import RedisStore ...
langchain/libs/community/tests/unit_tests/storage/test_redis.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/storage/test_redis.py", "repo_id": "langchain", "token_count": 87 }
412
from langchain_community.vectorstores.pgvecto_rs import PGVecto_rs __all__ = ["PGVecto_rs"]
langchain/libs/langchain/langchain/vectorstores/pgvecto_rs.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/pgvecto_rs.py", "repo_id": "langchain", "token_count": 37 }
607
syntax = "proto3"; package milvus.proto.segcore; option go_package = "github.com/milvus-io/milvus/internal/proto/segcorepb"; import "schema.proto"; import "common.proto"; message RetrieveResults { schema.IDs ids = 1; repeated int64 offset = 2; repeated schema.FieldData fields_data = 3; } message LoadFieldMeta ...
milvus/internal/proto/segcore.proto/0
{ "file_path": "milvus/internal/proto/segcore.proto", "repo_id": "milvus", "token_count": 346 }
1,821
import { expect, test, describe } from "@jest/globals"; import { interpolateFString } from "../template.js"; describe.each([ ["{foo}", { foo: "bar" }, "bar"], ["pre{foo}post", { foo: "bar" }, "prebarpost"], ["{{pre{foo}post}}", { foo: "bar" }, "{prebarpost}"], ["text", {}, "text"], ["}}{{", {}, "}{"], ["{f...
langchainjs/langchain-core/src/prompts/tests/template.test.ts/0
{ "file_path": "langchainjs/langchain-core/src/prompts/tests/template.test.ts", "repo_id": "langchainjs", "token_count": 309 }
901
<jupyter_start><jupyter_text>Multi-Modal LLM using Replicate LlaVa, Fuyu 8B, MiniGPT4 models for image reasoningIn this notebook, we show how to use MultiModal LLM class for image understanding/reasoning.We now support:* [LLava-13B](https://github.com/haotian-liu/LLaVA)* [Fuyu-8B](https://www.adept.ai/blog/fuyu-8b)* [M...
llama_index/docs/examples/multi_modal/replicate_multi_modal.ipynb/0
{ "file_path": "llama_index/docs/examples/multi_modal/replicate_multi_modal.ipynb", "repo_id": "llama_index", "token_count": 16976 }
1,151
from typing import TYPE_CHECKING import pytest from langchain_core.messages import AIMessage, HumanMessage, SystemMessage from pytest_mock import MockerFixture from langchain_community.chat_message_histories import ZepChatMessageHistory if TYPE_CHECKING: from zep_python import ZepClient @pytest.fixture @pytest...
langchain/libs/community/tests/integration_tests/chat_message_histories/test_zep.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_message_histories/test_zep.py", "repo_id": "langchain", "token_count": 1102 }
323
# MangoppsGuides Loader This loader fetches the text from Mangopps Guides. ## Usage To use this loader, you need to pass base url of the MangoppsGuides installation (e.g. `https://guides.mangoapps.com/`) and the limit , i.e. max number of links it should crawl ```python from llama_index import download_loader Mang...
llama_index/llama-index-integrations/readers/llama-index-readers-mangoapps-guides/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mangoapps-guides/README.md", "repo_id": "llama_index", "token_count": 271 }
1,395
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/proxy/accesslog/writer_test.go/0
{ "file_path": "milvus/internal/proxy/accesslog/writer_test.go", "repo_id": "milvus", "token_count": 2458 }
1,842
import { PromptTemplate } from "@langchain/core/prompts"; import { LLMChain, LLMChainInput } from "../../chains/llm_chain.js"; /** Chain to generate tasks. */ export class TaskCreationChain extends LLMChain { static lc_name() { return "TaskCreationChain"; } /** * Creates a new TaskCreationChain instance....
langchainjs/langchain/src/experimental/babyagi/task_creation.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/babyagi/task_creation.ts", "repo_id": "langchainjs", "token_count": 555 }
957
from langchain_core.output_parsers import __all__ EXPECTED_ALL = [ "BaseLLMOutputParser", "BaseGenerationOutputParser", "BaseOutputParser", "ListOutputParser", "CommaSeparatedListOutputParser", "NumberedListOutputParser", "MarkdownListOutputParser", "StrOutputParser", "BaseTransform...
langchain/libs/core/tests/unit_tests/output_parsers/test_imports.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/output_parsers/test_imports.py", "repo_id": "langchain", "token_count": 199 }
427
import sys import types from typing import Any, Mapping from unittest import mock import pytest from llama_index.legacy.llms.base import CompletionResponse from llama_index.legacy.llms.gemini import Gemini class FakeGoogleDataclass(types.SimpleNamespace): """Emulate the dataclasses used in the genai package.""" ...
llama_index/llama-index-legacy/tests/llms/test_gemini.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/llms/test_gemini.py", "repo_id": "llama_index", "token_count": 1159 }
1,640
"""Test OpenAI Chat API wrapper.""" import json from typing import Any from unittest.mock import MagicMock, patch import pytest from langchain_core.messages import ( AIMessage, FunctionMessage, HumanMessage, SystemMessage, ) from langchain_openai import ChatOpenAI from langchain_openai.chat_models.bas...
langchain/libs/partners/openai/tests/unit_tests/chat_models/test_base.py/0
{ "file_path": "langchain/libs/partners/openai/tests/unit_tests/chat_models/test_base.py", "repo_id": "langchain", "token_count": 1513 }
695
reviewers: - congqixia - jiaoew1991 - sunby - weiliu1031 - yah01 approvers: - maintainers
milvus/internal/querycoordv2/params/OWNERS/0
{ "file_path": "milvus/internal/querycoordv2/params/OWNERS", "repo_id": "milvus", "token_count": 48 }
2,035
[ { "server": "apollo", "suite_params": [ { "suite": "011_cpu_accuracy_ann.yaml", "image_type": "cpu" } ] } ]
milvus/tests/benchmark/milvus_benchmark/scheduler/011_data_acc_debug.json/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/scheduler/011_data_acc_debug.json", "repo_id": "milvus", "token_count": 133 }
2,081
from langchain_community.tools.gmail.get_message import ( GmailGetMessage, SearchArgsSchema, ) __all__ = ["SearchArgsSchema", "GmailGetMessage"]
langchain/libs/langchain/langchain/tools/gmail/get_message.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/gmail/get_message.py", "repo_id": "langchain", "token_count": 53 }
601
// Copyright (C) 2019-2023 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/src/simd/common.h/0
{ "file_path": "milvus/internal/core/src/simd/common.h", "repo_id": "milvus", "token_count": 799 }
1,939
metrics: serviceMonitor: enabled: true kafka: metrics: kafka: enabled: true jmx: enabled: true serviceMonitor: enabled: true
milvus/tests/scripts/values/ci/nightly.yaml/0
{ "file_path": "milvus/tests/scripts/values/ci/nightly.yaml", "repo_id": "milvus", "token_count": 74 }
1,980
import datetime import json from typing import List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader def concatenate_rows(message: dict, title: str) -> str: """ Combine message information in a readable format ready to be used. Args: ...
langchain/libs/community/langchain_community/document_loaders/chatgpt.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/chatgpt.py", "repo_id": "langchain", "token_count": 914 }
252
import { test } from "@jest/globals"; import { ChatYandexGPT } from "../chat_models.js"; test("Test YandexGPT generation", async () => { const model = new ChatYandexGPT({}); const res = await model?.generate([ [["human", `Translate "I love programming" into Korean.`]], ]); expect(res).toBeTruthy(); });
langchainjs/libs/langchain-yandex/src/tests/chat_models.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-yandex/src/tests/chat_models.int.test.ts", "repo_id": "langchainjs", "token_count": 114 }
1,025
from __future__ import annotations from typing import Any, Dict, List, Optional from langchain_core.outputs import LLMResult from langchain.callbacks.streaming_aiter import AsyncIteratorCallbackHandler DEFAULT_ANSWER_PREFIX_TOKENS = ["Final", "Answer", ":"] class AsyncFinalIteratorCallbackHandler(AsyncIteratorCal...
langchain/libs/langchain/langchain/callbacks/streaming_aiter_final_only.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/streaming_aiter_final_only.py", "repo_id": "langchain", "token_count": 1501 }
458
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querynodev2/cluster/manager.go/0
{ "file_path": "milvus/internal/querynodev2/cluster/manager.go", "repo_id": "milvus", "token_count": 816 }
1,767
import re from typing import Union from langchain_core.agents import AgentAction, AgentFinish from langchain_core.exceptions import OutputParserException from langchain.agents.agent import AgentOutputParser from langchain.agents.conversational.prompt import FORMAT_INSTRUCTIONS class ConvoOutputParser(AgentOutputPar...
langchain/libs/langchain/langchain/agents/conversational/output_parser.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/conversational/output_parser.py", "repo_id": "langchain", "token_count": 516 }
485
import * as url from "node:url"; import * as path from "node:path"; import { test, expect } from "@jest/globals"; import { Document } from "@langchain/core/documents"; import { JSONLinesLoader } from "../fs/json.js"; test("Test JSON loader from file", async () => { const filePath = path.resolve( path.dirname(url...
langchainjs/langchain/src/document_loaders/tests/jsonl.test.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/jsonl.test.ts", "repo_id": "langchainjs", "token_count": 280 }
880
<jupyter_start><jupyter_text>Stream custom generator functionsYou can use generator functions (ie. functions that use the `yield` keyword, and behave like iterators) in a LCEL pipeline.The signature of these generators should be `Iterator[Input] -> Iterator[Output]`. Or for async generators: `AsyncIterator[Input] -> As...
langchain/docs/docs/expression_language/how_to/generators.ipynb/0
{ "file_path": "langchain/docs/docs/expression_language/how_to/generators.ipynb", "repo_id": "langchain", "token_count": 971 }
88
"""Wrapper around Elasticsearch vector database.""" from __future__ import annotations import uuid from typing import Any, Iterable, List from langchain_core.callbacks import CallbackManagerForRetrieverRun from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever class Elast...
langchain/libs/community/langchain_community/retrievers/elastic_search_bm25.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/elastic_search_bm25.py", "repo_id": "langchain", "token_count": 1953 }
290
<jupyter_start><jupyter_text>Pydantic parserThis output parser allows users to specify an arbitrary Pydantic Model and query LLMs for outputs that conform to that schema.Keep in mind that large language models are leaky abstractions! You'll have to use an LLM with sufficient capacity to generate well-formed JSON. In th...
langchain/docs/docs/modules/model_io/output_parsers/types/pydantic.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/output_parsers/types/pydantic.ipynb", "repo_id": "langchain", "token_count": 791 }
208
"""Trello reader.""" from typing import List from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class TrelloReader(BaseReader): """Trello reader. Reads data from Trello boards and cards. Args: api_key (str): Trello API key. api_token (str): Trel...
llama_index/llama-index-integrations/readers/llama-index-readers-trello/llama_index/readers/trello/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-trello/llama_index/readers/trello/base.py", "repo_id": "llama_index", "token_count": 684 }
1,560
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querycoordv2/meta/leader_view_manager.go/0
{ "file_path": "milvus/internal/querycoordv2/meta/leader_view_manager.go", "repo_id": "milvus", "token_count": 2583 }
1,831
import streamlit as st # A hack to "clear" the previous result when submitting a new prompt. This avoids # the "previous run's text is grayed-out but visible during rerun" Streamlit behavior. class DirtyState: NOT_DIRTY = "NOT_DIRTY" DIRTY = "DIRTY" UNHANDLED_SUBMIT = "UNHANDLED_SUBMIT" def get_dirty_st...
streamlit-agent/streamlit_agent/clear_results.py/0
{ "file_path": "streamlit-agent/streamlit_agent/clear_results.py", "repo_id": "streamlit-agent", "token_count": 379 }
2,026
# LangSmith in Pytest [![Open In GitHub](https://img.shields.io/badge/GitHub-View%20source-green.svg)](https://github.com/langchain-ai/langsmith-cookbook/tree/main/./testing-examples/pytest/README.md) This tutorial shows how to integrate LangSmith within your pytest test suite. You can test _a lot_ of functionality ...
langsmith-cookbook/testing-examples/pytest/README.md/0
{ "file_path": "langsmith-cookbook/testing-examples/pytest/README.md", "repo_id": "langsmith-cookbook", "token_count": 2743 }
1,073
#!/usr/bin/env python # coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. ...
transformers/examples/pytorch/text-classification/run_xnli.py/0
{ "file_path": "transformers/examples/pytorch/text-classification/run_xnli.py", "repo_id": "transformers", "token_count": 7663 }
527
<script lang="ts"> import CarbonEarth from "~icons/carbon/earth"; import CarbonArrowUpRight from "~icons/carbon/arrow-up-right"; import type { Model } from "$lib/types/Model"; export let model: Pick<Model, "name" | "datasetName" | "websiteUrl" | "modelUrl" | "datasetUrl">; export let variant: "light" | "dark" = ...
chat-ui/src/lib/components/ModelCardMetadata.svelte/0
{ "file_path": "chat-ui/src/lib/components/ModelCardMetadata.svelte", "repo_id": "chat-ui", "token_count": 623 }
93
def test_mock() -> None: assert True
langchain/libs/experimental/tests/unit_tests/test_mock.py/0
{ "file_path": "langchain/libs/experimental/tests/unit_tests/test_mock.py", "repo_id": "langchain", "token_count": 16 }
433
import * as fs from "fs"; const langchainPackageJson = JSON.parse(fs.readFileSync("../langchain/package.json")); const testPackageJson = JSON.parse(fs.readFileSync("./package.json")); testPackageJson.dependencies = { ...testPackageJson.dependencies, ...langchainPackageJson.dependencies }; fs.writeFileSync("./package...
langchainjs/environment_tests/test-exports-bun/scripts/combine-dependencies.js/0
{ "file_path": "langchainjs/environment_tests/test-exports-bun/scripts/combine-dependencies.js", "repo_id": "langchainjs", "token_count": 118 }
747
package indexnode import ( "context" "time" "github.com/golang/protobuf/proto" "go.uber.org/zap" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus/internal/proto/indexpb" "github.com/milvus-io/milvus/pkg/common" "github.com/milvus-io/milvus/pkg/log" ) func (i *IndexNode) lo...
milvus/internal/indexnode/taskinfo_ops.go/0
{ "file_path": "milvus/internal/indexnode/taskinfo_ops.go", "repo_id": "milvus", "token_count": 1736 }
1,991
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/utils/check_build.py/0
{ "file_path": "transformers/utils/check_build.py", "repo_id": "transformers", "token_count": 616 }
797
"""Test cohere embeddings.""" from langchain_community.embeddings.cohere import CohereEmbeddings def test_cohere_embedding_documents() -> None: """Test cohere embeddings.""" documents = ["foo bar"] embedding = CohereEmbeddings() output = embedding.embed_documents(documents) assert len(output) == 1...
langchain/libs/community/tests/integration_tests/embeddings/test_cohere.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/embeddings/test_cohere.py", "repo_id": "langchain", "token_count": 201 }
347
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "vectorstores/vercel_postgres", }); export * from "@langchain/community/vectorstores/vercel_postgres";
langchainjs/langchain/src/vectorstores/vercel_postgres.ts/0
{ "file_path": "langchainjs/langchain/src/vectorstores/vercel_postgres.ts", "repo_id": "langchainjs", "token_count": 78 }
967
// 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/distributed/rootcoord/client/client_test.go/0
{ "file_path": "milvus/internal/distributed/rootcoord/client/client_test.go", "repo_id": "milvus", "token_count": 4730 }
1,818
package tasks import ( "fmt" "sync" "go.uber.org/atomic" "go.uber.org/zap" "github.com/milvus-io/milvus/internal/querynodev2/collector" "github.com/milvus-io/milvus/pkg/log" "github.com/milvus-io/milvus/pkg/metrics" "github.com/milvus-io/milvus/pkg/util/conc" "github.com/milvus-io/milvus/pkg/util/lifetime" ...
milvus/internal/querynodev2/tasks/concurrent_safe_scheduler.go/0
{ "file_path": "milvus/internal/querynodev2/tasks/concurrent_safe_scheduler.go", "repo_id": "milvus", "token_count": 3195 }
1,773
# Simple Milvus systemd service file # # systemd supports lots of fancy features, look here (and linked docs) for a full list: # http://www.freedesktop.org/software/systemd/man/systemd.exec.html # # Note: this file ( /usr/lib/systemd/system/milvus-minio.service ) # will be overwritten on package upgrade, please copy ...
milvus/build/rpm/services/milvus-minio.service/0
{ "file_path": "milvus/build/rpm/services/milvus-minio.service", "repo_id": "milvus", "token_count": 283 }
1,749
from langchain_community.chat_models.anthropic import ( ChatAnthropic, convert_messages_to_prompt_anthropic, ) __all__ = [ "convert_messages_to_prompt_anthropic", "ChatAnthropic", ]
langchain/libs/langchain/langchain/chat_models/anthropic.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_models/anthropic.py", "repo_id": "langchain", "token_count": 81 }
472
mod common; use common::*; use tokenizers::decoders::byte_level::ByteLevel; use tokenizers::decoders::DecoderWrapper; use tokenizers::models::bpe::BPE; use tokenizers::models::wordlevel::WordLevel; use tokenizers::models::wordpiece::WordPiece; use tokenizers::models::ModelWrapper; use tokenizers::normalizers::bert::Be...
tokenizers/tokenizers/tests/serialization.rs/0
{ "file_path": "tokenizers/tokenizers/tests/serialization.rs", "repo_id": "tokenizers", "token_count": 3683 }
465
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-waii/llama_index/tools/waii/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-waii/llama_index/tools/waii/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,501
import math from types import MethodType from typing import Any, Dict, List, Optional, Tuple, Union from .state import PartialState from .utils import ( calculate_maximum_sizes, convert_bytes, copy_tensor_to_devices, ignorant_find_batch_size, infer_auto_device_map, is_pippy_available, pad_i...
accelerate/src/accelerate/inference.py/0
{ "file_path": "accelerate/src/accelerate/inference.py", "repo_id": "accelerate", "token_count": 2835 }
12
from llama_index.packs.resume_screener.base import ResumeScreenerPack __all__ = ["ResumeScreenerPack"]
llama_index/llama-index-packs/llama-index-packs-resume-screener/llama_index/packs/resume_screener/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-resume-screener/llama_index/packs/resume_screener/__init__.py", "repo_id": "llama_index", "token_count": 38 }
1,682
apiVersion: v1 kind: PersistentVolume metadata: name: huggingface-cluster-disk spec: storageClassName: "" capacity: storage: 500Gi accessModes: - ReadOnlyMany claimRef: namespace: default name: huggingface-cluster-disk-claim gcePersistentDisk: pdName: huggingface-cluster-disk fsType:...
transformers/docker/transformers-pytorch-tpu/dataset.yaml/0
{ "file_path": "transformers/docker/transformers-pytorch-tpu/dataset.yaml", "repo_id": "transformers", "token_count": 274 }
468
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/latent_diffusion/test_latent_diffusion_superresolution.py/0
{ "file_path": "diffusers/tests/pipelines/latent_diffusion/test_latent_diffusion_superresolution.py", "repo_id": "diffusers", "token_count": 2045 }
265
# 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 applicabl...
transformers/src/transformers/models/ernie/__init__.py/0
{ "file_path": "transformers/src/transformers/models/ernie/__init__.py", "repo_id": "transformers", "token_count": 927 }
683
from langchain_openai.embeddings import __all__ EXPECTED_ALL = ["OpenAIEmbeddings", "AzureOpenAIEmbeddings"] def test_all_imports() -> None: assert sorted(EXPECTED_ALL) == sorted(__all__)
langchain/libs/partners/openai/tests/unit_tests/embeddings/test_imports.py/0
{ "file_path": "langchain/libs/partners/openai/tests/unit_tests/embeddings/test_imports.py", "repo_id": "langchain", "token_count": 74 }
637
from langchain_community.chat_loaders.imessage import IMessageChatLoader __all__ = ["IMessageChatLoader"]
langchain/libs/langchain/langchain/chat_loaders/imessage.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_loaders/imessage.py", "repo_id": "langchain", "token_count": 31 }
477
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/proxy/rootcoord_mock_test.go/0
{ "file_path": "milvus/internal/proxy/rootcoord_mock_test.go", "repo_id": "milvus", "token_count": 16189 }
1,965
import logging from milvus_benchmark.env.base import BaseEnv logger = logging.getLogger("milvus_benchmark.env.local") class LocalEnv(BaseEnv): """docker env class wrapper""" """ The current method of using the deployed Kubernetes environment to call """ env_mode = "local" def __init__(self, deploy_m...
milvus/tests/benchmark/milvus_benchmark/env/local.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/env/local.py", "repo_id": "milvus", "token_count": 272 }
2,133
"""Example selector that selects examples based on SemanticSimilarity.""" from __future__ import annotations from typing import TYPE_CHECKING, Any, Dict, List, Optional, Type from langchain_core.example_selectors.base import BaseExampleSelector from langchain_core.pydantic_v1 import BaseModel, Extra from langchain_co...
langchain/libs/core/langchain_core/example_selectors/semantic_similarity.py/0
{ "file_path": "langchain/libs/core/langchain_core/example_selectors/semantic_similarity.py", "repo_id": "langchain", "token_count": 2964 }
415
import { PromptTemplate } from "@langchain/core/prompts"; import { StringOutputParser } from "@langchain/core/output_parsers"; import { RunnableSequence } from "@langchain/core/runnables"; import { ChatAnthropic } from "@langchain/anthropic"; const promptTemplate = PromptTemplate.fromTemplate(`Given the user questio...
langchainjs/examples/src/guides/expression_language/how_to_routing_custom_function.ts/0
{ "file_path": "langchainjs/examples/src/guides/expression_language/how_to_routing_custom_function.ts", "repo_id": "langchainjs", "token_count": 1534 }
778
Sub Question Query Engine ========================== .. automodule:: llama_index.core.query_engine.sub_question_query_engine :members: :inherited-members:
llama_index/docs/api_reference/query/query_engines/sub_question_query_engine.rst/0
{ "file_path": "llama_index/docs/api_reference/query/query_engines/sub_question_query_engine.rst", "repo_id": "llama_index", "token_count": 50 }
1,039
package paramtable import ( "testing" "github.com/stretchr/testify/assert" ) func TestHTTPConfig_Init(t *testing.T) { params := ComponentParam{} params.Init(NewBaseTable(SkipRemote(true))) cfg := &params.HTTPCfg assert.Equal(t, cfg.Enabled.GetAsBool(), true) assert.Equal(t, cfg.DebugMode.GetAsBool(), false) ...
milvus/pkg/util/paramtable/http_param_test.go/0
{ "file_path": "milvus/pkg/util/paramtable/http_param_test.go", "repo_id": "milvus", "token_count": 192 }
1,946
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-huggingface/llama_index/llms/huggingface/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-huggingface/llama_index/llms/huggingface/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,222
"""Module contains logic for parsing binary blobs into text.""" from langchain.document_loaders.parsers import BS4HTMLParser, PDFMinerParser from langchain.document_loaders.parsers.generic import MimeTypeBasedParser from langchain.document_loaders.parsers.msword import MsWordParser from langchain.document_loaders.parse...
opengpts/backend/app/parsing.py/0
{ "file_path": "opengpts/backend/app/parsing.py", "repo_id": "opengpts", "token_count": 273 }
1,919
# Motörhead >[Motörhead](https://github.com/getmetal/motorhead) is a memory server implemented in Rust. It automatically handles incremental summarization in the background and allows for stateless applications. ## Installation and Setup See instructions at [Motörhead](https://github.com/getmetal/motorhead) for runn...
langchain/docs/docs/integrations/providers/motorhead.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/motorhead.mdx", "repo_id": "langchain", "token_count": 128 }
142
# Metric Card for BERT Score ## Metric description BERTScore is an automatic evaluation metric for text generation that computes a similarity score for each token in the candidate sentence with each token in the reference sentence. It leverages the pre-trained contextual embeddings from [BERT](https://huggingface.co/...
datasets/metrics/bertscore/README.md/0
{ "file_path": "datasets/metrics/bertscore/README.md", "repo_id": "datasets", "token_count": 1908 }
136
from langchain_core.callbacks.manager import CallbackManager from langchain_core.callbacks.stdout import StdOutCallbackHandler from langchain_core.callbacks.streaming_stdout import StreamingStdOutCallbackHandler from langchain_core.runnables.config import RunnableConfig, merge_configs from langchain_core.tracers.stdout...
langchain/libs/core/tests/unit_tests/runnables/test_config.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/runnables/test_config.py", "repo_id": "langchain", "token_count": 469 }
430
"""Download tool from Llama Index. Deprecated.""" import json import os from typing import Optional, Type from deprecated import deprecated from llama_index.core.download.integration import download_integration from llama_index.core.tools.tool_spec.base import BaseToolSpec @deprecated( "`download_tool()` is de...
llama_index/llama-index-core/llama_index/core/tools/download.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/tools/download.py", "repo_id": "llama_index", "token_count": 731 }
1,252
<jupyter_start><jupyter_text>Clarifai>[Clarifai](https://www.clarifai.com/) is an AI Platform that provides the full AI lifecycle ranging from data exploration, data labeling, model training, evaluation, and inference.This example goes over how to use LangChain to interact with `Clarifai` [models](https://clarifai.com/...
langchain/docs/docs/integrations/llms/clarifai.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/clarifai.ipynb", "repo_id": "langchain", "token_count": 1301 }
125
""" Dataset Factory Hacked together by / Copyright 2021, Ross Wightman """ import os from typing import Optional from torchvision.datasets import CIFAR100, CIFAR10, MNIST, KMNIST, FashionMNIST, ImageFolder try: from torchvision.datasets import Places365 has_places365 = True except ImportError: has_places3...
pytorch-image-models/timm/data/dataset_factory.py/0
{ "file_path": "pytorch-image-models/timm/data/dataset_factory.py", "repo_id": "pytorch-image-models", "token_count": 3864 }
382
"""Module definitions of agent types together with corresponding agents.""" from enum import Enum from langchain_core._api import deprecated @deprecated( "0.1.0", alternative=( "Use new agent constructor methods like create_react_agent, create_json_agent, " "create_structured_chat_agent, etc....
langchain/libs/langchain/langchain/agents/agent_types.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_types.py", "repo_id": "langchain", "token_count": 647 }
471
<jupyter_start><jupyter_text>Ensemble RetrieverThe `EnsembleRetriever` takes a list of retrievers as input and ensemble the results of their `get_relevant_documents()` methods and rerank the results based on the [Reciprocal Rank Fusion](https://plg.uwaterloo.ca/~gvcormac/cormacksigir09-rrf.pdf) algorithm.By leveraging ...
langchain/docs/docs/modules/data_connection/retrievers/ensemble.ipynb/0
{ "file_path": "langchain/docs/docs/modules/data_connection/retrievers/ensemble.ipynb", "repo_id": "langchain", "token_count": 855 }
207
# Integrating with LangServe [LangServe](https://python.langchain.com/docs/langserve) is a Python framework that helps developers deploy LangChain [runnables and chains](/docs/expression_language/) as REST APIs. If you have a deployed LangServe route, you can use the [RemoteRunnable](https://api.js.langchain.com/clas...
langchainjs/docs/core_docs/docs/ecosystem/langserve.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/ecosystem/langserve.mdx", "repo_id": "langchainjs", "token_count": 442 }
693
from langchain_community.tools.github.tool import GitHubAction __all__ = ["GitHubAction"]
langchain/libs/langchain/langchain/tools/github/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/github/tool.py", "repo_id": "langchain", "token_count": 27 }
577
[build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" [tool.llamahub] classes = ["InferRetrieveRerankPack"] contains_example = false import_path = "llama_index.packs.infer...
llama_index/llama-index-packs/llama-index-packs-infer-retrieve-rerank/pyproject.toml/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-infer-retrieve-rerank/pyproject.toml", "repo_id": "llama_index", "token_count": 750 }
1,656
""" NasNet-A (Large) nasnetalarge implementation grabbed from Cadene's pretrained models https://github.com/Cadene/pretrained-models.pytorch """ from functools import partial import torch import torch.nn as nn import torch.nn.functional as F from timm.layers import ConvNormAct, create_conv2d, create_pool2d, create_...
pytorch-image-models/timm/models/nasnet.py/0
{ "file_path": "pytorch-image-models/timm/models/nasnet.py", "repo_id": "pytorch-image-models", "token_count": 13247 }
375
# LlamaIndex Embeddings Integration: Clarifai
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-clarifai/README.md/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-clarifai/README.md", "repo_id": "llama_index", "token_count": 13 }
1,222
<!--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/ko/perplexity.md/0
{ "file_path": "transformers/docs/source/ko/perplexity.md", "repo_id": "transformers", "token_count": 6263 }
543
import base64 import hashlib import hmac import json import logging import time from typing import Any, Dict, Iterator, List, Mapping, Optional, Type from urllib.parse import urlparse import requests from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.chat_models import ( ...
langchain/libs/community/langchain_community/chat_models/hunyuan.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/hunyuan.py", "repo_id": "langchain", "token_count": 4660 }
226
<!--⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer. --> # Soft prompts Training large pretrained language models is very time-consuming and compute-intensive. As they continue to grow in size, there is in...
peft/docs/source/conceptual_guides/prompting.md/0
{ "file_path": "peft/docs/source/conceptual_guides/prompting.md", "repo_id": "peft", "token_count": 1830 }
305
<script lang="ts"> export let classNames = ""; </script> <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" class={classNames} fill="none" viewBox="0 0 26 23" > <path fill="url(#a)" d="M.93 10.65A10.17 10.17 0 0 1 11.11.48h4.67a9.45 9.45 0 0 1 0 18.89H4.53L1.62 22.2a.38.38 0 0 1-.69-.28V10.65...
chat-ui/src/lib/components/icons/IconDazzled.svelte/0
{ "file_path": "chat-ui/src/lib/components/icons/IconDazzled.svelte", "repo_id": "chat-ui", "token_count": 916 }
96
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-azure-openai/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-azure-openai/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,215
"""General node utils.""" import logging import uuid from typing import List, Optional, Protocol, runtime_checkable from llama_index.core.schema import ( BaseNode, Document, ImageDocument, ImageNode, NodeRelationship, TextNode, ) from llama_index.core.utils import truncate_text logger = logg...
llama_index/llama-index-core/llama_index/core/node_parser/node_utils.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/node_parser/node_utils.py", "repo_id": "llama_index", "token_count": 1564 }
1,201
import os import tempfile import streamlit as st from langchain.chat_models import ChatOpenAI from langchain.document_loaders import PyPDFLoader from langchain.memory import ConversationBufferMemory from langchain.memory.chat_message_histories import StreamlitChatMessageHistory from langchain.embeddings import HuggingF...
streamlit-agent/streamlit_agent/chat_with_documents.py/0
{ "file_path": "streamlit-agent/streamlit_agent/chat_with_documents.py", "repo_id": "streamlit-agent", "token_count": 1650 }
2,145
from langchain_community.chat_message_histories.firestore import ( FirestoreChatMessageHistory, ) __all__ = ["FirestoreChatMessageHistory"]
langchain/libs/langchain/langchain/memory/chat_message_histories/firestore.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/chat_message_histories/firestore.py", "repo_id": "langchain", "token_count": 43 }
547
from dataclasses import dataclass from typing import Optional from candle.nn import Module, Embedding, LayerNorm, Linear, ModuleList from candle import Tensor import candle import candle.functional as F from typing import Tuple, Optional @dataclass class Config: vocab_size: int = 30522 hidden_size: int = 768 ...
candle/candle-pyo3/py_src/candle/models/bert.py/0
{ "file_path": "candle/candle-pyo3/py_src/candle/models/bert.py", "repo_id": "candle", "token_count": 3528 }
67
"""Google's Gemini multi-modal models.""" import os import typing from typing import Any, Dict, Optional, Sequence from llama_index.legacy.bridge.pydantic import Field, PrivateAttr from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.constants import DEFAULT_NUM_OUTPUTS, DEFAULT_TEMPERATUR...
llama_index/llama-index-legacy/llama_index/legacy/multi_modal_llms/gemini.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/multi_modal_llms/gemini.py", "repo_id": "llama_index", "token_count": 4436 }
1,741
// Empty
langchainjs/libs/langchain-community/src/index.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/index.ts", "repo_id": "langchainjs", "token_count": 3 }
943
from langchain_core.pydantic_v1 import SecretStr from pytest import CaptureFixture from langchain_community.llms.stochasticai import StochasticAI def test_api_key_is_string() -> None: llm = StochasticAI(stochasticai_api_key="secret-api-key") assert isinstance(llm.stochasticai_api_key, SecretStr) def test_a...
langchain/libs/community/tests/unit_tests/llms/test_stochasticai.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/llms/test_stochasticai.py", "repo_id": "langchain", "token_count": 229 }
420
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/tests/testing_utils.py/0
{ "file_path": "peft/tests/testing_utils.py", "repo_id": "peft", "token_count": 1134 }
331
# coding=utf-8 # Copyright 2021 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/wav2vec2/test_modeling_tf_wav2vec2.py/0
{ "file_path": "transformers/tests/models/wav2vec2/test_modeling_tf_wav2vec2.py", "repo_id": "transformers", "token_count": 17501 }
823
kind: NetworkChaos apiVersion: chaos-mesh.org/v1alpha1 metadata: name: test-indexnode-network-latency namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: app.kubernetes.io/instance: milvus-chaos component: indexnode mode: all action: delay delay: ...
milvus/tests/python_client/chaos/chaos_objects/network_latency/chaos_indexnode_network_latency.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/network_latency/chaos_indexnode_network_latency.yaml", "repo_id": "milvus", "token_count": 226 }
2,165