text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
[defaults] host_key_checking = False inventory = inventory.ini private_key_file=~/.ssh/id_ed25519
milvus/deployments/docker/cluster-distributed-deployment/ansible.cfg/0
{ "file_path": "milvus/deployments/docker/cluster-distributed-deployment/ansible.cfg", "repo_id": "milvus", "token_count": 34 }
1,623
import { CallbackManagerForToolRun } from "@langchain/core/callbacks/manager"; import { GoogleCalendarBase, GoogleCalendarAgentParams } from "./base.js"; import { VIEW_TOOL_DESCRIPTION } from "./descriptions.js"; import { runViewEvents } from "./commands/run-view-events.js"; /** * @example * ```typescript * const ...
langchainjs/libs/langchain-community/src/tools/google_calendar/view.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/google_calendar/view.ts", "repo_id": "langchainjs", "token_count": 513 }
1,016
import os import sys import pytest from llama_index.core.evaluation.eval_utils import upload_eval_dataset from llama_index_client.client import PlatformApi base_url = os.environ.get("LLAMA_CLOUD_BASE_URL", None) api_key = os.environ.get("LLAMA_CLOUD_API_KEY", None) python_version = sys.version @pytest.mark.skipif( ...
llama_index/llama-index-core/tests/evaluation/test_platform_eval.py/0
{ "file_path": "llama_index/llama-index-core/tests/evaluation/test_platform_eval.py", "repo_id": "llama_index", "token_count": 399 }
1,217
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
accelerate/examples/by_feature/automatic_gradient_accumulation.py/0
{ "file_path": "accelerate/examples/by_feature/automatic_gradient_accumulation.py", "repo_id": "accelerate", "token_count": 3689 }
7
import { ChatOpenAI } from "@langchain/openai"; import { PromptTemplate } from "@langchain/core/prompts"; const controller = new AbortController(); // Create a new LLMChain from a PromptTemplate and an LLM in streaming mode. const llm = new ChatOpenAI({ temperature: 0.9 }); const model = llm.bind({ signal: controller...
langchainjs/examples/src/guides/expression_language/how_to_cancellation.ts/0
{ "file_path": "langchainjs/examples/src/guides/expression_language/how_to_cancellation.ts", "repo_id": "langchainjs", "token_count": 253 }
806
import unittest from collections import namedtuple from typing import Any, Optional from unittest.mock import patch import pytest from langchain_community.document_loaders.trello import TrelloLoader def list_to_objects(dict_list: list) -> list: """Helper to convert dict objects.""" return [ namedtup...
langchain/libs/community/tests/unit_tests/document_loaders/test_trello.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_trello.py", "repo_id": "langchain", "token_count": 5641 }
373
"""Discord reader. Note: this file is named discord_reader.py to avoid conflicts with the discord.py module. """ import asyncio import logging import os from typing import List, Optional from llama_index.legacy.readers.base import BasePydanticReader from llama_index.legacy.schema import Document logger = logging.g...
llama_index/llama-index-legacy/llama_index/legacy/readers/discord_reader.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/discord_reader.py", "repo_id": "llama_index", "token_count": 2531 }
1,605
"""Test struct store indices.""" from typing import Any, Dict, List, Tuple from llama_index.legacy.indices.list.base import SummaryIndex from llama_index.legacy.indices.struct_store.sql import ( SQLContextContainerBuilder, SQLStructStoreIndex, ) from llama_index.legacy.indices.struct_store.sql_query import ( ...
llama_index/llama-index-legacy/tests/indices/struct_store/test_base.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/struct_store/test_base.py", "repo_id": "llama_index", "token_count": 4675 }
1,634
# coding=utf-8 # Copyright 2023 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...
transformers/src/transformers/models/resnet/modeling_flax_resnet.py/0
{ "file_path": "transformers/src/transformers/models/resnet/modeling_flax_resnet.py", "repo_id": "transformers", "token_count": 10373 }
688
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,185
# Copyright 2024 Salesforce.com, inc. # Copyright 2024 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/LICENS...
diffusers/src/diffusers/pipelines/blip_diffusion/modeling_ctx_clip.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/blip_diffusion/modeling_ctx_clip.py", "repo_id": "diffusers", "token_count": 3809 }
248
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-postgres/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-postgres/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,494
"""Firestore Reader.""" from typing import Any, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document DEFAULT_FIRESTORE_DATABASE = "(default)" USER_AGENT = "LlamaHub" IMPORT_ERROR_MSG = ( "`firestore` package not found, please run `pip3 install google-cl...
llama_index/llama-index-integrations/readers/llama-index-readers-firestore/llama_index/readers/firestore/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-firestore/llama_index/readers/firestore/base.py", "repo_id": "llama_index", "token_count": 1239 }
1,300
<jupyter_start><jupyter_text>LM Format Enforcer[LM Format Enforcer](https://github.com/noamgat/lm-format-enforcer) is a library that enforces the output format of language models by filtering tokens.It works by combining a character level parser with a tokenizer prefix tree to allow only the tokens which contains seque...
langchain/docs/docs/integrations/llms/lmformatenforcer_experimental.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/lmformatenforcer_experimental.ipynb", "repo_id": "langchain", "token_count": 2295 }
120
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/flat/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/flat/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,400
package notification import ( "context" "reflect" "testing" "github.com/chroma/chroma-coordinator/internal/metastore/db/dbmodel" "github.com/chroma/chroma-coordinator/internal/metastore/db/dbmodel/mocks" "github.com/chroma/chroma-coordinator/internal/model" "github.com/stretchr/testify/mock" ) func TestDataba...
chroma/go/coordinator/internal/notification/database_notification_store_test.go/0
{ "file_path": "chroma/go/coordinator/internal/notification/database_notification_store_test.go", "repo_id": "chroma", "token_count": 2402 }
49
import inspect from copy import deepcopy from functools import update_wrapper from types import MethodType from .peft_model import PeftModel def update_forward_signature(model: PeftModel) -> None: """ Args: Updates the forward signature of the PeftModel to include parents class signature model (`...
peft/src/peft/helpers.py/0
{ "file_path": "peft/src/peft/helpers.py", "repo_id": "peft", "token_count": 1690 }
343
// 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/ThreadPools.cpp/0
{ "file_path": "milvus/internal/core/src/storage/ThreadPools.cpp", "repo_id": "milvus", "token_count": 701 }
1,745
README.Debian README.source
milvus/build/deb/debian/milvus-docs.docs/0
{ "file_path": "milvus/build/deb/debian/milvus-docs.docs", "repo_id": "milvus", "token_count": 11 }
1,887
<jupyter_start><jupyter_text>Docs | GitHub | Community TruLens-Eval LlamaPackTruLens provides three Llamma Packs for LLM app observability:- The first is the **RAG Triad Pack** (context relevance, groundedness, answer relevance). This triad holds the key to detecting hallucination.- Secon...
llama_index/llama-index-packs/llama-index-packs-trulens-eval-packs/examples/trulens_eval_llama_packs.ipynb/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-trulens-eval-packs/examples/trulens_eval_llama_packs.ipynb", "repo_id": "llama_index", "token_count": 1788 }
1,682
import * as uuid from "uuid"; import { BaseRun, KVMap, RunCreate, RunUpdate } from "./schemas.js"; import { getEnvironmentVariable, getRuntimeEnvironment } from "./utils/env.js"; import { Client } from "./client.js"; const warnedMessages: Record<string, boolean> = {}; function warnOnce(message: string): void { if (...
langsmith-sdk/js/src/run_trees.ts/0
{ "file_path": "langsmith-sdk/js/src/run_trees.ts", "repo_id": "langsmith-sdk", "token_count": 2313 }
1,146
import json from typing import Any import requests from bs4 import BeautifulSoup from langchain.retrievers.tavily_search_api import TavilySearchAPIRetriever from langchain_community.chat_models import ChatOpenAI from langchain_community.utilities import DuckDuckGoSearchAPIWrapper from langchain_core.messages import Sy...
langchain/templates/research-assistant/research_assistant/search/web.py/0
{ "file_path": "langchain/templates/research-assistant/research_assistant/search/web.py", "repo_id": "langchain", "token_count": 2237 }
727
# Fine-tuning ## Overview Finetuning a model means updating the model itself over a set of data to improve the model in a variety of ways. This can include improving the quality of outputs, reducing hallucinations, memorizing more data holistically, and reducing latency/cost. The core of our toolkit revolves around ...
llama_index/docs/optimizing/fine-tuning/fine-tuning.md/0
{ "file_path": "llama_index/docs/optimizing/fine-tuning/fine-tuning.md", "repo_id": "llama_index", "token_count": 2604 }
1,185
"""Tree-based index.""" from enum import Enum from typing import Any, Dict, Optional, Sequence, Union from llama_index.legacy.core.base_retriever import BaseRetriever # from llama_index.legacy.data_structs.data_structs import IndexGraph from llama_index.legacy.data_structs.data_structs import IndexGraph from llama_i...
llama_index/llama-index-legacy/llama_index/legacy/indices/tree/base.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/tree/base.py", "repo_id": "llama_index", "token_count": 2999 }
1,606
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/data_structs/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/data_structs/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,586
import { Document } from "@langchain/core/documents"; import { BaseDocumentLoader } from "../base.js"; import { formatDocumentsAsString } from "../../util/document.js"; /** * A document loader for loading data from PDFs. * @example * ```typescript * const loader = new WebPDFLoader(new Blob()); * const docs = awai...
langchainjs/langchain/src/document_loaders/web/pdf.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/web/pdf.ts", "repo_id": "langchainjs", "token_count": 1519 }
912
from langchain_community.vectorstores.docarray.base import ( DocArrayIndex, ) __all__ = ["DocArrayIndex"]
langchain/libs/langchain/langchain/vectorstores/docarray/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/docarray/base.py", "repo_id": "langchain", "token_count": 37 }
581
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-firestore/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-firestore/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,467
package utils import ( "io" "github.com/rs/zerolog/log" ) func RunProcess(startProcess func() (io.Closer, error)) { process, err := startProcess() if err != nil { log.Fatal().Err(err). Msg("Failed to start the process") } WaitUntilSignal( process, ) }
chroma/go/coordinator/internal/utils/run.go/0
{ "file_path": "chroma/go/coordinator/internal/utils/run.go", "repo_id": "chroma", "token_count": 110 }
52
// 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/condition_test.go/0
{ "file_path": "milvus/internal/proxy/condition_test.go", "repo_id": "milvus", "token_count": 1066 }
1,843
use crate::decoders::DecoderWrapper; use crate::tokenizer::{Decoder, Result}; use crate::utils::macro_rules_attribute; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug)] #[macro_rules_attribute(impl_serde_type!)] pub struct Sequence { decoders: Vec<DecoderWrapper>, } impl Sequence { pub fn new(decod...
tokenizers/tokenizers/src/decoders/sequence.rs/0
{ "file_path": "tokenizers/tokenizers/src/decoders/sequence.rs", "repo_id": "tokenizers", "token_count": 600 }
417
<jupyter_start><jupyter_code>!wget https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-uncased-vocab.txt -O /tmp/bert-base-uncased-vocab.txt from tokenizers import BertWordPieceTokenizer from tokenizers.tools import EncodingVisualizer EncodingVisualizer.unk_token_regex.search("aaa[udsnk]aaa") text = """Mathi...
tokenizers/bindings/python/examples/using_the_visualizer.ipynb/0
{ "file_path": "tokenizers/bindings/python/examples/using_the_visualizer.ipynb", "repo_id": "tokenizers", "token_count": 1221 }
420
# coding=utf-8 # Copyright 2024 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...
diffusers/utils/check_doc_toc.py/0
{ "file_path": "diffusers/utils/check_doc_toc.py", "repo_id": "diffusers", "token_count": 2177 }
283
python_sources()
llama_index/llama-index-core/tests/agent/openai/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/agent/openai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,147
"""Chain for interacting with SQL Database.""" from langchain_experimental.sql.base import SQLDatabaseChain, SQLDatabaseSequentialChain __all__ = ["SQLDatabaseChain", "SQLDatabaseSequentialChain"]
langchain/libs/experimental/langchain_experimental/sql/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/sql/__init__.py", "repo_id": "langchain", "token_count": 49 }
437
#!/usr/bin/env python3 """ ImageNet Validation Script This is intended to be a lean and easily modifiable ImageNet validation script for evaluating pretrained models or training checkpoints against ImageNet or similarly organized image datasets. It prioritizes canonical PyTorch, standard Python style, and good perform...
pytorch-image-models/validate.py/0
{ "file_path": "pytorch-image-models/validate.py", "repo_id": "pytorch-image-models", "token_count": 9310 }
415
#!/usr/bin/env python # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
transformers/src/transformers/tools/text_summarization.py/0
{ "file_path": "transformers/src/transformers/tools/text_summarization.py", "repo_id": "transformers", "token_count": 560 }
784
# coding=utf-8 # Copyright 2024 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/siglip/test_modeling_siglip.py/0
{ "file_path": "transformers/tests/models/siglip/test_modeling_siglip.py", "repo_id": "transformers", "token_count": 11438 }
823
# Simple Milvus systemd service file # # systemd supports lots of fancy features, look here (and linked docs) for a full list: # http://www.freedesktop.org/software/systemd/man/systemd.exec.html # # Note: this file ( /usr/lib/systemd/system/milvus.service ) # will be overwritten on package upgrade, please copy the fi...
milvus/build/rpm/services/milvus.service/0
{ "file_path": "milvus/build/rpm/services/milvus.service", "repo_id": "milvus", "token_count": 319 }
1,716
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/rootcoord/drop_collection_task.go/0
{ "file_path": "milvus/internal/rootcoord/drop_collection_task.go", "repo_id": "milvus", "token_count": 1522 }
2,001
from typing import Callable, Dict, Optional from pydantic import BaseModel from langsmith.evaluation.evaluator import EvaluationResult, RunEvaluator from langsmith.schemas import Example, Run class StringEvaluator(RunEvaluator, BaseModel): """Grades the run's string input, output, and optional answer.""" e...
langsmith-sdk/python/langsmith/evaluation/string_evaluator.py/0
{ "file_path": "langsmith-sdk/python/langsmith/evaluation/string_evaluator.py", "repo_id": "langsmith-sdk", "token_count": 535 }
1,071
insert_performance: collections: - milvus: cache_config.cpu_cache_capacity: 8GB engine_config.use_blas_threshold: 1100 gpu_resource_config.enable: false gpu_resource_config.cache_capacity: 4GB gpu_resource_config.search_resources: - gpu0 gpu_resource...
milvus/tests/benchmark/milvus_benchmark/suites/011_insert_performance.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/011_insert_performance.yaml", "repo_id": "milvus", "token_count": 1657 }
2,089
from llama_index.embeddings.anyscale.base import AnyscaleEmbedding __all__ = ["AnyscaleEmbedding"]
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-anyscale/llama_index/embeddings/anyscale/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-anyscale/llama_index/embeddings/anyscale/__init__.py", "repo_id": "llama_index", "token_count": 37 }
1,174
// 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/manager.go/0
{ "file_path": "milvus/internal/querynodev2/segments/manager.go", "repo_id": "milvus", "token_count": 5032 }
1,874
from langchain_community.utilities.openweathermap import OpenWeatherMapAPIWrapper __all__ = ["OpenWeatherMapAPIWrapper"]
langchain/libs/langchain/langchain/utilities/openweathermap.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/openweathermap.py", "repo_id": "langchain", "token_count": 34 }
564
import type { BaseRetrieverInterface } from "@langchain/core/retrievers"; import { z } from "zod"; import { CallbackManagerForToolRun } from "@langchain/core/callbacks/manager"; import { DynamicStructuredTool, DynamicStructuredToolInput, } from "@langchain/core/tools"; import { formatDocumentsAsString } from "../.....
langchainjs/langchain/src/agents/toolkits/conversational_retrieval/tool.ts/0
{ "file_path": "langchainjs/langchain/src/agents/toolkits/conversational_retrieval/tool.ts", "repo_id": "langchainjs", "token_count": 331 }
919
import pytest from typing import List, cast from chromadb.api.types import EmbeddingFunction, Documents, Image, Document, Embeddings import numpy as np def random_embeddings() -> Embeddings: return cast(Embeddings, np.random.random(size=(10, 10)).tolist()) def random_image() -> Image: return np.random.randi...
chroma/chromadb/test/api/test_types.py/0
{ "file_path": "chroma/chromadb/test/api/test_types.py", "repo_id": "chroma", "token_count": 455 }
20
Condense Plus Context Chat Engine ======================= .. automodule:: llama_index.core.chat_engine.condense_plus_context :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper
llama_index/docs/api_reference/query/chat_engines/condense_plus_context_chat_engine.rst/0
{ "file_path": "llama_index/docs/api_reference/query/chat_engines/condense_plus_context_chat_engine.rst", "repo_id": "llama_index", "token_count": 84 }
1,037
from langchain_core.messages import AIMessage, ToolMessage from langchain.agents.format_scratchpad.openai_tools import ( format_to_openai_tool_messages, ) from langchain.agents.output_parsers.openai_tools import ( parse_ai_message_to_openai_tool_action, ) def test_calls_convert_agent_action_to_messages() -> ...
langchain/libs/langchain/tests/unit_tests/agents/format_scratchpad/test_openai_tools.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/agents/format_scratchpad/test_openai_tools.py", "repo_id": "langchain", "token_count": 1483 }
645
from langchain_community.utilities.google_lens import GoogleLensAPIWrapper __all__ = ["GoogleLensAPIWrapper"]
langchain/libs/langchain/langchain/utilities/google_lens.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/google_lens.py", "repo_id": "langchain", "token_count": 33 }
565
#!/usr/bin/env python # coding=utf-8 # 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...
transformers/examples/tensorflow/summarization/run_summarization.py/0
{ "file_path": "transformers/examples/tensorflow/summarization/run_summarization.py", "repo_id": "transformers", "token_count": 13841 }
610
use worker::worker_entrypoint; #[tokio::main] async fn main() { worker_entrypoint().await; }
chroma/rust/worker/src/bin/worker.rs/0
{ "file_path": "chroma/rust/worker/src/bin/worker.rs", "repo_id": "chroma", "token_count": 40 }
56
#!/bin/bash # Exit immediately for non zero status set -e ns_name=$1 instance_name=$2 log_dir=${3:-"k8s_logs"} #show proxy pod log array=($(kubectl get pod -n ${ns_name} -l "component=proxy, app.kubernetes.io/instance=${instance_name}"| awk 'NR == 1 {next} {print $1}')) echo ${array[@]} for pod in ${array[*]} do ec...
milvus/tests/scripts/export_log_k8s.sh/0
{ "file_path": "milvus/tests/scripts/export_log_k8s.sh", "repo_id": "milvus", "token_count": 1010 }
2,012
from collections import deque from itertools import islice from typing import ( Any, ContextManager, Deque, Generator, Generic, Iterable, Iterator, List, Optional, Tuple, TypeVar, Union, overload, ) from typing_extensions import Literal T = TypeVar("T") class NoLo...
langchain/libs/core/langchain_core/utils/iter.py/0
{ "file_path": "langchain/libs/core/langchain_core/utils/iter.py", "repo_id": "langchain", "token_count": 2475 }
400
<jupyter_start><jupyter_text>NLP Cloud>[NLP Cloud](https://docs.nlpcloud.com/introduction) is an artificial intelligence platform that allows you to use the most advanced AI engines, and even train your own engines with your own data. The [embeddings](https://docs.nlpcloud.com/embeddings) endpoint offers the following ...
langchain/docs/docs/integrations/text_embedding/nlp_cloud.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/nlp_cloud.ipynb", "repo_id": "langchain", "token_count": 284 }
171
import asyncio import math import time from concurrent.futures import ThreadPoolExecutor from typing import AsyncIterator from langchain_core.tracers.memory_stream import _MemoryStream async def test_same_event_loop() -> None: """Test that the memory stream works when the same event loop is used. This is th...
langchain/libs/core/tests/unit_tests/tracers/test_memory_stream.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/tracers/test_memory_stream.py", "repo_id": "langchain", "token_count": 1753 }
409
"""Util that calls Google Search using the Serper.dev API.""" from typing import Any, Dict, List, Optional import aiohttp import requests from langchain_core.pydantic_v1 import BaseModel, root_validator from langchain_core.utils import get_from_dict_or_env from typing_extensions import Literal class GoogleSerperAPIW...
langchain/libs/community/langchain_community/utilities/google_serper.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/google_serper.py", "repo_id": "langchain", "token_count": 3022 }
316
"""**Graphs** provide a natural language interface to graph databases.""" import warnings from typing import Any from langchain_core._api import LangChainDeprecationWarning from langchain.utils.interactive_env import is_interactive_env def __getattr__(name: str) -> Any: from langchain_community import graphs ...
langchain/libs/langchain/langchain/graphs/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/graphs/__init__.py", "repo_id": "langchain", "token_count": 424 }
514
<jupyter_start><jupyter_text>Traduction (PyTorch) Installez les bibliothèques 🤗 *Datasets* et 🤗 *Transformers* pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece] !pip install accelerate # Pour exécuter l'entraînement sur TPU, vous devez décommenter la ligne suivante : # !pip i...
notebooks/course/fr/chapter7/section4_pt.ipynb/0
{ "file_path": "notebooks/course/fr/chapter7/section4_pt.ipynb", "repo_id": "notebooks", "token_count": 3791 }
302
<jupyter_start><jupyter_text>Human in the LoopIn this notebook we will go over how to add a human-in-the-loop workflow to the base agent executor. We will use the human to approveThis examples builds off the base agent executor. It is highly recommended you learn about that executor before going through this notebook. ...
langgraph/examples/agent_executor/human-in-the-loop.ipynb/0
{ "file_path": "langgraph/examples/agent_executor/human-in-the-loop.ipynb", "repo_id": "langgraph", "token_count": 2541 }
1,073
"""Output parsers.""" from llama_index.core.output_parsers.base import ChainableOutputParser from llama_index.core.output_parsers.langchain import LangchainOutputParser from llama_index.core.output_parsers.pydantic import PydanticOutputParser from llama_index.core.output_parsers.selection import SelectionOutputParser ...
llama_index/llama-index-core/llama_index/core/output_parsers/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/output_parsers/__init__.py", "repo_id": "llama_index", "token_count": 146 }
1,234
# coding=utf-8 # Copyright 2018 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 a...
transformers/examples/pytorch/old_test_xla_examples.py/0
{ "file_path": "transformers/examples/pytorch/old_test_xla_examples.py", "repo_id": "transformers", "token_count": 1245 }
531
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/models/opt/test_modeling_flax_opt.py/0
{ "file_path": "transformers/tests/models/opt/test_modeling_flax_opt.py", "repo_id": "transformers", "token_count": 7181 }
816
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/custom_models.md/0
{ "file_path": "transformers/docs/source/en/custom_models.md", "repo_id": "transformers", "token_count": 4867 }
446
python_tests()
llama_index/llama-index-packs/llama-index-packs-cogniswitch-agent/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-cogniswitch-agent/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,648
package syncmgr import ( "testing" "time" "github.com/stretchr/testify/suite" "go.uber.org/atomic" ) /* type mockTask struct { targetID int64 ch chan struct{} err error } func (t *mockTask) done() { close(t.ch) } func (t *mockTask) CalcTargetSegment() (int64, error) { return t.targetID, t.err }...
milvus/internal/datanode/syncmgr/key_lock_dispatcher_test.go/0
{ "file_path": "milvus/internal/datanode/syncmgr/key_lock_dispatcher_test.go", "repo_id": "milvus", "token_count": 873 }
1,701
import CodeBlock from "@theme/CodeBlock"; # Custom list parser This output parser can be used when you want to return a list of items with a specific length and separator. import CustomList from "@examples/prompts/custom_list_parser_sequence.ts"; import IntegrationInstallTooltip from "@mdx_components/integration_in...
langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/types/custom_list_parser.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/types/custom_list_parser.mdx", "repo_id": "langchainjs", "token_count": 148 }
738
from neo4j_parent.chain import chain __all__ = ["chain"]
langchain/templates/neo4j-parent/neo4j_parent/__init__.py/0
{ "file_path": "langchain/templates/neo4j-parent/neo4j_parent/__init__.py", "repo_id": "langchain", "token_count": 20 }
676
from langchain.prompts.chat import __all__ EXPECTED_ALL = [ "MessageLike", "MessageLikeRepresentation", "MessagePromptTemplateT", "AIMessagePromptTemplate", "BaseChatPromptTemplate", "BaseMessagePromptTemplate", "BaseStringMessagePromptTemplate", "ChatMessagePromptTemplate", "ChatPr...
langchain/libs/langchain/tests/unit_tests/prompts/test_chat.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/prompts/test_chat.py", "repo_id": "langchain", "token_count": 235 }
635
import { ChatOpenAI } from "@langchain/openai"; import { HumanMessage } from "@langchain/core/messages"; const model = new ChatOpenAI({ temperature: 0.9, openAIApiKey: "YOUR-API-KEY", // In Node.js defaults to process.env.OPENAI_API_KEY }); // You can also pass tools or functions to the model, learn more here // ...
langchainjs/examples/src/models/chat/integration_openai.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/integration_openai.ts", "repo_id": "langchainjs", "token_count": 819 }
832
use crate::WithDType; use cudarc; use cudarc::cudnn::safe::{Conv2dForward, Cudnn}; use cudarc::driver::{CudaSlice, CudaView, DeviceRepr, ValidAsZeroBits}; use std::cell::RefCell; use std::collections::HashMap; use std::sync::Arc; // The cudnn handles are stored per thread here rather than on the CudaDevice as they are...
candle/candle-core/src/cudnn.rs/0
{ "file_path": "candle/candle-core/src/cudnn.rs", "repo_id": "candle", "token_count": 2214 }
35
python_sources()
llama_index/llama-index-packs/llama-index-packs-fusion-retriever/examples/query_rewrite/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-fusion-retriever/examples/query_rewrite/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,701
/* eslint-disable import/first */ import { z } from "zod"; import { DynamicStructuredTool } from "@langchain/core/tools"; const complexTool = new DynamicStructuredTool({ name: "complex_tool", description: "Do something complex with a complex tool.", schema: z.object({ intArg: z.number(), floatArg2: z.num...
langchainjs/examples/src/use_cases/tool_use/tool_error_handling_fallbacks.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/tool_use/tool_error_handling_fallbacks.ts", "repo_id": "langchainjs", "token_count": 668 }
891
import { ScrollArea, Select, Slider, Stack, Text } from "@mantine/core"; import React from "react"; import { Form } from "../utils/types"; import { Controller, useForm } from "react-hook-form"; const Sidebar = ({ form }: { form: Form }) => { const { control, setValue } = form; return ( <> <ScrollArea sc...
auto-evaluator/nextjs/components/Sidebar.tsx/0
{ "file_path": "auto-evaluator/nextjs/components/Sidebar.tsx", "repo_id": "auto-evaluator", "token_count": 4828 }
1
from __future__ import annotations import uuid import warnings from typing import ( TYPE_CHECKING, Any, Dict, Iterable, List, Mapping, Optional, Tuple, Union, ) from langchain_core._api import deprecated from langchain_core.documents import Document from langchain_core.embeddings i...
langchain/libs/community/langchain_community/vectorstores/elastic_vector_search.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/elastic_vector_search.py", "repo_id": "langchain", "token_count": 12739 }
336
<jupyter_start><jupyter_text>Connect to templateIn `server.py`, set -```add_routes(app, chain_ext, path="/rag_pinecone")```<jupyter_code>from langserve.client import RemoteRunnable rag_app_pinecone = RemoteRunnable("http://0.0.0.0:8001/rag_pinecone") rag_app_pinecone.invoke("How does agent memory work?")<jupyter_outpu...
langchain/templates/rag-pinecone/rag_pinecone.ipynb/0
{ "file_path": "langchain/templates/rag-pinecone/rag_pinecone.ipynb", "repo_id": "langchain", "token_count": 129 }
669
// A segment ingestor is a component that ingests embeddings into a segment // Its designed to consume from a async_channel that guarantees exclusive consumption // They are spawned onto a dedicated thread runtime since ingesting is cpu bound use async_trait::async_trait; use std::{fmt::Debug, sync::Arc}; use crate::...
chroma/rust/worker/src/segment/segment_ingestor.rs/0
{ "file_path": "chroma/rust/worker/src/segment/segment_ingestor.rs", "repo_id": "chroma", "token_count": 500 }
57
# python-lint This agent specializes in generating high-quality Python code with a focus on proper formatting and linting. It uses `black`, `ruff`, and `mypy` to ensure the code meets standard quality checks. This streamlines the coding process by integrating and responding to these checks, resulting in reliable and ...
langchain/templates/python-lint/README.md/0
{ "file_path": "langchain/templates/python-lint/README.md", "repo_id": "langchain", "token_count": 708 }
710
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/rootcoord/step_test.go/0
{ "file_path": "milvus/internal/rootcoord/step_test.go", "repo_id": "milvus", "token_count": 1160 }
1,857
# MnasNet **MnasNet** is a type of convolutional neural network optimized for mobile devices that is discovered through mobile neural architecture search, which explicitly incorporates model latency into the main objective so that the search can identify a model that achieves a good trade-off between accuracy and late...
pytorch-image-models/hfdocs/source/models/mnasnet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/mnasnet.mdx", "repo_id": "pytorch-image-models", "token_count": 2101 }
379
# Copyright 2024 TSAIL Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
diffusers/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py/0
{ "file_path": "diffusers/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py", "repo_id": "diffusers", "token_count": 20646 }
276
import { logVersion010MigrationWarning } from "../../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "stores/message/ioredis", }); export * from "@langchain/community/stores/message/ioredis";
langchainjs/langchain/src/stores/message/ioredis.ts/0
{ "file_path": "langchainjs/langchain/src/stores/message/ioredis.ts", "repo_id": "langchainjs", "token_count": 77 }
969
from elastic_query_generator.chain import chain if __name__ == "__main__": print(chain.invoke({"input": "how many customers named Carol"})) # noqa: T201
langchain/templates/elastic-query-generator/main.py/0
{ "file_path": "langchain/templates/elastic-query-generator/main.py", "repo_id": "langchain", "token_count": 52 }
642
# langchain-nomic This package contains the LangChain integration with Nomic ## Installation ```bash pip install -U langchain-nomic ``` And you should configure credentials by setting the following environment variables: * `NOMIC_API_KEY`: your nomic API key ## Embeddings `NomicEmbeddings` class exposes embeddin...
langchain/libs/partners/nomic/README.md/0
{ "file_path": "langchain/libs/partners/nomic/README.md", "repo_id": "langchain", "token_count": 144 }
649
"""Retriever wrapper for Google Cloud Document AI Warehouse.""" from typing import TYPE_CHECKING, Any, Dict, List, Optional from langchain_core.callbacks import CallbackManagerForRetrieverRun from langchain_core.documents import Document from langchain_core.pydantic_v1 import root_validator from langchain_core.retriev...
langchain/libs/community/langchain_community/retrievers/google_cloud_documentai_warehouse.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/google_cloud_documentai_warehouse.py", "repo_id": "langchain", "token_count": 1847 }
286
<jupyter_start><jupyter_text>SingleStoreDBThis notebook goes over how to use SingleStoreDB to store chat message history.<jupyter_code>from langchain.memory import SingleStoreDBChatMessageHistory history = SingleStoreDBChatMessageHistory( session_id="foo", host="root:pass@localhost:3306/db" ) history.add_user_mes...
langchain/docs/docs/integrations/memory/singlestoredb_chat_message_history.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/memory/singlestoredb_chat_message_history.ipynb", "repo_id": "langchain", "token_count": 134 }
125
<jupyter_start><jupyter_text>Unstructured FileThis notebook covers how to use `Unstructured` package to load files of many types. `Unstructured` currently supports loading of text files, powerpoints, html, pdfs, images, and more.<jupyter_code># # Install package %pip install --upgrade --quiet "unstructured[all-docs]" ...
langchain/docs/docs/integrations/document_loaders/unstructured_file.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/unstructured_file.ipynb", "repo_id": "langchain", "token_count": 1545 }
108
import hashlib from typing import List import numpy as np from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseModel class FakeEmbeddings(Embeddings, BaseModel): """Fake embedding model.""" size: int """The size of the embedding vector.""" def _get_embedding(s...
langchain/libs/community/langchain_community/embeddings/fake.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/fake.py", "repo_id": "langchain", "token_count": 568 }
267
// 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/core/src/common/Promise.h/0
{ "file_path": "milvus/internal/core/src/common/Promise.h", "repo_id": "milvus", "token_count": 870 }
1,919
src/load/import_type.ts
langchainjs/langchain-core/.prettierignore/0
{ "file_path": "langchainjs/langchain-core/.prettierignore", "repo_id": "langchainjs", "token_count": 9 }
892
# LlamaIndex Tools Integration: Google
llama_index/llama-index-integrations/tools/llama-index-tools-google/README.md/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-google/README.md", "repo_id": "llama_index", "token_count": 9 }
1,620
from llama_index.core.llms.base import BaseLLM from llama_index.llms.vllm import Vllm def test_embedding_class(): names_of_base_classes = [b.__name__ for b in Vllm.__mro__] assert BaseLLM.__name__ in names_of_base_classes
llama_index/llama-index-integrations/llms/llama-index-llms-vllm/tests/test_llms_vllm.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-vllm/tests/test_llms_vllm.py", "repo_id": "llama_index", "token_count": 94 }
1,284
import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( "kwargs, expected", [ ({"num_shards": 0, "max_num_jobs": 1}, []), ({"num_shards": 10, "max_num_jobs": 1}, [range(10)]), ({"num_shards": 10...
datasets/tests/test_sharding_utils.py/0
{ "file_path": "datasets/tests/test_sharding_utils.py", "repo_id": "datasets", "token_count": 977 }
146
"""Tests for the Playwright URL loader""" from typing import TYPE_CHECKING from langchain_community.document_loaders import PlaywrightURLLoader from langchain_community.document_loaders.url_playwright import PlaywrightEvaluator if TYPE_CHECKING: from playwright.async_api import Browser as AsyncBrowser from pl...
langchain/libs/community/tests/integration_tests/document_loaders/test_url_playwright.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_url_playwright.py", "repo_id": "langchain", "token_count": 1141 }
328
package segments /* #cgo pkg-config: milvus_segcore milvus_common #include "segcore/collection_c.h" #include "segcore/segment_c.h" #include "segcore/segcore_init_c.h" #include "common/init_c.h" */ import "C" import ( "bytes" "context" "encoding/binary" "fmt" "io" "strconv" "github.com/golang/protobuf/proto"...
milvus/internal/querynodev2/segments/utils.go/0
{ "file_path": "milvus/internal/querynodev2/segments/utils.go", "repo_id": "milvus", "token_count": 3906 }
2,050
"""Util that calls you.com Search API. In order to set this up, follow instructions at: """ import json from typing import Any, Dict, List, Literal, Optional import aiohttp import requests from langchain_core.documents import Document from langchain_core.pydantic_v1 import BaseModel, Field, root_validator from langch...
langchain/libs/community/langchain_community/utilities/you.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/you.py", "repo_id": "langchain", "token_count": 3465 }
332
from .open_clip import OpenCLIPEmbeddings __all__ = ["OpenCLIPEmbeddings"]
langchain/libs/experimental/langchain_experimental/open_clip/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/open_clip/__init__.py", "repo_id": "langchain", "token_count": 27 }
444
// 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/core/src/storage/OpenDALChunkManager.cpp/0
{ "file_path": "milvus/internal/core/src/storage/OpenDALChunkManager.cpp", "repo_id": "milvus", "token_count": 3423 }
1,744
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/model_doc/ctrl.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/ctrl.md", "repo_id": "transformers", "token_count": 2118 }
496
use candle::backend::BackendStorage; use candle::{CpuStorage, CustomOp1, DType, Device, IndexOp, Layout, Result, Shape, Tensor, D}; use candle_nn::{Embedding, Linear, Module, RmsNorm}; use cudarc::nccl::safe::{Comm, ReduceOp}; use half::f16; use serde::Deserialize; use std::rc::Rc; use std::sync::{Arc, Mutex}; use sup...
candle/candle-examples/examples/llama_multiprocess/model.rs/0
{ "file_path": "candle/candle-examples/examples/llama_multiprocess/model.rs", "repo_id": "candle", "token_count": 7542 }
41