text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
#/bin/bash pytest . $@
milvus/tests/python_client/run.sh/0
{ "file_path": "milvus/tests/python_client/run.sh", "repo_id": "milvus", "token_count": 12 }
1,979
from langchain.schema.cache import __all__ EXPECTED_ALL = ["BaseCache", "RETURN_VAL_TYPE"] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
langchain/libs/langchain/tests/unit_tests/schema/test_cache.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/schema/test_cache.py", "repo_id": "langchain", "token_count": 66 }
651
[tool.poetry] name = "rag-opensearch" version = "0.0.1" description = "RAG template for OpenSearch" authors = ["Kalyan Reddy <kalyan.ben10@live.com>"] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "^0.28.1" opensearch-py = "^2.0.0" tiktoken = "^0.5.1" [tool.poetr...
langchain/templates/rag-opensearch/pyproject.toml/0
{ "file_path": "langchain/templates/rag-opensearch/pyproject.toml", "repo_id": "langchain", "token_count": 312 }
661
package allocator import ( "go.uber.org/atomic" "github.com/milvus-io/milvus/pkg/util/typeutil" ) const ( defaultInitializedValue = 0 defaultDelta = 1 ) type AtomicAllocator struct { now atomic.Int64 delta int64 } type Option func(allocator *AtomicAllocator) func WithInitializedValue(value int6...
milvus/cmd/tools/migration/allocator/atomic_allocator.go/0
{ "file_path": "milvus/cmd/tools/migration/allocator/atomic_allocator.go", "repo_id": "milvus", "token_count": 372 }
1,616
"""Retrieve query.""" import logging from typing import Any, List, Optional from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.callbacks.base import CallbackManager from llama_index.core.indices.query.schema import QueryBundle from llama_index.core.indices.tree.base import TreeIndex f...
llama_index/llama-index-core/llama_index/core/indices/tree/tree_root_retriever.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/tree/tree_root_retriever.py", "repo_id": "llama_index", "token_count": 649 }
1,269
extern crate tokenizers as tk; use crate::models::Model; use napi::bindgen_prelude::*; use std::sync::{Arc, RwLock}; use tokenizers::models::bpe::{BpeBuilder, BPE}; use tokenizers::models::wordlevel::{WordLevel, WordLevelBuilder}; use tokenizers::models::wordpiece::{WordPiece, WordPieceBuilder}; pub struct BPEFromFil...
tokenizers/bindings/node/src/tasks/models.rs/0
{ "file_path": "tokenizers/bindings/node/src/tasks/models.rs", "repo_id": "tokenizers", "token_count": 800 }
458
from contextlib import contextmanager from typing import Callable, Generator, Generic, Optional, Sequence, Type from typing_extensions import Self from langgraph.channels.base import BaseChannel, EmptyChannelError, Value class BinaryOperatorAggregate(Generic[Value], BaseChannel[Value, Value, Value]): """Stores ...
langgraph/langgraph/channels/binop.py/0
{ "file_path": "langgraph/langgraph/channels/binop.py", "repo_id": "langgraph", "token_count": 822 }
1,017
# 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/test_pipelines_auto.py/0
{ "file_path": "diffusers/tests/pipelines/test_pipelines_auto.py", "repo_id": "diffusers", "token_count": 6986 }
285
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/indices/common/struct_store/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/common/struct_store/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,712
from llama_index.embeddings.llm_rails.base import LLMRailsEmbedding, LLMRailsEmbeddings __all__ = ["LLMRailsEmbedding", "LLMRailsEmbeddings"]
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-llm-rails/llama_index/embeddings/llm_rails/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-llm-rails/llama_index/embeddings/llm_rails/__init__.py", "repo_id": "llama_index", "token_count": 54 }
1,318
"""Semantic Scholar API toolkit."""
langchain/libs/community/langchain_community/tools/semanticscholar/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/semanticscholar/__init__.py", "repo_id": "langchain", "token_count": 10 }
294
import logging from abc import ABC, abstractmethod from contextvars import ContextVar from typing import Any, Dict, List, Optional from llama_index.core.callbacks.schema import BASE_TRACE_EVENT, CBEventType logger = logging.getLogger(__name__) global_stack_trace = ContextVar("trace", default=[BASE_TRACE_EVENT]) cla...
llama_index/llama-index-core/llama_index/core/callbacks/base_handler.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/callbacks/base_handler.py", "repo_id": "llama_index", "token_count": 686 }
1,179
"""Test EdenAiEmbeddings embeddings""" from langchain_core.pydantic_v1 import SecretStr from pytest import CaptureFixture from langchain_community.embeddings import EdenAiEmbeddings def test_api_key_is_string() -> None: llm = EdenAiEmbeddings(edenai_api_key="secret-api-key") assert isinstance(llm.edenai_api...
langchain/libs/community/tests/unit_tests/embeddings/test_edenai.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/embeddings/test_edenai.py", "repo_id": "langchain", "token_count": 237 }
376
<jupyter_start><jupyter_text>MongoDB ReaderDemonstrates our MongoDB data connector<jupyter_code>%pip install llama-index-readers-mongodb import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))<jupyter_output><empty_ou...
llama_index/docs/examples/data_connectors/MongoDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/data_connectors/MongoDemo.ipynb", "repo_id": "llama_index", "token_count": 400 }
1,094
from llama_index.core.readers.base import BaseReader from llama_index.readers.steamship import SteamshipFileReader def test_class(): names_of_base_classes = [b.__name__ for b in SteamshipFileReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-steamship/tests/test_readers_steamship.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-steamship/tests/test_readers_steamship.py", "repo_id": "llama_index", "token_count": 93 }
1,437
from llama_index.core.base.base_retriever import BaseRetriever from llama_index.retrievers.bm25.base import BM25Retriever def test_class(): names_of_base_classes = [b.__name__ for b in BM25Retriever.__mro__] assert BaseRetriever.__name__ in names_of_base_classes
llama_index/llama-index-integrations/retrievers/llama-index-retrievers-bm25/tests/test_retrievers_bm25_retriever.py/0
{ "file_path": "llama_index/llama-index-integrations/retrievers/llama-index-retrievers-bm25/tests/test_retrievers_bm25_retriever.py", "repo_id": "llama_index", "token_count": 102 }
1,484
kind: Schedule apiVersion: chaos-mesh.org/v1alpha1 metadata: name: test-rootcoord-pod-kill namespace: chaos-testing spec: schedule: '*/5 * * * * *' startingDeadlineSeconds: 60 concurrencyPolicy: Forbid historyLimit: 1 type: PodChaos podChaos: selector: namespaces: - chaos-testing ...
milvus/tests/python_client/chaos/chaos_objects/pod_kill/chaos_rootcoord_pod_kill.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/pod_kill/chaos_rootcoord_pod_kill.yaml", "repo_id": "milvus", "token_count": 222 }
1,993
<jupyter_start><jupyter_text>Query Pipeline for Advanced Text-to-SQL In this guide we show you how to setup a text-to-SQL pipeline over your data with our [query pipeline](https://docs.llamaindex.ai/en/stable/module_guides/querying/pipeline/root.html) syntax.This gives you flexibility to enhance text-to-SQL with additi...
llama_index/docs/examples/pipeline/query_pipeline_sql.ipynb/0
{ "file_path": "llama_index/docs/examples/pipeline/query_pipeline_sql.ipynb", "repo_id": "llama_index", "token_count": 8044 }
1,074
from langchain_community.document_loaders.text import TextLoader __all__ = ["TextLoader"]
langchain/libs/langchain/langchain/document_loaders/text.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/text.py", "repo_id": "langchain", "token_count": 26 }
539
<jupyter_start><jupyter_text>JiraThis notebook goes over how to use the `Jira` toolkit.The `Jira` toolkit allows agents to interact with a given Jira instance, performing actions such as searching for issues and creating issues, the tool wraps the atlassian-python-api library, for more see: https://atlassian-python-api...
langchain/docs/docs/integrations/toolkits/jira.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/toolkits/jira.ipynb", "repo_id": "langchain", "token_count": 636 }
178
import pytest @pytest.fixture(scope="module") def flash_starcoder_handle(launcher): with launcher("bigcode/starcoder", num_shard=2) as handle: yield handle @pytest.fixture(scope="module") async def flash_starcoder(flash_starcoder_handle): await flash_starcoder_handle.health(300) return flash_sta...
text-generation-inference/integration-tests/models/test_flash_starcoder.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_starcoder.py", "repo_id": "text-generation-inference", "token_count": 578 }
400
// 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/balance/priority_queue_test.go/0
{ "file_path": "milvus/internal/querycoordv2/balance/priority_queue_test.go", "repo_id": "milvus", "token_count": 1081 }
1,825
# 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 ...
transformers/tests/models/mvp/test_modeling_mvp.py/0
{ "file_path": "transformers/tests/models/mvp/test_modeling_mvp.py", "repo_id": "transformers", "token_count": 15265 }
814
from llama_index.core.readers.base import BaseReader from llama_index.readers.mondaydotcom import MondayReader def test_class(): names_of_base_classes = [b.__name__ for b in MondayReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-mondaydotcom/tests/test_readers_mondaydotcom.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mondaydotcom/tests/test_readers_mondaydotcom.py", "repo_id": "llama_index", "token_count": 88 }
1,489
package model import ( "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" ) type Segment struct { SegmentID int64 CollectionID int64 PartitionID int64 NumRows int64 BinLogs []string MemSize int64 DmChannel string CompactionFrom [...
milvus/internal/metastore/model/segment.go/0
{ "file_path": "milvus/internal/metastore/model/segment.go", "repo_id": "milvus", "token_count": 244 }
1,945
from typing import List, Optional from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class PsychicLoader(BaseLoader): """Load from `Psychic.dev`.""" def __init__( self, api_key: str, account_id: str, connector_id: Optional[str] = None ...
langchain/libs/community/langchain_community/document_loaders/psychic.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/psychic.py", "repo_id": "langchain", "token_count": 604 }
246
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/realm/test_modeling_realm.py/0
{ "file_path": "transformers/tests/models/realm/test_modeling_realm.py", "repo_id": "transformers", "token_count": 9513 }
731
import type { Message } from "$lib/types/Message"; import { getContext, setContext } from "svelte"; import { writable, type Writable } from "svelte/store"; // used to store the id of the message that is the currently displayed leaf of the conversation tree // (that is the last message in the current branch of the conv...
chat-ui/src/lib/stores/convTree.ts/0
{ "file_path": "chat-ui/src/lib/stores/convTree.ts", "repo_id": "chat-ui", "token_count": 216 }
108
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-pdf-table/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-pdf-table/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,416
[ { "server": "athena", "suite_params": [ { "suite": "080_gpu_accuracy.yaml", "image_type": "gpu" }, { "suite": "080_search_stability.yaml", "image_type": "gpu" }, { ...
milvus/tests/benchmark/milvus_benchmark/scheduler/010_data.json/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/scheduler/010_data.json", "repo_id": "milvus", "token_count": 1116 }
1,857
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-tair/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-tair/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,623
import { OpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { RetrievalQAChain, loadQAStuffChain } from "langchain/chains"; import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import * as fs from "fs"; import { PromptTem...
langchainjs/examples/src/chains/retrieval_qa_custom_prompt_legacy.ts/0
{ "file_path": "langchainjs/examples/src/chains/retrieval_qa_custom_prompt_legacy.ts", "repo_id": "langchainjs", "token_count": 455 }
791
<jupyter_start><jupyter_text>Airbyte Question AnsweringThis notebook shows how to do question answering over structured data, in this case using the `AirbyteStripeLoader`.Vectorstores often have a hard time answering questions that requires computing, grouping and filtering structured data so the high level idea is to ...
langchain/docs/docs/integrations/toolkits/airbyte_structured_qa.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/toolkits/airbyte_structured_qa.ipynb", "repo_id": "langchain", "token_count": 581 }
167
import pytest from datasets.utils.version import Version @pytest.mark.parametrize( "other, expected_equality", [ (Version("1.0.0"), True), ("1.0.0", True), (Version("2.0.0"), False), ("2.0.0", False), ("1", False), ("a", False), (1, False), (Non...
datasets/tests/test_version.py/0
{ "file_path": "datasets/tests/test_version.py", "repo_id": "datasets", "token_count": 254 }
151
--- sidebar_label: Alibaba Tongyi --- import CodeBlock from "@theme/CodeBlock"; # ChatAlibabaTongyi LangChain.js supports the Alibaba qwen family of models. ## Setup You'll need to sign up for an Alibaba API key and set it as an environment variable named `ALIBABA_API_KEY` ## Usage Here's an example: import Ton...
langchainjs/docs/core_docs/docs/integrations/chat/alibaba_tongyi.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/chat/alibaba_tongyi.mdx", "repo_id": "langchainjs", "token_count": 140 }
721
<jupyter_start><jupyter_text>Basic Critique-ReviseYou can also run this notebook online [on Noteable.io](https://app.noteable.io/published/41cf4f55-bd8c-4b7f-b3d4-547d5e601960/basic_critique_revise).This is an basic example of correcting an LLM's output using a pattern called critique-revise, where we highlight what pa...
langchainjs/cookbook/basic_critique_revise.ipynb/0
{ "file_path": "langchainjs/cookbook/basic_critique_revise.ipynb", "repo_id": "langchainjs", "token_count": 2323 }
686
// 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/storage/binlog_iterator.go/0
{ "file_path": "milvus/internal/storage/binlog_iterator.go", "repo_id": "milvus", "token_count": 4049 }
1,868
import { MaskingParser, RegexMaskingTransformer, } from "langchain/experimental/masking"; // Define masking strategy const emailMask = () => `[email-${Math.random().toString(16).slice(2)}]`; const phoneMask = () => `[phone-${Math.random().toString(16).slice(2)}]`; // Configure pii transformer const piiMaskingTran...
langchainjs/examples/src/experimental/masking/basic.ts/0
{ "file_path": "langchainjs/examples/src/experimental/masking/basic.ts", "repo_id": "langchainjs", "token_count": 393 }
772
<!--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/multilingual.md/0
{ "file_path": "transformers/docs/source/it/multilingual.md", "repo_id": "transformers", "token_count": 3144 }
539
from langchain_community.chat_models import ChatOpenAI from langchain_community.embeddings import OpenAIEmbeddings from langchain_community.vectorstores import Chroma from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langchain_core.pydantic_v1 import Ba...
langchain/templates/hyde/hyde/chain.py/0
{ "file_path": "langchain/templates/hyde/hyde/chain.py", "repo_id": "langchain", "token_count": 785 }
657
__all__ = [ "BaseTracer", "EvaluatorCallbackHandler", "LangChainTracer", "ConsoleCallbackHandler", "Run", "RunLog", "RunLogPatch", "LogStreamCallbackHandler", ] from langchain_core.tracers.base import BaseTracer from langchain_core.tracers.evaluation import EvaluatorCallbackHandler from...
langchain/libs/core/langchain_core/tracers/__init__.py/0
{ "file_path": "langchain/libs/core/langchain_core/tracers/__init__.py", "repo_id": "langchain", "token_count": 206 }
398
"""Test Xinference embeddings.""" import time from typing import AsyncGenerator, Tuple import pytest_asyncio from langchain_community.embeddings import XinferenceEmbeddings @pytest_asyncio.fixture async def setup() -> AsyncGenerator[Tuple[str, str], None]: import xoscar as xo from xinference.deploy.supervi...
langchain/libs/community/tests/integration_tests/embeddings/test_xinference.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/embeddings/test_xinference.py", "repo_id": "langchain", "token_count": 835 }
352
[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 = ["GradioReActAgentPack"] contains_example = false import_path = "llama_index.packs.gradio_r...
llama_index/llama-index-packs/llama-index-packs-gradio-react-agent-chatbot/pyproject.toml/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-gradio-react-agent-chatbot/pyproject.toml", "repo_id": "llama_index", "token_count": 722 }
1,588
package writebuffer import ( "context" "fmt" "sync" "github.com/bits-and-blooms/bloom/v3" "github.com/cockroachdb/errors" "github.com/samber/lo" "go.uber.org/atomic" "go.uber.org/zap" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" "github.com/mil...
milvus/internal/datanode/writebuffer/write_buffer.go/0
{ "file_path": "milvus/internal/datanode/writebuffer/write_buffer.go", "repo_id": "milvus", "token_count": 7092 }
1,785
## Demo in node 1. `yarn dev` 2. visit `localhost:3000`
chroma/clients/js/examples/node/README.md/0
{ "file_path": "chroma/clients/js/examples/node/README.md", "repo_id": "chroma", "token_count": 23 }
30
package tasks import ( "container/ring" "time" ) func newMergeTaskQueue(group string) *mergeTaskQueue { return &mergeTaskQueue{ name: group, tasks: make([]Task, 0), cleanupTimestamp: time.Now(), } } type mergeTaskQueue struct { name string tasks []Task clean...
milvus/internal/querynodev2/tasks/queues.go/0
{ "file_path": "milvus/internal/querynodev2/tasks/queues.go", "repo_id": "milvus", "token_count": 1907 }
1,779
poetry_requirements( name="poetry", ) python_sources( interpreter_constraints=["==3.9.*", "==3.10.*"], )
llama_index/llama-index-integrations/llms/llama-index-llms-llama-api/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-llama-api/BUILD", "repo_id": "llama_index", "token_count": 55 }
1,401
# LlamaIndex Vector_Stores Integration: Azure AI Search
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/README.md", "repo_id": "llama_index", "token_count": 14 }
1,512
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/esm/test_modeling_esmfold.py/0
{ "file_path": "transformers/tests/models/esm/test_modeling_esmfold.py", "repo_id": "transformers", "token_count": 4347 }
784
// 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/unittest/test_utils/AssertUtils.h/0
{ "file_path": "milvus/internal/core/unittest/test_utils/AssertUtils.h", "repo_id": "milvus", "token_count": 2856 }
1,759
<jupyter_start><jupyter_text>Run Dreambooth fine-tuned models for Stable Diffusion using d🧨ffusers This notebook allows you to run Stable Diffusion concepts trained via Dreambooth using 🤗 Hugging Face [🧨 Diffusers library](https://github.com/huggingface/diffusers). Train your own using [here]() and navigate the [pub...
notebooks/diffusers/sd_dreambooth_inference.ipynb/0
{ "file_path": "notebooks/diffusers/sd_dreambooth_inference.ipynb", "repo_id": "notebooks", "token_count": 1238 }
297
"""Util that calls Merriam-Webster.""" import json from typing import Dict, Iterator, List, Optional from urllib.parse import quote import requests from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator from langchain_core.utils import get_from_dict_or_env MERRIAM_WEBSTER_API_URL = ( "https://www...
langchain/libs/community/langchain_community/utilities/merriam_webster.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/merriam_webster.py", "repo_id": "langchain", "token_count": 1568 }
300
""" Utility Tools for the Portkey Class. This file module contains a collection of utility functions designed to enhance the functionality and usability of the Portkey class """ from typing import TYPE_CHECKING, List from llama_index.legacy.core.llms.types import LLMMetadata from llama_index.legacy.llms.anthropic im...
llama_index/llama-index-legacy/llama_index/legacy/llms/portkey_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/portkey_utils.py", "repo_id": "llama_index", "token_count": 1903 }
1,683
<jupyter_start><jupyter_text>Bagel Vector Store If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-vector-stores-bagel !pip install llama-index import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getL...
llama_index/docs/examples/vector_stores/BagelAutoRetriever.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/BagelAutoRetriever.ipynb", "repo_id": "llama_index", "token_count": 1599 }
1,130
# Papers Loaders ## Arxiv Papers Loader This loader fetchs the text from the most relevant scientific papers on Arxiv specified by a search query (e.g. "Artificial Intelligence"). For each paper, the abstract is extracted and put in a separate document. The search query may be any string, Arxiv paper id, or a general...
llama_index/llama-index-integrations/readers/llama-index-readers-papers/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-papers/README.md", "repo_id": "llama_index", "token_count": 708 }
1,440
[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 = ["AirbyteCDKReader"] contains_example = false import_path = "llama_index.readers.airbyte_cd...
llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-cdk/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-cdk/pyproject.toml", "repo_id": "llama_index", "token_count": 653 }
1,364
# Installation <tokenizerslangcontent> <python> 🤗 Tokenizers is tested on Python 3.5+. You should install 🤗 Tokenizers in a [virtual environment](https://docs.python.org/3/library/venv.html). If you're unfamiliar with Python virtual environments, check out the [user guide](https://packaging.python.org/guides/instal...
tokenizers/docs/source-doc-builder/installation.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/installation.mdx", "repo_id": "tokenizers", "token_count": 554 }
430
# What is RL? A short recap [[what-is-rl]] In RL, we build an agent that can **make smart decisions**. For instance, an agent that **learns to play a video game.** Or a trading agent that **learns to maximize its benefits** by deciding on **what stocks to buy and when to sell.** <img src="https://huggingface.co/datas...
deep-rl-class/units/en/unit2/what-is-rl.mdx/0
{ "file_path": "deep-rl-class/units/en/unit2/what-is-rl.mdx", "repo_id": "deep-rl-class", "token_count": 525 }
158
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/pkg/tracer/tracer.go/0
{ "file_path": "milvus/pkg/tracer/tracer.go", "repo_id": "milvus", "token_count": 1032 }
1,895
import torch import torch.distributed from typing import Optional, List from transformers import AutoTokenizer, AutoModelForCausalLM from text_generation_server.models import CausalLM FIM_PREFIX = "<fim-prefix>" FIM_MIDDLE = "<fim-middle>" FIM_SUFFIX = "<fim-suffix>" FIM_PAD = "<fim-pad>" EOD = "<|endoftext|>" cla...
text-generation-inference/server/text_generation_server/models/santacoder.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/santacoder.py", "repo_id": "text-generation-inference", "token_count": 1176 }
405
# LlamaIndex Embeddings Integration: Huggingface Optimum Intel
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum-intel/README.md/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum-intel/README.md", "repo_id": "llama_index", "token_count": 16 }
1,242
from ..utils import deprecate from .transformers.prior_transformer import PriorTransformer, PriorTransformerOutput class PriorTransformerOutput(PriorTransformerOutput): deprecation_message = "Importing `PriorTransformerOutput` from `diffusers.models.prior_transformer` is deprecated and this will be removed in a f...
diffusers/src/diffusers/models/prior_transformer.py/0
{ "file_path": "diffusers/src/diffusers/models/prior_transformer.py", "repo_id": "diffusers", "token_count": 235 }
232
--- sidebar_position: 3 title: Querying a SQL DB hide_table_of_contents: true --- # Querying a SQL DB We can replicate our SQLDatabaseChain with Runnables. ## Setup We'll need the Chinook sample DB for this example. First install `typeorm`: ```bash npm2yarn npm install typeorm ``` Then install the dependencies n...
langchainjs/docs/core_docs/docs/expression_language/cookbook/sql_db.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/expression_language/cookbook/sql_db.mdx", "repo_id": "langchainjs", "token_count": 310 }
768
export const PREFIX = `Answer the following questions as best you can. You have access to the following tools:`; export const FORMAT_INSTRUCTIONS = `The way you use the tools is by specifying a json blob, denoted below by $JSON_BLOB Specifically, this $JSON_BLOB should have a "action" key (with the name of the tool to ...
langchainjs/langchain/src/agents/chat/prompt.ts/0
{ "file_path": "langchainjs/langchain/src/agents/chat/prompt.ts", "repo_id": "langchainjs", "token_count": 315 }
877
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/util/importutilv2/numpy/reader_test.go/0
{ "file_path": "milvus/internal/util/importutilv2/numpy/reader_test.go", "repo_id": "milvus", "token_count": 4508 }
1,940
# 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/cvt/convert_cvt_original_pytorch_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/cvt/convert_cvt_original_pytorch_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 6355 }
666
<jupyter_start><jupyter_text>Manipulation de plusieurs séquences (TensorFlow) Installez la bibliothèque 🤗 *Transformers* pour exécuter ce *notebook*.<jupyter_code>!pip install transformers[sentencepiece] import tensorflow as tf from transformers import AutoTokenizer, TFAutoModelForSequenceClassification checkpoint = ...
notebooks/course/fr/chapter2/section5_tf.ipynb/0
{ "file_path": "notebooks/course/fr/chapter2/section5_tf.ipynb", "repo_id": "notebooks", "token_count": 810 }
310
"""Utility code for runnables.""" from __future__ import annotations import ast import asyncio import inspect import textwrap from inspect import signature from itertools import groupby from typing import ( Any, AsyncIterable, Callable, Coroutine, Dict, Iterable, List, Mapping, Name...
langchain/libs/core/langchain_core/runnables/utils.py/0
{ "file_path": "langchain/libs/core/langchain_core/runnables/utils.py", "repo_id": "langchain", "token_count": 6420 }
423
import math import torch from typing import Optional, List, Tuple BLOCK_SIZE: int = 16 # Will be set in warmup CACHE_MANAGER: Optional["CacheManager"] = None class CacheManager: def __init__( self, num_blocks: int, num_layers: int, num_heads: int, head_size: int, ...
text-generation-inference/server/text_generation_server/models/cache_manager.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/cache_manager.py", "repo_id": "text-generation-inference", "token_count": 2033 }
413
// Original source: https://github.com/whitlockjc/json-refs/blob/master/dist/json-refs-min.js export const JsonRefs = (function (t) { var n = {}; function r(e) { if (n[e]) return n[e].exports; var o = (n[e] = { i: e, l: !1, exports: {} }); return t[e].call(o.exports, o, o.exports, r), (o.l = !0), o.exp...
langserve/langserve/playground/src/utils/json-refs.js/0
{ "file_path": "langserve/langserve/playground/src/utils/json-refs.js", "repo_id": "langserve", "token_count": 235354 }
1,032
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-localai/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-localai/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,360
import os import pytest from tokenizers import SentencePieceBPETokenizer, SentencePieceUnigramTokenizer class TestSentencePieceBPE: def test_train_from_iterator(self): text = ["A first sentence", "Another sentence", "And a last one"] tokenizer = SentencePieceBPETokenizer() tokenizer.trai...
tokenizers/bindings/python/tests/implementations/test_sentencepiece.py/0
{ "file_path": "tokenizers/bindings/python/tests/implementations/test_sentencepiece.py", "repo_id": "tokenizers", "token_count": 1122 }
465
[package] name = "candle-nn" version.workspace = true edition.workspace = true description.workspace = true repository.workspace = true keywords.workspace = true categories.workspace = true license.workspace = true readme = "README.md" [dependencies] accelerate-src = { workspace = true, optional = true } candle = { wo...
candle/candle-nn/Cargo.toml/0
{ "file_path": "candle/candle-nn/Cargo.toml", "repo_id": "candle", "token_count": 325 }
62
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-stripe-docs/llama_index/readers/stripe_docs/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-stripe-docs/llama_index/readers/stripe_docs/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,449
from llama_index.readers.mondaydotcom.base import MondayReader __all__ = ["MondayReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-mondaydotcom/llama_index/readers/mondaydotcom/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mondaydotcom/llama_index/readers/mondaydotcom/__init__.py", "repo_id": "llama_index", "token_count": 29 }
1,432
export * from "./chat_models.js"; export * from "./llms.js"; export * from "./embeddings.js";
langchainjs/libs/langchain-yandex/src/index.ts/0
{ "file_path": "langchainjs/libs/langchain-yandex/src/index.ts", "repo_id": "langchainjs", "token_count": 35 }
1,070
// 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/target.go/0
{ "file_path": "milvus/internal/querycoordv2/meta/target.go", "repo_id": "milvus", "token_count": 803 }
1,756
# Aleph Alpha >[Aleph Alpha](https://docs.aleph-alpha.com/) was founded in 2019 with the mission to research and build the foundational technology for an era of strong AI. The team of international scientists, engineers, and innovators researches, develops, and deploys transformative AI like large language and multimo...
langchain/docs/docs/integrations/providers/aleph_alpha.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/aleph_alpha.mdx", "repo_id": "langchain", "token_count": 337 }
125
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/pkg/eventlog/grpc_test.go/0
{ "file_path": "milvus/pkg/eventlog/grpc_test.go", "repo_id": "milvus", "token_count": 1818 }
1,913
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "schema/retriever", newEntrypointName: "retrievers", newPackageName: "@langchain/core", }); export * from "@langchain/core/retrievers";
langchainjs/langchain/src/schema/retriever.ts/0
{ "file_path": "langchainjs/langchain/src/schema/retriever.ts", "repo_id": "langchainjs", "token_count": 96 }
948
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use clap::{Parser, ValueEnum}; use candle::{DType, IndexOp, D}; use candle_nn::{Module, VarBuilder}; use candle_transformers::models::convnext; #[derive(Clone, Copy, Debug, ValueEnum)] enum Which { At...
candle/candle-examples/examples/convnext/main.rs/0
{ "file_path": "candle/candle-examples/examples/convnext/main.rs", "repo_id": "candle", "token_count": 1919 }
42
#include <metal_stdlib> using namespace metal; #define MAX(x, y) ((x) > (y) ? (x) : (y)) #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define SWAP(x, y) { auto tmp = (x); (x) = (y); (y) = tmp; } #define QK4_0 32 #define QR4_0 2 typedef struct { half d; // delta uint8_t qs[QK4_0 / 2]; // nibbles /...
candle/candle-metal-kernels/src/quantized.metal/0
{ "file_path": "candle/candle-metal-kernels/src/quantized.metal", "repo_id": "candle", "token_count": 97268 }
65
// 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/unittest/test_array.cpp/0
{ "file_path": "milvus/internal/core/unittest/test_array.cpp", "repo_id": "milvus", "token_count": 5143 }
1,674
from llama_index.core.llms import ChatMessage from llama_index.core.storage.chat_store import SimpleChatStore def test_add_messages() -> None: """Test adding messages to a chat store.""" chat_store = SimpleChatStore() chat_store.add_message("user1", ChatMessage(role="user", content="hello")) chat_sto...
llama_index/llama-index-core/tests/storage/chat_store/test_simple_chat_store.py/0
{ "file_path": "llama_index/llama-index-core/tests/storage/chat_store/test_simple_chat_store.py", "repo_id": "llama_index", "token_count": 989 }
1,327
[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 = ["GmailReader", "GoogleCalendarReader", "GoogleDocsReader", "GoogleDriveReader", "GoogleKee...
llama_index/llama-index-integrations/readers/llama-index-readers-google/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-google/pyproject.toml", "repo_id": "llama_index", "token_count": 790 }
1,408
import json import pytest from langchain_core.agents import AgentFinish from langchain_core.exceptions import OutputParserException from langchain_core.messages import AIMessage, SystemMessage from langchain.agents.openai_functions_multi_agent.base import ( _FunctionsAgentAction, _parse_ai_message, ) # Test...
langchain/libs/langchain/tests/unit_tests/agents/test_openai_functions_multi.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/agents/test_openai_functions_multi.py", "repo_id": "langchain", "token_count": 1341 }
619
import { Example, Run, ScoreType, ValueType } from "../schemas.js"; import { EvaluationResult, RunEvaluator } from "./evaluator.js"; export interface GradingFunctionResult { key?: string; score?: ScoreType; value?: ValueType; comment?: string; correction?: Record<string, unknown>; } export interface Grading...
langsmith-sdk/js/src/evaluation/string_evaluator.ts/0
{ "file_path": "langsmith-sdk/js/src/evaluation/string_evaluator.ts", "repo_id": "langsmith-sdk", "token_count": 667 }
1,026
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-node-parser-semantic-chunking/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-node-parser-semantic-chunking/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,859
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/deprecated/mctct/processing_mctct.py/0
{ "file_path": "transformers/src/transformers/models/deprecated/mctct/processing_mctct.py", "repo_id": "transformers", "token_count": 2272 }
645
import pytest import torch from transformers import AutoTokenizer from text_generation_server.models import Model def get_test_model(): class TestModel(Model): def batch_type(self): raise NotImplementedError def generate_token(self, batch): raise NotImplementedError ...
text-generation-inference/server/tests/models/test_model.py/0
{ "file_path": "text-generation-inference/server/tests/models/test_model.py", "repo_id": "text-generation-inference", "token_count": 829 }
400
"""Simple reader for mbox (mailbox) files.""" import os from pathlib import Path from typing import Any, List from llama_index.core.readers.base import BaseReader from llama_index.readers.file import MboxReader as MboxFileReader from llama_index.core.schema import Document class MboxReader(BaseReader): """Mbox ...
llama_index/llama-index-integrations/readers/llama-index-readers-mbox/llama_index/readers/mbox/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mbox/llama_index/readers/mbox/base.py", "repo_id": "llama_index", "token_count": 511 }
1,425
package allocator import ( "sync" "testing" "github.com/stretchr/testify/assert" ) func TestAtomicAllocator_AllocID(t *testing.T) { n := 100 alloc := NewAllocator() wg := &sync.WaitGroup{} for i := 0; i < n; i++ { wg.Add(1) go func() { defer wg.Done() _, err := alloc.AllocID() assert.NoError(t, e...
milvus/cmd/tools/migration/allocator/atomic_allocator_test.go/0
{ "file_path": "milvus/cmd/tools/migration/allocator/atomic_allocator_test.go", "repo_id": "milvus", "token_count": 216 }
1,895
.. _Ref-Response: Response ================= .. automodule:: llama_index.core.base.response.schema :members: :inherited-members:
llama_index/docs/api_reference/response.rst/0
{ "file_path": "llama_index/docs/api_reference/response.rst", "repo_id": "llama_index", "token_count": 49 }
1,085
from typing import Dict, Type from llama_index.core.node_parser.file.html import HTMLNodeParser from llama_index.core.node_parser.file.json import JSONNodeParser from llama_index.core.node_parser.file.markdown import MarkdownNodeParser from llama_index.core.node_parser.file.simple_file import SimpleFileNodeParser from...
llama_index/llama-index-core/llama_index/core/node_parser/loading.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/node_parser/loading.py", "repo_id": "llama_index", "token_count": 593 }
1,231
import logging from typing import Any, Iterator, List, Optional, Sequence from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader from langchain_community.document_loaders.news import NewsURLLoader logger = logging.getLogger(__name__) class RSSFeedLoader(BaseL...
langchain/libs/community/langchain_community/document_loaders/rss.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/rss.py", "repo_id": "langchain", "token_count": 2320 }
261
<jupyter_start><jupyter_text>Pinecone Vector Store If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-vector-stores-pinecone !pip install llama-index>=0.9.31 pinecone-client>=3.0.0 import logging import sys import os logging.basicConfig(stre...
llama_index/docs/examples/vector_stores/PineconeIndexDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/PineconeIndexDemo.ipynb", "repo_id": "llama_index", "token_count": 1052 }
1,084
import { updateEntrypointsFrom0_0_xTo0_1_x } from "@langchain/scripts/migrations"; await updateEntrypointsFrom0_0_xTo0_1_x({ // Path to the local langchainjs repository localLangChainPath: "/Users/my-profile/langchainjs", // Path to the repository where the migration should be applied codePath: "/Users/my-prof...
langchainjs/examples/src/guides/migrating.ts/0
{ "file_path": "langchainjs/examples/src/guides/migrating.ts", "repo_id": "langchainjs", "token_count": 113 }
869
package writebuffer import ( "fmt" "math/rand" "testing" "time" "github.com/samber/lo" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" "github.com/milvus-io/milvus-proto/go-api/...
milvus/internal/datanode/writebuffer/l0_write_buffer_test.go/0
{ "file_path": "milvus/internal/datanode/writebuffer/l0_write_buffer_test.go", "repo_id": "milvus", "token_count": 3827 }
1,794
# LlamaIndex Vector_Stores Integration: Astra
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-astra/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-astra/README.md", "repo_id": "llama_index", "token_count": 13 }
1,508
use metal::{ Buffer, CommandBufferRef, CompileOptions, ComputeCommandEncoderRef, ComputePipelineState, Device, Function, FunctionConstantValues, Library, MTLDataType, MTLSize, NSUInteger, }; use std::collections::HashMap; use std::ffi::c_void; use std::sync::RwLock; const AFFINE: &str = include_str!("affine.me...
candle/candle-metal-kernels/src/lib.rs/0
{ "file_path": "candle/candle-metal-kernels/src/lib.rs", "repo_id": "candle", "token_count": 25096 }
53