text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from __future__ import annotations import copy from typing import TYPE_CHECKING, List import pytest from langchain_core.documents import Document from pytest_mock import MockerFixture from langchain_community.retrievers import ZepRetriever if TYPE_CHECKING: from zep_python import MemorySearchResult, ZepClient ...
langchain/libs/community/tests/integration_tests/retrievers/test_zep.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/retrievers/test_zep.py", "repo_id": "langchain", "token_count": 1558 }
342
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-dashvector/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-dashvector/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,515
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.google import ( GmailToolSpec, GoogleCalendarToolSpec, GoogleSearchToolSpec, ) def test_class(): names_of_base_classes = [b.__name__ for b in GoogleCalendarToolSpec.__mro__] assert BaseToolSpec.__name__ in names_...
llama_index/llama-index-integrations/tools/llama-index-tools-google/tests/test_tools_google.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-google/tests/test_tools_google.py", "repo_id": "llama_index", "token_count": 221 }
1,485
python_tests( name="tests", )
llama_index/llama-index-finetuning/tests/callbacks/BUILD/0
{ "file_path": "llama_index/llama-index-finetuning/tests/callbacks/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,163
# candle-transformers
candle/candle-transformers/README.md/0
{ "file_path": "candle/candle-transformers/README.md", "repo_id": "candle", "token_count": 6 }
70
<jupyter_start><jupyter_text>DeepInfra[DeepInfra](https://deepinfra.com/?utm_source=langchain) is a serverless inference as a service that provides access to a [variety of LLMs](https://deepinfra.com/models?utm_source=langchain) and [embeddings models](https://deepinfra.com/models?type=embeddings&utm_source=langchain)....
langchain/docs/docs/integrations/chat/deepinfra.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/chat/deepinfra.ipynb", "repo_id": "langchain", "token_count": 561 }
100
python_tests( interpreter_constraints=["==3.9.*", "==3.10.*"], )
llama_index/llama-index-integrations/extractors/llama-index-extractors-marvin/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/extractors/llama-index-extractors-marvin/tests/BUILD", "repo_id": "llama_index", "token_count": 29 }
1,329
// Code generated by protoc-gen-go. DO NOT EDIT. // source: event_log.proto package eventlog import ( context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" math "math" ) // Reference import...
milvus/pkg/eventlog/event_log.pb.go/0
{ "file_path": "milvus/pkg/eventlog/event_log.pb.go", "repo_id": "milvus", "token_count": 4044 }
1,882
<script lang="ts"> import { PUBLIC_APP_NAME, PUBLIC_VERSION } from "$env/static/public"; import { PUBLIC_ANNOUNCEMENT_BANNERS } from "$env/static/public"; import { PUBLIC_APP_DESCRIPTION } from "$env/static/public"; import Logo from "$lib/components/icons/Logo.svelte"; import { createEventDispatcher } from "svelte...
chat-ui/src/lib/components/chat/ChatIntroduction.svelte/0
{ "file_path": "chat-ui/src/lib/components/chat/ChatIntroduction.svelte", "repo_id": "chat-ui", "token_count": 1318 }
86
import { loadEvaluator } from "langchain/evaluation"; const evaluator = await loadEvaluator("criteria", { criteria: "conciseness" }); const res = await evaluator.evaluateStrings({ input: "What's 2+2?", prediction: "What's 2+2? That's an elementary question. The answer you're looking for is that two and two is...
langchainjs/examples/src/guides/evaluation/string/criteria_without_reference.ts/0
{ "file_path": "langchainjs/examples/src/guides/evaluation/string/criteria_without_reference.ts", "repo_id": "langchainjs", "token_count": 278 }
838
<jupyter_start><jupyter_text>XMLThe `UnstructuredXMLLoader` is used to load `XML` files. The loader works with `.xml` files. The page content will be the text extracted from the XML tags.<jupyter_code>from langchain_community.document_loaders import UnstructuredXMLLoader loader = UnstructuredXMLLoader( "example_dat...
langchain/docs/docs/integrations/document_loaders/xml.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/xml.ipynb", "repo_id": "langchain", "token_count": 136 }
117
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_transformers_available, is_transformers_version, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is...
diffusers/src/diffusers/pipelines/unclip/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/unclip/__init__.py", "repo_id": "diffusers", "token_count": 700 }
254
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.chroma_autoretrieval import ChromaAutoretrievalPack def test_class(): names_of_base_classes = [b.__name__ for b in ChromaAutoretrievalPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-chroma-autoretrieval/tests/test_packs_chroma_autoretrieval.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-chroma-autoretrieval/tests/test_packs_chroma_autoretrieval.py", "repo_id": "llama_index", "token_count": 106 }
1,559
# coding=utf-8 # Copyright 2021 The Fairseq Authors and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/...
transformers/src/transformers/models/mbart/modeling_tf_mbart.py/0
{ "file_path": "transformers/src/transformers/models/mbart/modeling_tf_mbart.py", "repo_id": "transformers", "token_count": 32356 }
690
"""Simple in memory docstore in the form of a dict.""" from typing import Dict, List, Optional, Union from langchain_core.documents import Document from langchain_community.docstore.base import AddableMixin, Docstore class InMemoryDocstore(Docstore, AddableMixin): """Simple in memory docstore in the form of a d...
langchain/libs/community/langchain_community/docstore/in_memory.py/0
{ "file_path": "langchain/libs/community/langchain_community/docstore/in_memory.py", "repo_id": "langchain", "token_count": 656 }
228
<!--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/en/model_doc/swin2sr.md/0
{ "file_path": "transformers/docs/source/en/model_doc/swin2sr.md", "repo_id": "transformers", "token_count": 979 }
488
""" GitHub Tool """
langchain/libs/community/langchain_community/tools/github/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/github/__init__.py", "repo_id": "langchain", "token_count": 5 }
307
from langchain_core.prompts import ( ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate, ) from .chat import chat librarian_prompt = ChatPromptTemplate.from_messages( [ SystemMessagePromptTemplate.from_template( """ You are a librarian at cohere...
langchain/templates/cohere-librarian/cohere_librarian/library_info.py/0
{ "file_path": "langchain/templates/cohere-librarian/cohere_librarian/library_info.py", "repo_id": "langchain", "token_count": 301 }
669
from llama_index.readers.nougat_ocr.base import PDFNougatOCR __all__ = ["PDFNougatOCR"]
llama_index/llama-index-integrations/readers/llama-index-readers-nougat-ocr/llama_index/readers/nougat_ocr/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-nougat-ocr/llama_index/readers/nougat_ocr/__init__.py", "repo_id": "llama_index", "token_count": 38 }
1,528
from langchain_community.embeddings.nlpcloud import NLPCloudEmbeddings __all__ = ["NLPCloudEmbeddings"]
langchain/libs/langchain/langchain/embeddings/nlpcloud.py/0
{ "file_path": "langchain/libs/langchain/langchain/embeddings/nlpcloud.py", "repo_id": "langchain", "token_count": 35 }
503
import { collections } from "$lib/server/database"; import { ObjectId } from "mongodb"; import { describe, expect, it } from "vitest"; import { insertLegacyConversation, insertLinearBranchConversation, insertSideBranchesConversation, } from "./treeHelpers.spec"; import { buildSubtree } from "./buildSubtree"; descr...
chat-ui/src/lib/utils/tree/buildSubtree.spec.ts/0
{ "file_path": "chat-ui/src/lib/utils/tree/buildSubtree.spec.ts", "repo_id": "chat-ui", "token_count": 1375 }
107
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/util/importutil/parquet_parser.go/0
{ "file_path": "milvus/internal/util/importutil/parquet_parser.go", "repo_id": "milvus", "token_count": 8859 }
1,871
# coding=utf-8 # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
transformers/tests/models/pop2piano/test_tokenization_pop2piano.py/0
{ "file_path": "transformers/tests/models/pop2piano/test_tokenization_pop2piano.py", "repo_id": "transformers", "token_count": 7905 }
745
from langchain_community.vectorstores.baiducloud_vector_search import BESVectorStore __all__ = ["BESVectorStore"]
langchain/libs/langchain/langchain/vectorstores/baiducloud_vector_search.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/baiducloud_vector_search.py", "repo_id": "langchain", "token_count": 35 }
612
import { bpeDecoder, byteFallbackDecoder, ctcDecoder, fuseDecoder, metaspaceDecoder, replaceDecoder, sequenceDecoder, stripDecoder, wordPieceDecoder, } from '../../' describe('wordPieceDecoder', () => { it('accepts `undefined` as first parameter', () => { expect(wordPieceDecoder(undefined)).toB...
tokenizers/bindings/node/lib/bindings/decoders.test.ts/0
{ "file_path": "tokenizers/bindings/node/lib/bindings/decoders.test.ts", "repo_id": "tokenizers", "token_count": 1393 }
426
#!/usr/bin/env python # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 to...
transformers/scripts/distributed/torch-distributed-gpu-test.py/0
{ "file_path": "transformers/scripts/distributed/torch-distributed-gpu-test.py", "repo_id": "transformers", "token_count": 1240 }
586
python_sources()
llama_index/llama-index-core/llama_index/core/text_splitter/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/text_splitter/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,203
import re from typing import Callable, List from langchain_community.document_loaders.parsers.language.code_segmenter import ( CodeSegmenter, ) class CobolSegmenter(CodeSegmenter): """Code segmenter for `COBOL`.""" PARAGRAPH_PATTERN = re.compile(r"^[A-Z0-9\-]+(\s+.*)?\.$", re.IGNORECASE) DIVISION_PA...
langchain/libs/community/langchain_community/document_loaders/parsers/language/cobol.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/parsers/language/cobol.py", "repo_id": "langchain", "token_count": 1733 }
244
// 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/pool.go/0
{ "file_path": "milvus/internal/querynodev2/segments/pool.go", "repo_id": "milvus", "token_count": 1624 }
1,854
# LlamaDataset Metadata Pack As part of the `LlamaDataset` submission package into [llamahub](https://llamahub.ai), two metadata files are required, namely: `card.json` and `README.md`. This pack creates these two files and saves them to disk to help expedite the submission process. ## CLI Usage You can download lla...
llama_index/llama-index-packs/llama-index-packs-llama-dataset-metadata/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-llama-dataset-metadata/README.md", "repo_id": "llama_index", "token_count": 693 }
1,589
use std::marker::PhantomData; use serde::{ self, de::{Error, MapAccess, Visitor}, ser::SerializeStruct, Deserialize, Deserializer, Serialize, Serializer, }; use super::{added_vocabulary::AddedTokenWithId, TokenizerImpl}; use crate::{Decoder, Model, Normalizer, PostProcessor, PreTokenizer, TokenizerBui...
tokenizers/tokenizers/src/tokenizer/serialization.rs/0
{ "file_path": "tokenizers/tokenizers/src/tokenizer/serialization.rs", "repo_id": "tokenizers", "token_count": 3618 }
463
from langchain_community.utilities.portkey import Portkey __all__ = ["Portkey"]
langchain/libs/langchain/langchain/utilities/portkey.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/portkey.py", "repo_id": "langchain", "token_count": 25 }
619
<jupyter_start><jupyter_text>Wikipedia>[Wikipedia](https://wikipedia.org/) is a multilingual free online encyclopedia written and maintained by a community of volunteers, known as Wikipedians, through open collaboration and using a wiki-based editing system called MediaWiki. `Wikipedia` is the largest and most-read ref...
langchain/docs/docs/integrations/document_loaders/wikipedia.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/wikipedia.ipynb", "repo_id": "langchain", "token_count": 391 }
121
import responses from langchain_community.retrievers.you import YouRetriever from ..utilities.test_you import ( LIMITED_PARSED_OUTPUT, MOCK_PARSED_OUTPUT, MOCK_RESPONSE_RAW, NEWS_RESPONSE_PARSED, NEWS_RESPONSE_RAW, TEST_ENDPOINT, ) class TestYouRetriever: @responses.activate def test...
langchain/libs/community/tests/unit_tests/retrievers/test_you.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/retrievers/test_you.py", "repo_id": "langchain", "token_count": 1122 }
389
import os def get_directory_size(directory: str) -> int: """ Calculate the total size of the directory by walking through each file. Parameters: directory (str): The path of the directory for which to calculate the size. Returns: total_size (int): The total size of the directory in bytes. ...
chroma/chromadb/utils/directory.py/0
{ "file_path": "chroma/chromadb/utils/directory.py", "repo_id": "chroma", "token_count": 246 }
30
# 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/mobilevit/image_processing_mobilevit.py/0
{ "file_path": "transformers/src/transformers/models/mobilevit/image_processing_mobilevit.py", "repo_id": "transformers", "token_count": 9348 }
667
kind: Schedule apiVersion: chaos-mesh.org/v1alpha1 metadata: name: test-datanode-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_datanode_pod_kill.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/pod_kill/chaos_datanode_pod_kill.yaml", "repo_id": "milvus", "token_count": 224 }
2,170
export * from "@langchain/core/callbacks/promises";
langchainjs/langchain/src/callbacks/promises.ts/0
{ "file_path": "langchainjs/langchain/src/callbacks/promises.ts", "repo_id": "langchainjs", "token_count": 16 }
849
# Instagram ResNeXt WSL A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transfo...
pytorch-image-models/hfdocs/source/models/ig-resnext.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/ig-resnext.mdx", "repo_id": "pytorch-image-models", "token_count": 3231 }
378
# 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/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_img2img.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_img2img.py", "repo_id": "diffusers", "token_count": 9901 }
242
from __future__ import annotations import os import time import uuid from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Tuple, Type import numpy as np from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.vectorstores import VectorStore ...
langchain/libs/community/langchain_community/vectorstores/vearch.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/vearch.py", "repo_id": "langchain", "token_count": 10805 }
334
<jupyter_start><jupyter_text>BrowserlessBrowserless is a service that allows you to run headless Chrome instances in the cloud. It's a great way to run browser-based automation at scale without having to worry about managing your own infrastructure.To use Browserless as a document loader, initialize a `BrowserlessLoade...
langchain/docs/docs/integrations/document_loaders/browserless.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/browserless.ipynb", "repo_id": "langchain", "token_count": 473 }
98
<!--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/en/main_classes/image_processor.md/0
{ "file_path": "transformers/docs/source/en/main_classes/image_processor.md", "repo_id": "transformers", "token_count": 343 }
453
from langchain_community.agent_toolkits.openapi.planner import ( MAX_RESPONSE_LENGTH, RequestsDeleteToolWithParsing, RequestsGetToolWithParsing, RequestsPatchToolWithParsing, RequestsPostToolWithParsing, RequestsPutToolWithParsing, create_openapi_agent, ) __all__ = [ "MAX_RESPONSE_LENGT...
langchain/libs/langchain/langchain/agents/agent_toolkits/openapi/planner.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/openapi/planner.py", "repo_id": "langchain", "token_count": 218 }
436
// Code generated by mockery v2.32.4. DO NOT EDIT. package datanode import ( datapb "github.com/milvus-io/milvus/internal/proto/datapb" mock "github.com/stretchr/testify/mock" schemapb "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" ) // MockFlowgraphManager is an autogenerated mock type for the Flowgraph...
milvus/internal/datanode/mock_fgmanager.go/0
{ "file_path": "milvus/internal/datanode/mock_fgmanager.go", "repo_id": "milvus", "token_count": 4924 }
1,706
"""Test EdenAi's identity parser Tool . In order to run this test, you need to have an EdenAI api key. You can get it by registering for free at https://app.edenai.run/user/register. A test key can be found at https://app.edenai.run/admin/account/settings by clicking on the 'sandbox' toggle. (calls will be free, and w...
langchain/libs/community/tests/integration_tests/tools/edenai/test_ocr_identityparser.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/tools/edenai/test_ocr_identityparser.py", "repo_id": "langchain", "token_count": 320 }
346
[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 = ["IonicShoppingToolSpec"] contains_example = false import_path = "llama_index.tools.ionic_s...
llama_index/llama-index-integrations/tools/llama-index-tools-ionic-shopping/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-ionic-shopping/pyproject.toml", "repo_id": "llama_index", "token_count": 666 }
1,441
from __future__ import annotations import asyncio from typing import Any, Callable, Optional, Sequence from langchain_core.runnables import ( Runnable, RunnableConfig, RunnablePassthrough, ) from langchain_core.runnables.utils import ConfigurableFieldSpec from langgraph.constants import CONFIG_KEY_SEND ...
langgraph/langgraph/pregel/write.py/0
{ "file_path": "langgraph/langgraph/pregel/write.py", "repo_id": "langgraph", "token_count": 1190 }
1,039
# import logging # from apscheduler.schedulers.background import BackgroundScheduler # from apscheduler.schedulers.blocking import BlockingScheduler # from apscheduler.jobstores.mongodb import MongoDBJobStore # from apscheduler.executors.pool import ProcessPoolExecutor, ThreadPoolExecutor # from apscheduler.executors....
milvus/tests/benchmark/milvus_benchmark/scheduler.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/scheduler.py", "repo_id": "milvus", "token_count": 307 }
1,866
"""Test Lantern functionality.""" import os from typing import List, Tuple from langchain_core.documents import Document from langchain_community.embeddings import FakeEmbeddings from langchain_community.vectorstores import Lantern CONNECTION_STRING = Lantern.connection_string_from_db_params( driver=os.environ.g...
langchain/libs/community/tests/integration_tests/vectorstores/test_lantern.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_lantern.py", "repo_id": "langchain", "token_count": 4780 }
378
# Test file to ensure that in general certain situational setups for notebooks work. import os from pytest import raises from accelerate import PartialState, notebook_launcher from accelerate.test_utils import require_bnb from accelerate.utils import is_bnb_available def basic_function(): # Just prints the Part...
accelerate/src/accelerate/test_utils/scripts/test_notebook.py/0
{ "file_path": "accelerate/src/accelerate/test_utils/scripts/test_notebook.py", "repo_id": "accelerate", "token_count": 342 }
11
<!--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/en/model_doc/gpt_neox.md/0
{ "file_path": "transformers/docs/source/en/model_doc/gpt_neox.md", "repo_id": "transformers", "token_count": 1662 }
491
from typing import Optional, Tuple, List import torch def onnx_forward(onnx_file, example_input): import onnxruntime sess_options = onnxruntime.SessionOptions() session = onnxruntime.InferenceSession(onnx_file, sess_options) input_name = session.get_inputs()[0].name output = session.run([], {inp...
pytorch-image-models/timm/utils/onnx.py/0
{ "file_path": "pytorch-image-models/timm/utils/onnx.py", "repo_id": "pytorch-image-models", "token_count": 1392 }
385
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/token_counter/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/token_counter/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,718
/* eslint-disable no-promise-executor-return */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { Run } from "langsmith"; import { jest } from "@jest/globals"; import { createChatMessageChunkEncoderStream } from "../../language_models/chat_models.js"; import { BaseMessage } from "../../messages/index.js...
langchainjs/langchain-core/src/runnables/tests/runnable.test.ts/0
{ "file_path": "langchainjs/langchain-core/src/runnables/tests/runnable.test.ts", "repo_id": "langchainjs", "token_count": 4575 }
868
"""Test Cassandra caches. Requires a running vector-capable Cassandra cluster.""" import os import time from typing import Any, Iterator, Tuple import pytest from langchain_core.outputs import Generation, LLMResult from langchain.cache import CassandraCache, CassandraSemanticCache from langchain.globals import get_l...
langchain/libs/langchain/tests/integration_tests/cache/test_cassandra.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/cache/test_cassandra.py", "repo_id": "langchain", "token_count": 1371 }
610
import { Document } from "@langchain/core/documents"; /** * Given a list of documents, this util formats their contents * into a string, separated by newlines. * * @param documents * @returns A string of the documents page content, separated by newlines. */ export const formatDocumentsAsString = (documents: Docu...
langchainjs/langchain/src/util/document.ts/0
{ "file_path": "langchainjs/langchain/src/util/document.ts", "repo_id": "langchainjs", "token_count": 107 }
999
"""Init file.""" from llama_index.readers.gpt_repo.base import ( GPTRepoReader, get_ignore_list, process_repository, should_ignore, ) __all__ = [ "GPTRepoReader", "get_ignore_list", "process_repository", "should_ignore", ]
llama_index/llama-index-integrations/readers/llama-index-readers-gpt-repo/llama_index/readers/gpt_repo/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-gpt-repo/llama_index/readers/gpt_repo/__init__.py", "repo_id": "llama_index", "token_count": 116 }
1,409
import { ChatGoogleVertexAI } from "@langchain/community/chat_models/googlevertexai"; // Or, if using the web entrypoint: // import { ChatGoogleVertexAI } from "@langchain/community/chat_models/googlevertexai/web"; const model = new ChatGoogleVertexAI({ temperature: 0.7, });
langchainjs/examples/src/models/chat/integration_googlevertexai.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/integration_googlevertexai.ts", "repo_id": "langchainjs", "token_count": 86 }
846
from typing import Any, Dict, List from langchain.chains.graph_qa.cypher_utils import CypherQueryCorrector, Schema from langchain.memory import ChatMessageHistory from langchain_community.chat_models import ChatOpenAI from langchain_community.graphs import Neo4jGraph from langchain_core.output_parsers import StrOutput...
langchain/templates/neo4j-cypher-memory/neo4j_cypher_memory/chain.py/0
{ "file_path": "langchain/templates/neo4j-cypher-memory/neo4j_cypher_memory/chain.py", "repo_id": "langchain", "token_count": 1906 }
710
package utils import ( "testing" "google.golang.org/grpc" "github.com/milvus-io/milvus/pkg/util/paramtable" ) func TestGracefulStopGrpcServer(t *testing.T) { paramtable.Init() // expected close by gracefulStop s1 := grpc.NewServer() GracefulStopGRPCServer(s1) // expected not panic GracefulStopGRPCServer(...
milvus/internal/distributed/utils/util_test.go/0
{ "file_path": "milvus/internal/distributed/utils/util_test.go", "repo_id": "milvus", "token_count": 131 }
1,712
python_tests()
llama_index/llama-index-packs/llama-index-packs-tables/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-tables/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,736
import { test, expect } from "@jest/globals"; import * as url from "node:url"; import * as path from "node:path"; import { PDFLoader } from "../fs/pdf.js"; test("Test PDF loader from file", async () => { const filePath = path.resolve( path.dirname(url.fileURLToPath(import.meta.url)), "./example_data/1706.037...
langchainjs/langchain/src/document_loaders/tests/pdf.test.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/pdf.test.ts", "repo_id": "langchainjs", "token_count": 473 }
908
# coding=utf-8 # Copyright 2022 SHI Labs and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
transformers/src/transformers/models/oneformer/configuration_oneformer.py/0
{ "file_path": "transformers/src/transformers/models/oneformer/configuration_oneformer.py", "repo_id": "transformers", "token_count": 5485 }
648
from llama_index.llms.xinference.base import Xinference __all__ = ["Xinference"]
llama_index/llama-index-integrations/llms/llama-index-llms-xinference/llama_index/llms/xinference/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-xinference/llama_index/llms/xinference/__init__.py", "repo_id": "llama_index", "token_count": 29 }
1,244
import numpy as np from transformers import Pipeline def softmax(outputs): maxes = np.max(outputs, axis=-1, keepdims=True) shifted_exp = np.exp(outputs - maxes) return shifted_exp / shifted_exp.sum(axis=-1, keepdims=True) class PairClassificationPipeline(Pipeline): def _sanitize_parameters(self, **...
transformers/utils/test_module/custom_pipeline.py/0
{ "file_path": "transformers/utils/test_module/custom_pipeline.py", "repo_id": "transformers", "token_count": 453 }
813
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-intercom/llama_index/readers/intercom/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-intercom/llama_index/readers/intercom/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,384
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { Pinecone } from "@pinecone-database/pinecone"; import { OpenAIEmbeddings } from "@langchain/openai"; import { PineconeStore } from "@langchain/pinecone"; // Instantiate a new Pinecone client, which will automatically read the // env vars: PINECONE_...
langchainjs/examples/src/indexes/vector_stores/pinecone/query_docs.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/pinecone/query_docs.ts", "repo_id": "langchainjs", "token_count": 299 }
807
export function str(o: unknown): React.ReactNode { return typeof o === "object" ? JSON.stringify(o, null, 2) : (o as React.ReactNode); }
langserve/langserve/playground/src/utils/str.ts/0
{ "file_path": "langserve/langserve/playground/src/utils/str.ts", "repo_id": "langserve", "token_count": 57 }
1,089
package configs import ( "fmt" "strconv" "github.com/milvus-io/milvus/cmd/tools/migration/console" "github.com/milvus-io/milvus/pkg/util" "github.com/milvus-io/milvus/pkg/util/paramtable" ) const ( RunCmd = "run" BackupCmd = "backup" RollbackCmd = "rollback" ) type RunConfig struct { base ...
milvus/cmd/tools/migration/configs/config.go/0
{ "file_path": "milvus/cmd/tools/migration/configs/config.go", "repo_id": "milvus", "token_count": 1224 }
1,631
"""Init params.""" from llama_index.legacy.logger.base import LlamaLogger __all__ = ["LlamaLogger"]
llama_index/llama-index-legacy/llama_index/legacy/logger/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/logger/__init__.py", "repo_id": "llama_index", "token_count": 39 }
1,576
"use client"; import { v4 as uuidv4 } from "uuid"; import { ChatWindow } from "../app/components/ChatWindow"; import { ToastContainer } from "react-toastify"; import { ChakraProvider } from "@chakra-ui/react"; export default function Home() { return ( <ChakraProvider> <ToastContainer /> <ChatWindow...
chat-langchain/chat-langchain/app/page.tsx/0
{ "file_path": "chat-langchain/chat-langchain/app/page.tsx", "repo_id": "chat-langchain", "token_count": 138 }
7
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/tools/tool_spec/notion/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/tools/tool_spec/notion/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,608
from langchain.schema.agent import __all__ EXPECTED_ALL = ["AgentAction", "AgentActionMessageLog", "AgentFinish"] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
langchain/libs/langchain/tests/unit_tests/schema/test_agent.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/schema/test_agent.py", "repo_id": "langchain", "token_count": 68 }
671
# The Reinforcement Learning Framework [[the-reinforcement-learning-framework]] ## The RL Process [[the-rl-process]] <figure> <img src="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit1/RL_process.jpg" alt="The RL process" width="100%"> <figcaption>The RL Process: a loop o...
deep-rl-class/units/en/unit1/rl-framework.mdx/0
{ "file_path": "deep-rl-class/units/en/unit1/rl-framework.mdx", "repo_id": "deep-rl-class", "token_count": 2504 }
158
python_tests( interpreter_constraints=["==3.10.*"], )
llama_index/llama-index-integrations/readers/llama-index-readers-pathway/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-pathway/tests/BUILD", "repo_id": "llama_index", "token_count": 22 }
1,537
.. _Ref-Node: Callbacks ================= .. automodule:: llama_index.core.callbacks :members: :inherited-members:
llama_index/docs/api_reference/callbacks.rst/0
{ "file_path": "llama_index/docs/api_reference/callbacks.rst", "repo_id": "llama_index", "token_count": 46 }
1,029
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.self_rag import SelfRAGPack def test_class(): names_of_base_classes = [b.__name__ for b in SelfRAGPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-self-rag/tests/test_packs_self_rag.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-self-rag/tests/test_packs_self_rag.py", "repo_id": "llama_index", "token_count": 94 }
1,870
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <link rel="icon" href="/____LANGSERVE_BASE_URL/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Playground</title> <script type="module" crossorigin src="/____LANGSERVE_BASE_URL/assets/i...
langserve/langserve/playground/dist/index.html/0
{ "file_path": "langserve/langserve/playground/dist/index.html", "repo_id": "langserve", "token_count": 363 }
1,044
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-chatgpt-plugin/llama_index/vector_stores/chatgpt_plugin/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-chatgpt-plugin/llama_index/vector_stores/chatgpt_plugin/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,597
package httpserver import ( "context" "encoding/json" "io" "net/http" "strconv" "time" "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" "github.com/go-playground/validator/v10" "github.com/golang/protobuf/proto" "github.com/tidwall/gjson" "go.uber.org/zap" "google.golang.org/grpc" "github....
milvus/internal/distributed/proxy/httpserver/handler_v2.go/0
{ "file_path": "milvus/internal/distributed/proxy/httpserver/handler_v2.go", "repo_id": "milvus", "token_count": 26801 }
1,788
.. _Ref-Retrievers: Retrievers ================= Index Retrievers ^^^^^^^^^^^^^^^^ Below we show index-specific retriever classes. .. toctree:: :maxdepth: 1 :caption: Index Retrievers retrievers/empty.rst retrievers/kg.rst retrievers/list.rst retrievers/table.rst retrievers/tree.rst retrieve...
llama_index/docs/api_reference/query/retrievers.rst/0
{ "file_path": "llama_index/docs/api_reference/query/retrievers.rst", "repo_id": "llama_index", "token_count": 379 }
1,095
"""Test ClickHouse functionality.""" from langchain_core.documents import Document from langchain_community.vectorstores import Clickhouse, ClickhouseSettings from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings def test_clickhouse() -> None: """Test end to end construction and search....
langchain/libs/community/tests/integration_tests/vectorstores/test_clickhouse.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_clickhouse.py", "repo_id": "langchain", "token_count": 1486 }
391
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team, Microsoft Corporation. # # 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/mpnet/test_modeling_tf_mpnet.py/0
{ "file_path": "transformers/tests/models/mpnet/test_modeling_tf_mpnet.py", "repo_id": "transformers", "token_count": 4844 }
776
"""Simple reader that reads tweets of a twitter handle.""" from typing import Any, List, Optional from llama_index.legacy.readers.base import BasePydanticReader from llama_index.legacy.schema import Document class TwitterTweetReader(BasePydanticReader): """Twitter tweets reader. Read tweets of user twitter...
llama_index/llama-index-legacy/llama_index/legacy/readers/twitter.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/twitter.py", "repo_id": "llama_index", "token_count": 991 }
1,597
<!--Copyright 2021 NVIDIA Corporation 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 required by a...
transformers/docs/source/en/model_doc/megatron-bert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/megatron-bert.md", "repo_id": "transformers", "token_count": 1735 }
510
# 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/convnext/image_processing_convnext.py/0
{ "file_path": "transformers/src/transformers/models/convnext/image_processing_convnext.py", "repo_id": "transformers", "token_count": 6829 }
638
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datanode/timetick_sender.go/0
{ "file_path": "milvus/internal/datanode/timetick_sender.go", "repo_id": "milvus", "token_count": 2270 }
1,846
# langchain-google-vertexai This package contains the LangChain integrations for Google Cloud generative models. ## Installation ```bash pip install -U langchain-google-vertexai ``` ## Chat Models `ChatVertexAI` class exposes models such as `gemini-pro` and `chat-bison`. To use, you should have Google Cloud proje...
langchain/libs/partners/google-vertexai/README.md/0
{ "file_path": "langchain/libs/partners/google-vertexai/README.md", "repo_id": "langchain", "token_count": 853 }
628
from typing import Callable, Iterator from unittest import mock import pytest from llama_index.legacy.llm_predictor.vellum import VellumPredictor from llama_index.legacy.prompts import BasePromptTemplate def test_predict__basic( mock_vellum_client_factory: Callable[..., mock.MagicMock], vellum_predictor_fact...
llama_index/llama-index-legacy/tests/llm_predictor/vellum/test_predictor.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/llm_predictor/vellum/test_predictor.py", "repo_id": "llama_index", "token_count": 1148 }
1,535
# Security Policy ## Reporting a Vulnerability 🤗 We have our bug bounty program set up with HackerOne. Please feel free to submit vulnerability reports to our private program at https://hackerone.com/hugging_face. Note that you'll need to be invited to our program, so send us a quick email at security@huggingface.co...
transformers/SECURITY.md/0
{ "file_path": "transformers/SECURITY.md", "repo_id": "transformers", "token_count": 89 }
427
import json import logging from typing import List from langchain_core.chat_history import BaseChatMessageHistory from langchain_core.messages import ( BaseMessage, message_to_dict, messages_from_dict, ) logger = logging.getLogger(__name__) DEFAULT_DBNAME = "chat_history" DEFAULT_COLLECTION_NAME = "messa...
langchain/libs/community/langchain_community/chat_message_histories/mongodb.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_message_histories/mongodb.py", "repo_id": "langchain", "token_count": 1124 }
232
<jupyter_start><jupyter_text>Improve document indexing with HyDEThis notebook goes over how to use Hypothetical Document Embeddings (HyDE), as described in [this paper](https://arxiv.org/abs/2212.10496). At a high level, HyDE is an embedding technique that takes queries, generates a hypothetical answer, and then embeds...
langchain/cookbook/hypothetical_document_embeddings.ipynb/0
{ "file_path": "langchain/cookbook/hypothetical_document_embeddings.ipynb", "repo_id": "langchain", "token_count": 1180 }
77
# Additional Readings [[additional-readings]] These are **optional readings** if you want to go deeper. - [Foundations of Deep RL Series, L2 Deep Q-Learning by Pieter Abbeel](https://youtu.be/Psrhxy88zww) - [Playing Atari with Deep Reinforcement Learning](https://arxiv.org/abs/1312.5602) - [Double Deep Q-Learning](ht...
deep-rl-class/units/en/unit3/additional-readings.mdx/0
{ "file_path": "deep-rl-class/units/en/unit3/additional-readings.mdx", "repo_id": "deep-rl-class", "token_count": 163 }
153
import logging from argparse import ArgumentParser, Namespace from .cli_add import register_add_cli from .cli_init import register_init_cli from .cli_query import register_query_cli logger = logging.getLogger(__name__) def main() -> None: parser = ArgumentParser(description=None) parser.add_argument( ...
llama_index/experimental/cli/__main__.py/0
{ "file_path": "llama_index/experimental/cli/__main__.py", "repo_id": "llama_index", "token_count": 461 }
1,190
# coding=utf-8 # Copyright 2022 The Fairseq Authors and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/...
text-generation-inference/server/text_generation_server/models/custom_modeling/opt_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/opt_modeling.py", "repo_id": "text-generation-inference", "token_count": 15477 }
397
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-voyageai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-voyageai/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,199
"""Utils for manipulating images.""" import base64 from io import BytesIO from typing import cast from PIL import Image def img_2_b64(image: Image, format: str = "JPEG") -> str: """Convert a PIL.Image to a base64 encoded image str.""" buff = BytesIO() image.save(buff, format=format) return cast(str, ...
llama_index/llama-index-legacy/llama_index/legacy/img_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/img_utils.py", "repo_id": "llama_index", "token_count": 193 }
1,657
# The Problem of Variance in Reinforce [[the-problem-of-variance-in-reinforce]] In Reinforce, we want to **increase the probability of actions in a trajectory proportionally to how high the return is**. <img src="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit8/pg.jpg" ...
deep-rl-class/units/en/unit6/variance-problem.mdx/0
{ "file_path": "deep-rl-class/units/en/unit6/variance-problem.mdx", "repo_id": "deep-rl-class", "token_count": 677 }
182
# Baichuan >[Baichuan Inc.](https://www.baichuan-ai.com/) is a Chinese startup in the era of AGI, dedicated to addressing fundamental human needs: Efficiency, Health, and Happiness. ## Visit Us Visit us at https://www.baichuan-ai.com/. Register and get an API key if you are trying out our APIs. ## Baichuan LLM Endpo...
langchain/docs/docs/integrations/providers/baichuan.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/baichuan.mdx", "repo_id": "langchain", "token_count": 183 }
134