text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
import { str } from "../utils/str"; // inlined from langchain/schema interface BaseMessageFields { content: string; name?: string; additional_kwargs?: { [key: string]: unknown; }; } class AIMessageChunk { /** The text of the message. */ content: string; /** The name of the message sender in a multi...
langserve/langserve/playground/src/components/StreamOutput.tsx/0
{ "file_path": "langserve/langserve/playground/src/components/StreamOutput.tsx", "repo_id": "langserve", "token_count": 1279 }
1,013
package indexparamcheck import ( "fmt" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/pkg/common" ) type floatVectorBaseChecker struct { baseChecker } func (c floatVectorBaseChecker) staticCheck(params map[string]string) error { if !CheckStrByValues(params, Metric, METRICS)...
milvus/pkg/util/indexparamcheck/float_vector_base_checker.go/0
{ "file_path": "milvus/pkg/util/indexparamcheck/float_vector_base_checker.go", "repo_id": "milvus", "token_count": 422 }
1,839
import jsonpointer from "jsonpointer"; import { Serializable } from "@langchain/core/load/serializable"; import { Tool, ToolParams } from "@langchain/core/tools"; export type Json = | string | number | boolean | null | { [key: string]: Json } | Json[]; export type JsonObject = { [key: string]: Json }; /*...
langchainjs/langchain/src/tools/json.ts/0
{ "file_path": "langchainjs/langchain/src/tools/json.ts", "repo_id": "langchainjs", "token_count": 1463 }
942
## Token classification Based on the scripts [`run_ner.py`](https://github.com/huggingface/transformers/blob/main/examples/legacy/token-classification/run_ner.py). The following examples are covered in this section: * NER on the GermEval 2014 (German NER) dataset * Emerging and Rare Entities task: WNUT’17 (English N...
transformers/examples/legacy/token-classification/README.md/0
{ "file_path": "transformers/examples/legacy/token-classification/README.md", "repo_id": "transformers", "token_count": 4550 }
521
export * from "@langchain/core/tracers/console";
langchainjs/langchain/src/callbacks/handlers/console.ts/0
{ "file_path": "langchainjs/langchain/src/callbacks/handlers/console.ts", "repo_id": "langchainjs", "token_count": 15 }
858
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/it/create_a_model.md/0
{ "file_path": "transformers/docs/source/it/create_a_model.md", "repo_id": "transformers", "token_count": 5838 }
532
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/beit/convert_beit_unilm_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/beit/convert_beit_unilm_to_pytorch.py", "repo_id": "transformers", "token_count": 7533 }
607
import os from functools import partial, reduce from typing import TYPE_CHECKING, Callable, Dict, Optional, Tuple, Type, Union import transformers from .. import PretrainedConfig, is_tf_available, is_torch_available from ..utils import TF2_WEIGHTS_NAME, WEIGHTS_NAME, logging from .config import OnnxConfig if TYPE_C...
transformers/src/transformers/onnx/features.py/0
{ "file_path": "transformers/src/transformers/onnx/features.py", "repo_id": "transformers", "token_count": 13911 }
746
[tool.poetry] name = "retrieval-agent-fireworks" version = "0.0.1" description = "Retrieval agent for open source models hosted on Fireworks" authors = [] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" arxiv = "^2.0.0" langchain-community = "^0.0.17" langchainhub = "^0.1.14"...
langchain/templates/retrieval-agent-fireworks/pyproject.toml/0
{ "file_path": "langchain/templates/retrieval-agent-fireworks/pyproject.toml", "repo_id": "langchain", "token_count": 322 }
752
import { OpenAI, ChatOpenAI } from "@langchain/openai"; import * as process from "process"; import { SystemMessage, HumanMessage } from "@langchain/core/messages"; export const run = async () => { process.env.LANGCHAIN_HANDLER = "langchain"; const model = new OpenAI({ temperature: 0.9 }); const resA = await mode...
langchainjs/examples/src/models/llm/llm_with_tracing.ts/0
{ "file_path": "langchainjs/examples/src/models/llm/llm_with_tracing.ts", "repo_id": "langchainjs", "token_count": 206 }
809
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class PyTorchBenchmark(metaclass=DummyObject): _backends = ["torch"] def __init__(self, *args, **kwargs): requires_backends(self, ["torch"]) class PyTorchBenchmarkArguments...
transformers/src/transformers/utils/dummy_pt_objects.py/0
{ "file_path": "transformers/src/transformers/utils/dummy_pt_objects.py", "repo_id": "transformers", "token_count": 92051 }
707
from langchain_community.llms.self_hosted import ( SelfHostedPipeline, ) __all__ = ["SelfHostedPipeline"]
langchain/libs/langchain/langchain/llms/self_hosted.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/self_hosted.py", "repo_id": "langchain", "token_count": 43 }
543
import { Serializable } from "./load/serializable.js"; import { type BaseMessage, HumanMessage, AIMessage } from "./messages/index.js"; /** * Base class for all chat message histories. All chat message histories * should extend this class. */ export abstract class BaseChatMessageHistory extends Serializable { pub...
langchainjs/langchain-core/src/chat_history.ts/0
{ "file_path": "langchainjs/langchain-core/src/chat_history.ts", "repo_id": "langchainjs", "token_count": 731 }
850
import logging from typing import Any, Dict, List, Optional from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.llms import LLM from langchain_core.outputs import Generation, LLMResult from langchain_core.pydantic_v1 import Extra, root_validator from langchain_core.utils i...
langchain/libs/community/langchain_community/llms/clarifai.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/clarifai.py", "repo_id": "langchain", "token_count": 3407 }
279
package common import ( "testing" "github.com/stretchr/testify/assert" ) func TestCloneByteSlice(t *testing.T) { type args struct { s ByteSlice } tests := []struct { name string args args want ByteSlice }{ { args: args{s: []byte{0x0}}, want: []byte{0x0}, }, { args: args{s: []byte{0xff}},...
milvus/pkg/common/byte_slice_test.go/0
{ "file_path": "milvus/pkg/common/byte_slice_test.go", "repo_id": "milvus", "token_count": 376 }
2,083
"""Integration tests for the langchain tracer module.""" import asyncio from langchain_community.callbacks import get_openai_callback from langchain_community.llms import OpenAI async def test_openai_callback() -> None: llm = OpenAI(temperature=0) with get_openai_callback() as cb: llm("What is the s...
langchain/libs/community/tests/integration_tests/callbacks/test_openai_callback.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/callbacks/test_openai_callback.py", "repo_id": "langchain", "token_count": 950 }
316
"""Keep here for backwards compatibility.""" from langchain.chains.example_generator import generate_example __all__ = ["generate_example"]
langchain/libs/langchain/langchain/example_generator.py/0
{ "file_path": "langchain/libs/langchain/langchain/example_generator.py", "repo_id": "langchain", "token_count": 36 }
531
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-microsoft-sharepoint/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-microsoft-sharepoint/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,340
from langchain_core.caches import RETURN_VAL_TYPE, BaseCache __all__ = ["BaseCache", "RETURN_VAL_TYPE"]
langchain/libs/langchain/langchain/schema/cache.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/cache.py", "repo_id": "langchain", "token_count": 37 }
545
--- apiVersion: v1 kind: Namespace metadata: name: logging # create dameonset to rsync pod logs --- apiVersion: apps/v1 kind: DaemonSet metadata: name: cron-logging namespace: logging labels: k8s-app: cron-logging spec: selector: matchLabels: k8s-app: cron-logging template: metadata: ...
milvus/build/config/logging/cron-logging.yaml/0
{ "file_path": "milvus/build/config/logging/cron-logging.yaml", "repo_id": "milvus", "token_count": 493 }
1,608
# coding=utf-8 # Copyright 2018 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 o...
transformers/tests/models/cpm/test_tokenization_cpm.py/0
{ "file_path": "transformers/tests/models/cpm/test_tokenization_cpm.py", "repo_id": "transformers", "token_count": 733 }
709
python_sources()
llama_index/llama-index-core/llama_index/core/service_context_elements/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/service_context_elements/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,177
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/es/model_sharing.md/0
{ "file_path": "transformers/docs/source/es/model_sharing.md", "repo_id": "transformers", "token_count": 3981 }
503
# coding=utf-8 # Copyright 2021 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
transformers/tests/models/beit/test_image_processing_beit.py/0
{ "file_path": "transformers/tests/models/beit/test_image_processing_beit.py", "repo_id": "transformers", "token_count": 4624 }
732
from llama_index.readers.file.docs.base import DocxReader, HWPReader, PDFReader __all__ = ["DocxReader", "HWPReader", "PDFReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/docs/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/docs/__init__.py", "repo_id": "llama_index", "token_count": 49 }
1,365
# LlamaIndex Vector_Stores Integration: Deeplake
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-deeplake/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-deeplake/README.md", "repo_id": "llama_index", "token_count": 14 }
1,600
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/models/rag/test_tokenization_rag.py/0
{ "file_path": "transformers/tests/models/rag/test_tokenization_rag.py", "repo_id": "transformers", "token_count": 3143 }
747
python_tests( name="tests", )
llama_index/llama-index-core/tests/chat_engine/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/chat_engine/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,184
// 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/segments/retrieve_test.go/0
{ "file_path": "milvus/internal/querynodev2/segments/retrieve_test.go", "repo_id": "milvus", "token_count": 2847 }
1,777
# Introduction <CourseFloatingBanner unit={0} classNames="absolute z-10 right-0 top-0" /> ## Bienvenue au cours sur les modèles de diffusion 🤗 ! ## À quoi s'attendre ? In this free course, you will: - 👩‍🎓 Study the theory behind diffusion models - 🧨 Learn how to generate images and audio with the popula...
diffusion-models-class/units/fr/unit0/1.mdx/0
{ "file_path": "diffusion-models-class/units/fr/unit0/1.mdx", "repo_id": "diffusion-models-class", "token_count": 1801 }
285
package aliyun import ( "os" "testing" "github.com/cockroachdb/errors" "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus/internal/storage/aliyun/mocks" ) func TestNewMinioClient(t *testing.T) { t.Run("ak sk ok", fu...
milvus/internal/storage/aliyun/aliyun_test.go/0
{ "file_path": "milvus/internal/storage/aliyun/aliyun_test.go", "repo_id": "milvus", "token_count": 1431 }
2,061
reviewers: - congqixia - jiaoew1991 - sunby - weiliu1031 - yah01 - MrPresent-Han approvers: - maintainers
milvus/internal/querycoordv2/balance/OWNERS/0
{ "file_path": "milvus/internal/querycoordv2/balance/OWNERS", "repo_id": "milvus", "token_count": 55 }
1,754
# Copyright 2023 The HuggingFace Team. All rights reserved. import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def ffmpeg_read(bpayload: bytes, sampling_rate: int) -> np.array: """ Helper function to read an audio file through ffmpeg. """ ar...
transformers/src/transformers/pipelines/audio_utils.py/0
{ "file_path": "transformers/src/transformers/pipelines/audio_utils.py", "repo_id": "transformers", "token_count": 3857 }
776
// 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/mq/msgstream/mqwrapper/rmq/rmq_client.go/0
{ "file_path": "milvus/internal/mq/msgstream/mqwrapper/rmq/rmq_client.go", "repo_id": "milvus", "token_count": 1612 }
1,733
import requests import argparse from tenacity import retry, stop_after_attempt @retry(stop=stop_after_attempt(7)) def get_image_tag_by_short_name(repository, tag, arch): # Send API request to get all tags start with prefix # ${branch}-latest means the tag is a dev build # master-latest -> master-$dat...
milvus/tests/scripts/get_image_tag_by_short_name.py/0
{ "file_path": "milvus/tests/scripts/get_image_tag_by_short_name.py", "repo_id": "milvus", "token_count": 1374 }
2,048
"""Mix Self Consistency Query Engine. All prompts adapted from original paper by Liu et al. (2023): https://arxiv.org/pdf/2312.16702v1.pdf """ import asyncio from enum import Enum from typing import Any, Dict, List, Optional import pandas as pd from llama_index.core.base.response.schema import RESPONSE_TYPE from lla...
llama_index/llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/mix_self_consistency/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/mix_self_consistency/base.py", "repo_id": "llama_index", "token_count": 5709 }
1,598
import { OpenAI } from "@langchain/openai"; // To make the caching really obvious, lets use a slower model. const model = new OpenAI({ modelName: "gpt-3.5-turbo-instruct", cache: true, }); console.time(); // The first time, it is not yet in cache, so it should take longer const res = await model.invoke("Tell me ...
langchainjs/examples/src/models/chat/llm_caching.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/llm_caching.ts", "repo_id": "langchainjs", "token_count": 171 }
898
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datanode/flow_graph_dd_node.go/0
{ "file_path": "milvus/internal/datanode/flow_graph_dd_node.go", "repo_id": "milvus", "token_count": 4066 }
1,783
""" Evaluation script for RAG models.""" import argparse import ast import logging import os import sys import pandas as pd import torch from tqdm import tqdm from transformers import BartForConditionalGeneration, RagRetriever, RagSequenceForGeneration, RagTokenForGeneration from transformers import logging as trans...
transformers/examples/research_projects/rag-end2end-retriever/eval_rag.py/0
{ "file_path": "transformers/examples/research_projects/rag-end2end-retriever/eval_rag.py", "repo_id": "transformers", "token_count": 4854 }
596
from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class DatasetListTest(TestCase): def _create_example_records(self): return [ {"col_1": 3, "col_2": "a"}, {"col_1": 2, "col_2": "b"}, {"col_1": 1, "col_2": "c"}...
datasets/tests/test_dataset_list.py/0
{ "file_path": "datasets/tests/test_dataset_list.py", "repo_id": "datasets", "token_count": 875 }
153
# LlamaIndex Readers Integration: Milvus
llama_index/llama-index-integrations/readers/llama-index-readers-milvus/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-milvus/README.md", "repo_id": "llama_index", "token_count": 11 }
1,484
# coding=utf-8 # Copyright 2022 The Hugging Face 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...
transformers/tests/models/markuplm/test_modeling_markuplm.py/0
{ "file_path": "transformers/tests/models/markuplm/test_modeling_markuplm.py", "repo_id": "transformers", "token_count": 6144 }
720
import os from typing import Any, Callable, Union import pytest from langchain_core.outputs import Generation from langchain.cache import GPTCache from langchain.globals import get_llm_cache, set_llm_cache from tests.unit_tests.llms.fake_llm import FakeLLM try: from gptcache import Cache # noqa: F401 from g...
langchain/libs/langchain/tests/integration_tests/cache/test_gptcache.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/cache/test_gptcache.py", "repo_id": "langchain", "token_count": 827 }
589
# RAG with Multiple Indexes (Fusion) A QA application that queries multiple domain-specific retrievers and selects the most relevant documents from across all retrieved results. ## Environment Setup This application queries PubMed, ArXiv, Wikipedia, and [Kay AI](https://www.kay.ai) (for SEC filings). You will need ...
langchain/templates/rag-multi-index-fusion/README.md/0
{ "file_path": "langchain/templates/rag-multi-index-fusion/README.md", "repo_id": "langchain", "token_count": 691 }
736
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/training_args_seq2seq.py/0
{ "file_path": "transformers/src/transformers/training_args_seq2seq.py", "repo_id": "transformers", "token_count": 1641 }
769
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/src/query/generated/ExprVisitor.h/0
{ "file_path": "milvus/internal/core/src/query/generated/ExprVisitor.h", "repo_id": "milvus", "token_count": 446 }
1,743
from llama_index.readers.singlestore.base import SingleStoreReader __all__ = ["SingleStoreReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-singlestore/llama_index/readers/singlestore/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-singlestore/llama_index/readers/singlestore/__init__.py", "repo_id": "llama_index", "token_count": 30 }
1,553
# AwaDB >[AwaDB](https://github.com/awa-ai/awadb) is an AI Native database for the search and storage of embedding vectors used by LLM Applications. ## Installation and Setup ```bash pip install awadb ``` ## Vector Store ```python from langchain_community.vectorstores import AwaDB ``` See a [usage example](/doc...
langchain/docs/docs/integrations/providers/awadb.md/0
{ "file_path": "langchain/docs/docs/integrations/providers/awadb.md", "repo_id": "langchain", "token_count": 169 }
141
""" Pinecone Vector store index. An index that is built on top of an existing vector store. """ import logging from collections import Counter from functools import partial from typing import Any, Callable, Dict, List, Optional, cast from llama_index.legacy.bridge.pydantic import PrivateAttr from llama_index.legacy...
llama_index/llama-index-legacy/llama_index/legacy/vector_stores/pinecone.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/vector_stores/pinecone.py", "repo_id": "llama_index", "token_count": 7103 }
1,612
use fancy_regex::Regex; use std::error::Error; #[derive(Debug)] pub struct SysRegex { regex: Regex, } impl SysRegex { pub fn find_iter<'r, 't>(&'r self, inside: &'t str) -> Matches<'r, 't> { Matches(self.regex.find_iter(inside)) } pub fn new(regex_str: &str) -> Result<Self, Box<dyn Error + Se...
tokenizers/tokenizers/src/utils/fancy.rs/0
{ "file_path": "tokenizers/tokenizers/src/utils/fancy.rs", "repo_id": "tokenizers", "token_count": 396 }
424
from llama_index.storage.index_store.firestore.base import FirestoreIndexStore __all__ = ["FirestoreIndexStore"]
llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-firestore/llama_index/storage/index_store/firestore/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-firestore/llama_index/storage/index_store/firestore/__init__.py", "repo_id": "llama_index", "token_count": 34 }
1,460
<!--- Copyright 2021 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/examples/flax/vision/README.md/0
{ "file_path": "transformers/examples/flax/vision/README.md", "repo_id": "transformers", "token_count": 775 }
539
/* eslint-disable no-process-env */ import { ConvexHttpClient } from "convex/browser"; import { expect, test } from "@jest/globals"; // eslint-disable-next-line import/no-relative-packages import { api } from "./convex/convex/_generated/api.js"; // To run these tests at least once, follow these steps: // // 1. `cd l...
langchainjs/libs/langchain-community/src/vectorstores/tests/convex.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/convex.int.test.ts", "repo_id": "langchainjs", "token_count": 572 }
996
// 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/task_index.go/0
{ "file_path": "milvus/internal/proxy/task_index.go", "repo_id": "milvus", "token_count": 11197 }
1,853
python_sources()
llama_index/llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/mix_self_consistency/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/mix_self_consistency/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,681
from typing import Dict, Tuple, Union from langchain.chains.query_constructor.ir import ( Comparator, Comparison, Operation, Operator, StructuredQuery, Visitor, ) class OpenSearchTranslator(Visitor): """Translate `OpenSearch` internal query domain-specific language elements to valid f...
langchain/libs/langchain/langchain/retrievers/self_query/opensearch.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/self_query/opensearch.py", "repo_id": "langchain", "token_count": 1669 }
538
# Reward Modeling TRL supports custom reward modeling for anyone to perform reward modeling on their dataset and model. Check out a complete flexible example at [`examples/scripts/reward_modeling.py`](https://github.com/huggingface/trl/tree/main/examples/scripts/reward_modeling.py). ## Expected dataset format The [...
trl/docs/source/reward_trainer.mdx/0
{ "file_path": "trl/docs/source/reward_trainer.mdx", "repo_id": "trl", "token_count": 877 }
855
<jupyter_start><jupyter_text>MongoDB DemoThis guide shows you how to directly use our `DocumentStore` abstraction backed by MongoDB. By putting nodes in the docstore, this allows you to define multiple indices over the same underlying docstore, instead of duplicating data across indices. If you're opening this Notebook...
llama_index/docs/examples/docstore/MongoDocstoreDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/docstore/MongoDocstoreDemo.ipynb", "repo_id": "llama_index", "token_count": 1413 }
1,179
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/examples/legacy/seq2seq/utils.py/0
{ "file_path": "transformers/examples/legacy/seq2seq/utils.py", "repo_id": "transformers", "token_count": 10920 }
527
from rag_mongo.chain import chain __all__ = ["chain"]
langchain/templates/rag-mongo/rag_mongo/__init__.py/0
{ "file_path": "langchain/templates/rag-mongo/rag_mongo/__init__.py", "repo_id": "langchain", "token_count": 19 }
694
<jupyter_start><jupyter_text>OpenAILet's load the OpenAI Embedding class. SetupFirst we install langchain-openai and set the required env vars<jupyter_code>%pip install -qU langchain-openai import getpass import os os.environ["OPENAI_API_KEY"] = getpass.getpass() from langchain_openai import OpenAIEmbeddings embeddin...
langchain/docs/docs/integrations/text_embedding/openai.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/openai.ipynb", "repo_id": "langchain", "token_count": 458 }
176
# coding=utf-8 # Copyright 2022 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/yolos/convert_yolos_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/yolos/convert_yolos_to_pytorch.py", "repo_id": "transformers", "token_count": 5081 }
682
from llama_index.core.vector_stores.types import VectorStore from llama_index.vector_stores.upstash import UpstashVectorStore def test_class(): names_of_base_classes = [b.__name__ for b in UpstashVectorStore.__mro__] assert VectorStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-upstash/tests/test_vector_stores_upstash.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-upstash/tests/test_vector_stores_upstash.py", "repo_id": "llama_index", "token_count": 95 }
1,541
from langchain_community.llms.javelin_ai_gateway import JavelinAIGateway, Params __all__ = ["JavelinAIGateway", "Params"]
langchain/libs/langchain/langchain/llms/javelin_ai_gateway.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/javelin_ai_gateway.py", "repo_id": "langchain", "token_count": 48 }
562
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,535
from typing import List, Optional import aiohttp import requests from langchain_core.callbacks import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever class RemoteLangChainRetriever(BaseR...
langchain/libs/community/langchain_community/retrievers/remote_retriever.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/remote_retriever.py", "repo_id": "langchain", "token_count": 788 }
298
mod assignment; mod config; mod errors; mod index; mod ingest; mod memberlist; mod segment; mod server; mod storage; mod sysdb; mod system; mod types; use config::Configurable; use memberlist::MemberlistProvider; use crate::sysdb::sysdb::SysDb; mod chroma_proto { tonic::include_proto!("chroma"); } pub async fn ...
chroma/rust/worker/src/lib.rs/0
{ "file_path": "chroma/rust/worker/src/lib.rs", "repo_id": "chroma", "token_count": 1267 }
62
from typing import List, Optional from unittest.mock import MagicMock import pytest from fastapi import Request from langchain.prompts import PromptTemplate from langchain.schema.runnable.utils import ConfigurableField from langserve.api_handler import _unpack_request_config try: from pydantic.v1 import BaseMode...
langserve/tests/unit_tests/test_validation.py/0
{ "file_path": "langserve/tests/unit_tests/test_validation.py", "repo_id": "langserve", "token_count": 2412 }
1,134
SHELL := /bin/bash .PHONY: all format lint test tests integration_test integration_tests spell_check help # Default target executed when no arguments are given to make. all: help # Define a variable for the test file path. TEST_FILE ?= tests/unit_tests/ INTEGRATION_TEST_FILE ?= tests/integration_tests/ test: poetry...
langchain/libs/partners/astradb/Makefile/0
{ "file_path": "langchain/libs/partners/astradb/Makefile", "repo_id": "langchain", "token_count": 795 }
641
# 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/test_common_gpu.py/0
{ "file_path": "peft/tests/test_common_gpu.py", "repo_id": "peft", "token_count": 13589 }
339
<jupyter_start><jupyter_text>HuggingFace Hub Tools>[Huggingface Tools](https://huggingface.co/docs/transformers/v4.29.0/en/custom_tools) that supporting text I/O can beloaded directly using the `load_huggingface_tool` function.<jupyter_code># Requires transformers>=4.29.0 and huggingface_hub>=0.14.1 %pip install --upgr...
langchain/docs/docs/integrations/tools/huggingface_tools.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/huggingface_tools.ipynb", "repo_id": "langchain", "token_count": 207 }
169
use crate::{ config::{Configurable, WorkerConfig}, errors::ChromaError, sysdb::sysdb::{GrpcSysDb, SysDb}, types::VectorQueryResult, }; use async_trait::async_trait; use k8s_openapi::api::node; use num_bigint::BigInt; use parking_lot::{ MappedRwLockReadGuard, RwLock, RwLockReadGuard, RwLockUpgradable...
chroma/rust/worker/src/segment/segment_manager.rs/0
{ "file_path": "chroma/rust/worker/src/segment/segment_manager.rs", "repo_id": "chroma", "token_count": 5283 }
63
# 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_data_loader.py/0
{ "file_path": "accelerate/tests/test_data_loader.py", "repo_id": "accelerate", "token_count": 8488 }
18
import { dot } from "@xenova/transformers"; import type { EmbeddingBackendModel } from "$lib/server/embeddingModels"; import type { Embedding } from "$lib/server/embeddingEndpoints/embeddingEndpoints"; // see here: https://github.com/nmslib/hnswlib/blob/359b2ba87358224963986f709e593d799064ace6/README.md?plain=1#L34 fu...
chat-ui/src/lib/server/sentenceSimilarity.ts/0
{ "file_path": "chat-ui/src/lib/server/sentenceSimilarity.ts", "repo_id": "chat-ui", "token_count": 503 }
92
import uuid from langserve.callbacks import AsyncEventAggregatorCallback, replace_uuids async def test_event_aggregator() -> None: """Test that the event aggregator is aggregating events.""" from langchain.llms import FakeListLLM from langchain.prompts import ChatPromptTemplate prompt = ChatPromptT...
langserve/tests/unit_tests/test_callbacks.py/0
{ "file_path": "langserve/tests/unit_tests/test_callbacks.py", "repo_id": "langserve", "token_count": 782 }
1,069
[tool.poetry] name = "sql-ollama" version = "0.1.0" description = "Private QA with a SQL database using natural language and a local LLM" authors = [ "Lance Martin <lance@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" [tool.poetry.group.dev.dependenci...
langchain/templates/sql-ollama/pyproject.toml/0
{ "file_path": "langchain/templates/sql-ollama/pyproject.toml", "repo_id": "langchain", "token_count": 256 }
709
# coding=utf-8 # Copyright 2022 Multimedia Computing Group, Nanjing University 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...
transformers/src/transformers/models/videomae/modeling_videomae.py/0
{ "file_path": "transformers/src/transformers/models/videomae/modeling_videomae.py", "repo_id": "transformers", "token_count": 20402 }
706
# Real-time RAG Chat Bot Evaluation [![Open In GitHub](https://img.shields.io/badge/GitHub-View%20source-green.svg)](https://github.com/langchain-ai/langsmith-cookbook/tree/main/./feedback-examples/streamlit-realtime-feedback/README.md) This tutorial shows how to catch model hallucinations in production using a cust...
langsmith-cookbook/feedback-examples/streamlit-realtime-feedback/README.md/0
{ "file_path": "langsmith-cookbook/feedback-examples/streamlit-realtime-feedback/README.md", "repo_id": "langsmith-cookbook", "token_count": 2665 }
1,057
poetry_requirements( name="poetry", module_mapping={"azure-search-documents": ["azure"]} ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-azcognitive-search/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-azcognitive-search/BUILD", "repo_id": "llama_index", "token_count": 59 }
1,409
# 🦜️🔗 LangChain + Next.js Starter Template [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/langchain-ai/langchain-nextjs-template) [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Flangchain-ai%2Fla...
langchain-nextjs-template/README.md/0
{ "file_path": "langchain-nextjs-template/README.md", "repo_id": "langchain-nextjs-template", "token_count": 2082 }
63
<jupyter_start><jupyter_text>Google Generative Language Semantic RetrieverIn this notebook, we will show you how to get started quickly with using Google's Generative Language Semantic Retriever, which offers specialized embedding models for high quality retrieval and a tuned model for producing grounded output with cu...
llama_index/docs/examples/managed/GoogleDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/managed/GoogleDemo.ipynb", "repo_id": "llama_index", "token_count": 6453 }
1,148
import unittest from typing import Any from unittest.mock import MagicMock, patch from langchain_community.graphs import NebulaGraph class TestNebulaGraph(unittest.TestCase): def setUp(self) -> None: self.space = "test_space" self.username = "test_user" self.password = "test_password" ...
langchain/libs/community/tests/integration_tests/graphs/test_nebulagraph.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/graphs/test_nebulagraph.py", "repo_id": "langchain", "token_count": 1489 }
354
python_sources() python_requirement( name="retrying", requirements=["retrying>=1.3.4"], )
llama_index/llama-index-integrations/readers/llama-index-readers-confluence/llama_index/readers/confluence/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-confluence/llama_index/readers/confluence/BUILD", "repo_id": "llama_index", "token_count": 41 }
1,350
# Memory Stress Testcases All-in-one # memory stress # standalone # todo # cluster-1-node # 11 pods(querynode, datanode, indexnode, pulsar, etcd, minio) # cluster-n-nodes # todo Collections: - testcase: name: test_querynode_mem_stress chaos: chaos_querynode_mem_stress....
milvus/tests/python_client/chaos/chaos_objects/mem_stress/testcases.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/mem_stress/testcases.yaml", "repo_id": "milvus", "token_count": 1061 }
1,954
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/src/storage/TencentCloudCredentialsProvider.h/0
{ "file_path": "milvus/internal/core/src/storage/TencentCloudCredentialsProvider.h", "repo_id": "milvus", "token_count": 699 }
1,944
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-cassandra/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-cassandra/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,596
"""**Utilities** are the integrations with third-part systems and packages. Other LangChain classes use **Utilities** to interact with third-part systems and packages. """ from typing import Any from langchain_community.utilities.requests import ( Requests, RequestsWrapper, TextRequestsWrapper, ) def _i...
langchain/libs/community/langchain_community/utilities/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/__init__.py", "repo_id": "langchain", "token_count": 4408 }
313
from langchain.tools import BaseTool from langchain.tools.render import render_text_description from langchain_core.language_models.base import LanguageModelLike from langchain_core.messages import ( AIMessage, FunctionMessage, HumanMessage, SystemMessage, ) from langgraph.checkpoint import BaseCheckpoi...
opengpts/backend/app/agent_types/xml_agent.py/0
{ "file_path": "opengpts/backend/app/agent_types/xml_agent.py", "repo_id": "opengpts", "token_count": 2212 }
1,993
# Database Tool This tool connects to a database (using SQLAlchemy under the hood) and allows an Agent to query the database and get information about the tables. ## Usage This tool has more extensive example usage documented in a Jupyter notebook [here](https://github.com/emptycrown/llama-hub/tree/main/llama_hub/to...
llama_index/llama-index-integrations/tools/llama-index-tools-database/README.md/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-database/README.md", "repo_id": "llama_index", "token_count": 449 }
1,483
from llama_index.llms.openai.base import AsyncOpenAI, OpenAI, SyncOpenAI, Tokenizer __all__ = ["OpenAI", "Tokenizer", "SyncOpenAI", "AsyncOpenAI"]
llama_index/llama-index-integrations/llms/llama-index-llms-openai/llama_index/llms/openai/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-openai/llama_index/llms/openai/__init__.py", "repo_id": "llama_index", "token_count": 53 }
1,364
"""Output parsers.""" from llama_index.legacy.output_parsers.base import ChainableOutputParser from llama_index.legacy.output_parsers.guardrails import GuardrailsOutputParser from llama_index.legacy.output_parsers.langchain import LangchainOutputParser from llama_index.legacy.output_parsers.pydantic import PydanticOut...
llama_index/llama-index-legacy/llama_index/legacy/output_parsers/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/output_parsers/__init__.py", "repo_id": "llama_index", "token_count": 186 }
1,509
/* eslint-disable no-process-env */ import { ChatOpenAI } from "@langchain/openai"; import { UpstashRedisCache } from "../upstash_redis.js"; /** * This test is a result of the `lookup` method trying to parse an * incorrectly typed value Before it was being typed as a string, * whereas in reality it was a JSON objec...
langchainjs/libs/langchain-community/src/caches/tests/upstash_redis.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/caches/tests/upstash_redis.int.test.ts", "repo_id": "langchainjs", "token_count": 409 }
960
from langchain_community.utilities.wikipedia import ( WikipediaAPIWrapper, ) __all__ = ["WikipediaAPIWrapper"]
langchain/libs/langchain/langchain/utilities/wikipedia.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/wikipedia.py", "repo_id": "langchain", "token_count": 36 }
597
"""Test TritonTensorRTLLM llm.""" import pytest from langchain_nvidia_trt.llms import TritonTensorRTLLM _MODEL_NAME = "ensemble" @pytest.mark.skip(reason="Need a working Triton server") def test_stream() -> None: """Test streaming tokens from NVIDIA TRT.""" llm = TritonTensorRTLLM(model_name=_MODEL_NAME) ...
langchain/libs/partners/nvidia-trt/tests/integration_tests/test_llms.py/0
{ "file_path": "langchain/libs/partners/nvidia-trt/tests/integration_tests/test_llms.py", "repo_id": "langchain", "token_count": 910 }
658
package typeutil import ( "testing" "github.com/stretchr/testify/assert" ) func TestOrderedMap(t *testing.T) { o := NewOrderedMap[string, int]() // number o.Set("number", 3) v, _ := o.Get("number") assert.Equal(t, 3, v) // overriding existing key o.Set("number", 4) v, _ = o.Get("number") assert.Equal(t, ...
milvus/pkg/util/typeutil/ordered_map_test.go/0
{ "file_path": "milvus/pkg/util/typeutil/ordered_map_test.go", "repo_id": "milvus", "token_count": 396 }
2,068
python_sources()
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-openai/llama_index/multi_modal_llms/openai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-openai/llama_index/multi_modal_llms/openai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,290
import logging from typing import Any, Dict, Generator, List, Optional, Tuple, Type, Union, cast from llama_index.legacy.agent.openai.utils import resolve_tool_choice from llama_index.legacy.llms.llm import LLM from llama_index.legacy.llms.openai import OpenAI from llama_index.legacy.llms.openai_utils import OpenAIToo...
llama_index/llama-index-legacy/llama_index/legacy/program/openai_program.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/program/openai_program.py", "repo_id": "llama_index", "token_count": 4640 }
1,695
from llama_index.callbacks.wandb.base import WandbCallbackHandler from llama_index.core.callbacks.base_handler import BaseCallbackHandler def test_handler_callable(): names_of_base_classes = [b.__name__ for b in WandbCallbackHandler.__mro__] assert BaseCallbackHandler.__name__ in names_of_base_classes
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-wandb/tests/test_wandb_callback.py/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-wandb/tests/test_wandb_callback.py", "repo_id": "llama_index", "token_count": 100 }
1,217
# 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/stable_diffusion_safe/test_safe_diffusion.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_safe/test_safe_diffusion.py", "repo_id": "diffusers", "token_count": 7442 }
287
"""Test Weaviate functionality.""" import logging import os import uuid from typing import Generator, Union from uuid import uuid4 import pytest from langchain_core.documents import Document from langchain_community.retrievers.weaviate_hybrid_search import ( WeaviateHybridSearchRetriever, ) logging.basicConfig(l...
langchain/libs/community/tests/integration_tests/retrievers/test_weaviate_hybrid_search.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/retrievers/test_weaviate_hybrid_search.py", "repo_id": "langchain", "token_count": 2174 }
365