text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
import { AIMessage, type BaseMessage, BaseMessageChunk, type BaseMessageLike, HumanMessage, coerceMessageLikeToMessage, } from "../messages/index.js"; import type { BasePromptValueInterface } from "../prompt_values.js"; import { LLMResult, RUN_KEY, type ChatGeneration, ChatGenerationChunk, type Ch...
langchainjs/langchain-core/src/language_models/chat_models.ts/0
{ "file_path": "langchainjs/langchain-core/src/language_models/chat_models.ts", "repo_id": "langchainjs", "token_count": 7205 }
825
"""Fetch and prune the Langsmith spec.""" import argparse from pathlib import Path import requests import yaml from openapi_spec_validator import validate_spec def get_dependencies(schema, obj_name, new_components): if obj_name in new_components["schemas"]: return obj_schema = schema["components"]["...
langsmith-sdk/_scripts/_fetch_schema.py/0
{ "file_path": "langsmith-sdk/_scripts/_fetch_schema.py", "repo_id": "langsmith-sdk", "token_count": 1970 }
1,099
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/seamless_m4t/feature_extraction_seamless_m4t.py/0
{ "file_path": "transformers/src/transformers/models/seamless_m4t/feature_extraction_seamless_m4t.py", "repo_id": "transformers", "token_count": 5746 }
656
from chromadb.db.base import ParameterValue, get_sql import pypika def test_value_params_default() -> None: t = pypika.Table("foo") original_query = ( pypika.Query.from_(t) .select(t.a, t.b) .where(t.a == pypika.Parameter("?")) .where(t.b == pypika.Parameter("?")) ) v...
chroma/chromadb/test/db/test_base.py/0
{ "file_path": "chroma/chromadb/test/db/test_base.py", "repo_id": "chroma", "token_count": 564 }
22
import { OpenAIEmbeddings } from "@langchain/openai"; import { createClient } from "@supabase/supabase-js"; import { SupabaseHybridSearch } from "@langchain/community/retrievers/supabase"; export const run = async () => { const client = createClient( process.env.SUPABASE_URL || "", process.env.SUPABASE_PRIVA...
langchainjs/examples/src/retrievers/supabase_hybrid.ts/0
{ "file_path": "langchainjs/examples/src/retrievers/supabase_hybrid.ts", "repo_id": "langchainjs", "token_count": 276 }
849
// 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/allocator/global_id_allocator_test.go/0
{ "file_path": "milvus/internal/allocator/global_id_allocator_test.go", "repo_id": "milvus", "token_count": 1173 }
1,649
python_tests( name="tests", )
llama_index/llama-index-core/tests/indices/vector_store/auto_retriever/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/indices/vector_store/auto_retriever/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,160
Databricks ========== The [Databricks](https://www.databricks.com/) Lakehouse Platform unifies data, analytics, and AI on one platform. Databricks embraces the LangChain ecosystem in various ways: 1. Databricks connector for the SQLDatabase Chain: SQLDatabase.from_databricks() provides an easy way to query your data...
langchain/docs/docs/integrations/providers/databricks.md/0
{ "file_path": "langchain/docs/docs/integrations/providers/databricks.md", "repo_id": "langchain", "token_count": 1558 }
133
from typing import Any, List, Literal from langchain_core.messages.base import ( BaseMessage, BaseMessageChunk, merge_content, ) class ToolMessage(BaseMessage): """Message for passing the result of executing a tool back to a model.""" tool_call_id: str """Tool call that this message is respo...
langchain/libs/core/langchain_core/messages/tool.py/0
{ "file_path": "langchain/libs/core/langchain_core/messages/tool.py", "repo_id": "langchain", "token_count": 708 }
392
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-requests/llama_index/tools/requests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-requests/llama_index/tools/requests/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,631
# flake8: noqa from langchain.chains.prompt_selector import ConditionalPromptSelector, is_chat_model from langchain_core.prompts.chat import ( AIMessagePromptTemplate, ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate, ) from langchain_core.prompts.prompt import PromptTemplate ...
langchain/libs/langchain/langchain/chains/question_answering/refine_prompts.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/question_answering/refine_prompts.py", "repo_id": "langchain", "token_count": 845 }
511
"""Test file reader.""" from multiprocessing import cpu_count from tempfile import TemporaryDirectory from typing import Any, Dict import pytest from llama_index.core.readers.file.base import SimpleDirectoryReader try: from llama_index.readers.file import PDFReader except ImportError: PDFReader = None # typ...
llama_index/llama-index-integrations/readers/llama-index-readers-file/tests/test_file.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/tests/test_file.py", "repo_id": "llama_index", "token_count": 9989 }
1,321
# coding=utf-8 # Copyright 2022 Meta Platforms, Inc. 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/levit/configuration_levit.py/0
{ "file_path": "transformers/src/transformers/models/levit/configuration_levit.py", "repo_id": "transformers", "token_count": 2270 }
623
.. mdinclude:: ../DOCS_README.md
llama_index/docs/contributing/documentation.rst/0
{ "file_path": "llama_index/docs/contributing/documentation.rst", "repo_id": "llama_index", "token_count": 14 }
1,101
// 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/indexbuilder/init_c.cpp/0
{ "file_path": "milvus/internal/core/src/indexbuilder/init_c.cpp", "repo_id": "milvus", "token_count": 348 }
1,757
// 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/kv/etcd/embed_etcd_kv_test.go/0
{ "file_path": "milvus/internal/kv/etcd/embed_etcd_kv_test.go", "repo_id": "milvus", "token_count": 11565 }
1,794
import pytest from llama_index.legacy.vector_stores.types import ( ExactMatchFilter, FilterOperator, MetadataFilter, MetadataFilters, ) def test_legacy_filters_value_error() -> None: """Test legacy filters.""" filters = [ MetadataFilter(key="key1", value="value1", operator=FilterOperat...
llama_index/llama-index-legacy/tests/vector_stores/test_metadata_filters.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/vector_stores/test_metadata_filters.py", "repo_id": "llama_index", "token_count": 425 }
1,636
import asyncio import os import time from collections import defaultdict from concurrent.futures import ThreadPoolExecutor from typing import AsyncGenerator, Generator, Optional import pytest from langsmith import utils as ls_utils from langsmith.client import Client from langsmith.run_helpers import trace, traceable...
langsmith-sdk/python/tests/integration_tests/test_runs.py/0
{ "file_path": "langsmith-sdk/python/tests/integration_tests/test_runs.py", "repo_id": "langsmith-sdk", "token_count": 6622 }
1,071
# Glossary This is a community-created glossary. Contributions are welcomed! - **Tabular Method:** Type of problem in which the state and action spaces are small enough to approximate value functions to be represented as arrays and tables. **Q-learning** is an example of tabular method since a table is used to repr...
deep-rl-class/units/en/unit3/glossary.mdx/0
{ "file_path": "deep-rl-class/units/en/unit3/glossary.mdx", "repo_id": "deep-rl-class", "token_count": 721 }
166
# coding=utf-8 # Copyright 2020 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/funnel/tokenization_funnel_fast.py/0
{ "file_path": "transformers/src/transformers/models/funnel/tokenization_funnel_fast.py", "repo_id": "transformers", "token_count": 4905 }
637
<jupyter_start><jupyter_text>Auto Merging Retriever PackThis LlamaPack provides an example of our auto-merging retriever. Setup Data<jupyter_code>!wget "https://www.dropbox.com/s/f6bmb19xdg0xedm/paul_graham_essay.txt?dl=1" -O paul_graham_essay.txt from llama_index.core import SimpleDirectoryReader # load in some samp...
llama_index/llama-index-packs/llama-index-packs-auto-merging-retriever/examples/auto_merging_retriever.ipynb/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-auto-merging-retriever/examples/auto_merging_retriever.ipynb", "repo_id": "llama_index", "token_count": 542 }
1,556
### Saved Pseudo-Labels These are the generations of various large models on various large **training** sets. All in all they took about 200 GPU hours to produce. ### Available Pseudo-labels | Dataset | Model | Link ...
transformers/examples/research_projects/seq2seq-distillation/precomputed_pseudo_labels.md/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/precomputed_pseudo_labels.md", "repo_id": "transformers", "token_count": 1861 }
545
# flake8: noqa __version__ = "0.7.11.dev0" from .core import set_seed from .environment import TextEnvironment, TextHistory from .extras import BestOfNSampler from .import_utils import ( is_bitsandbytes_available, is_diffusers_available, is_npu_available, is_peft_available, is_wandb_available, ...
trl/trl/__init__.py/0
{ "file_path": "trl/trl/__init__.py", "repo_id": "trl", "token_count": 434 }
780
from __future__ import annotations from typing import Any, Dict, Iterable, List, Optional, Tuple import numpy as np from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.vectorstores import VectorStore from langchain_community.docstore.base import AddableM...
langchain/libs/community/langchain_community/vectorstores/usearch.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/usearch.py", "repo_id": "langchain", "token_count": 2569 }
342
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/generation/candidate_generator.py/0
{ "file_path": "transformers/src/transformers/generation/candidate_generator.py", "repo_id": "transformers", "token_count": 8085 }
571
"""Remote file reader. A loader that fetches any remote page or file by URL and retrieves child pages with certain constraints. The class also parses the contents of each page and provides access to the parsed data. """ from typing import Any, Dict, List, Optional, Union import requests from llama_index.core.readers....
llama_index/llama-index-integrations/readers/llama-index-readers-remote-depth/llama_index/readers/remote_depth/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-remote-depth/llama_index/readers/remote_depth/base.py", "repo_id": "llama_index", "token_count": 1764 }
1,366
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/benchmark/test_benchmark.py/0
{ "file_path": "transformers/tests/benchmark/test_benchmark.py", "repo_id": "transformers", "token_count": 4937 }
723
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/training_args_tf.py/0
{ "file_path": "transformers/src/transformers/training_args_tf.py", "repo_id": "transformers", "token_count": 5786 }
755
# Cohere The `CohereEmbeddings` class uses the Cohere API to generate embeddings for a given text. ## Usage ```bash npm2yarn npm install cohere-ai @langchain/cohere ``` import CodeBlock from "@theme/CodeBlock"; import CohereExample from "@examples/models/embeddings/cohere.ts"; <CodeBlock language="typescript">{Coh...
langchainjs/docs/core_docs/docs/integrations/text_embedding/cohere.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/text_embedding/cohere.mdx", "repo_id": "langchainjs", "token_count": 113 }
723
// Code generated by mockery v2.32.4. DO NOT EDIT. package mocks import ( querypb "github.com/milvus-io/milvus/internal/proto/querypb" mock "github.com/stretchr/testify/mock" ) // QueryCoordCatalog is an autogenerated mock type for the QueryCoordCatalog type type QueryCoordCatalog struct { mock.Mock } type Query...
milvus/internal/metastore/mocks/mock_querycoord_catalog.go/0
{ "file_path": "milvus/internal/metastore/mocks/mock_querycoord_catalog.go", "repo_id": "milvus", "token_count": 7746 }
1,997
--- sidebar_position: 6 --- # Parallel tool use In the [Chains with multiple tools](/docs/use_cases/tool_use/multiple_tools) guide we saw how to build function-calling chains that select between multiple tools. Some models, like the OpenAI models released in Fall 2023, also support parallel function calling. This all...
langchainjs/docs/core_docs/docs/use_cases/tool_use/parallel.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/use_cases/tool_use/parallel.mdx", "repo_id": "langchainjs", "token_count": 1524 }
801
// 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/services_test.go/0
{ "file_path": "milvus/internal/querynodev2/services_test.go", "repo_id": "milvus", "token_count": 25505 }
1,846
# A diffuser version implementation of Zero1to3 (https://github.com/cvlab-columbia/zero123), ICCV 2023 # by Xin Kong import inspect from typing import Any, Callable, Dict, List, Optional, Union import kornia import numpy as np import PIL.Image import torch from packaging import version from transformers import CLIPFe...
diffusers/examples/community/pipeline_zero1to3.py/0
{ "file_path": "diffusers/examples/community/pipeline_zero1to3.py", "repo_id": "diffusers", "token_count": 19739 }
202
from langchain_community.llms.deepsparse import DeepSparse __all__ = ["DeepSparse"]
langchain/libs/langchain/langchain/llms/deepsparse.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/deepsparse.py", "repo_id": "langchain", "token_count": 28 }
512
import argparse import gc import hashlib import itertools import logging import math import os import threading import warnings from contextlib import nullcontext from pathlib import Path from typing import Optional import datasets import diffusers import numpy as np import psutil import torch import torch.nn.function...
peft/examples/oft_dreambooth/train_dreambooth.py/0
{ "file_path": "peft/examples/oft_dreambooth/train_dreambooth.py", "repo_id": "peft", "token_count": 20129 }
341
// 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/importv2/executor_test.go/0
{ "file_path": "milvus/internal/datanode/importv2/executor_test.go", "repo_id": "milvus", "token_count": 6935 }
1,802
# Response Modes Right now, we support the following options: - `refine`: **_create and refine_** an answer by sequentially going through each retrieved text chunk. This makes a separate LLM call per Node/retrieved chunk. **Details:** the first chunk is used in a query using the `text_qa_template` prompt. Then...
llama_index/docs/module_guides/deploying/query_engine/response_modes.md/0
{ "file_path": "llama_index/docs/module_guides/deploying/query_engine/response_modes.md", "repo_id": "llama_index", "token_count": 881 }
1,091
from enum import Enum from langchain_core.exceptions import OutputParserException from langchain.output_parsers.enum import EnumOutputParser class Colors(Enum): RED = "red" GREEN = "green" BLUE = "blue" def test_enum_output_parser_parse() -> None: parser = EnumOutputParser(enum=Colors) # Test...
langchain/libs/langchain/tests/unit_tests/output_parsers/test_enum_parser.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/output_parsers/test_enum_parser.py", "repo_id": "langchain", "token_count": 248 }
603
use futures::executor::block_on; use tantivy::schema::{Field, IndexRecordOption, Schema, TextFieldIndexing, TextOptions, INDEXED}; use tantivy::{doc, tokenizer, Index, IndexWriter}; use crate::data_type::TantivyDataType; pub struct IndexWriterWrapper { pub field_name: String, pub field: Field, pub data_t...
milvus/internal/core/thirdparty/tantivy/tantivy-binding/src/index_writer.rs/0
{ "file_path": "milvus/internal/core/thirdparty/tantivy/tantivy-binding/src/index_writer.rs", "repo_id": "milvus", "token_count": 1579 }
1,752
<jupyter_start><jupyter_text>Q&A System Correctness[](https://colab.research.google.com/github/langchain-ai/langsmith-cookbook/blob/main/testing-examples/qa-correctness/qa-correctness.ipynb)Evaluating a question and answer systems can help you improve its system design as well as the prompt and model quality. We tend t...
langsmith-cookbook/testing-examples/qa-correctness/qa-correctness.ipynb/0
{ "file_path": "langsmith-cookbook/testing-examples/qa-correctness/qa-correctness.ipynb", "repo_id": "langsmith-cookbook", "token_count": 4805 }
1,140
from langchain_community.docstore.wikipedia import Wikipedia __all__ = ["Wikipedia"]
langchain/libs/langchain/langchain/docstore/wikipedia.py/0
{ "file_path": "langchain/libs/langchain/langchain/docstore/wikipedia.py", "repo_id": "langchain", "token_count": 22 }
498
"""Load question answering with sources chains.""" from langchain.chains.qa_with_sources.loading import load_qa_with_sources_chain __all__ = ["load_qa_with_sources_chain"]
langchain/libs/langchain/langchain/chains/qa_with_sources/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/qa_with_sources/__init__.py", "repo_id": "langchain", "token_count": 54 }
463
<script lang="ts"> import type { PageData, ActionData } from "./$types"; import { page } from "$app/stores"; import AssistantSettings from "$lib/components/AssistantSettings.svelte"; export let data: PageData; export let form: ActionData; $: assistant = data.assistants.find((el) => el._id.toString() === $page.p...
chat-ui/src/routes/settings/assistants/[assistantId]/edit/+page.svelte/0
{ "file_path": "chat-ui/src/routes/settings/assistants/[assistantId]/edit/+page.svelte", "repo_id": "chat-ui", "token_count": 130 }
113
import { UnstructuredLoader } from "langchain/document_loaders/fs/unstructured"; const options = { apiKey: "MY_API_KEY", }; const loader = new UnstructuredLoader( "src/document_loaders/example_data/notion.md", options ); const docs = await loader.load();
langchainjs/examples/src/document_loaders/unstructured.ts/0
{ "file_path": "langchainjs/examples/src/document_loaders/unstructured.ts", "repo_id": "langchainjs", "token_count": 88 }
786
<!--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/markuplm.md/0
{ "file_path": "transformers/docs/source/en/model_doc/markuplm.md", "repo_id": "transformers", "token_count": 3443 }
495
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/models/big_bird/test_modeling_flax_big_bird.py/0
{ "file_path": "transformers/tests/models/big_bird/test_modeling_flax_big_bird.py", "repo_id": "transformers", "token_count": 3793 }
708
// 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/redo.go/0
{ "file_path": "milvus/internal/rootcoord/redo.go", "repo_id": "milvus", "token_count": 737 }
1,787
"""Tool runner component.""" from typing import Any, Dict, Optional, Sequence, cast from llama_index.legacy.bridge.pydantic import Field from llama_index.legacy.callbacks import ( CallbackManager, CBEventType, EventPayload, ) from llama_index.legacy.callbacks.base import CallbackManager from llama_index.l...
llama_index/llama-index-legacy/llama_index/legacy/query_pipeline/components/tool_runner.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/query_pipeline/components/tool_runner.py", "repo_id": "llama_index", "token_count": 1586 }
1,591
# 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/segformer/test_modeling_tf_segformer.py/0
{ "file_path": "transformers/tests/models/segformer/test_modeling_tf_segformer.py", "repo_id": "transformers", "token_count": 9892 }
811
<jupyter_start><jupyter_text>Multi-Modal OpenAI Image Generation + GPT-4V<jupyter_code>import os from PIL import Image from IPython.display import display from llama_index.tools.openai.image_generation import OpenAIImageGenerationToolSpec image_generation_tool = OpenAIImageGenerationToolSpec( api_key=os.environ["...
llama_index/llama-index-integrations/tools/llama-index-tools-openai/examples/multimodal_openai_image.ipynb/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-openai/examples/multimodal_openai_image.ipynb", "repo_id": "llama_index", "token_count": 369 }
1,520
from langchain_community.document_loaders.parsers.language.cobol import CobolSegmenter EXAMPLE_CODE = """ IDENTIFICATION DIVISION. PROGRAM-ID. SampleProgram. DATA DIVISION. WORKING-STORAGE SECTION. 01 SAMPLE-VAR PIC X(20) VALUE 'Sample Value'. PROCEDURE DIVISION. A000-INITIALIZE-PARA. DISPLAY 'Initiali...
langchain/libs/community/tests/unit_tests/document_loaders/parsers/language/test_cobol.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/parsers/language/test_cobol.py", "repo_id": "langchain", "token_count": 680 }
365
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team, The Hugging Face Team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
transformers/src/transformers/models/dpr/tokenization_dpr_fast.py/0
{ "file_path": "transformers/src/transformers/models/dpr/tokenization_dpr_fast.py", "repo_id": "transformers", "token_count": 8418 }
679
import logging logger = logging.getLogger(__name__)
langgraph/langgraph/pregel/log.py/0
{ "file_path": "langgraph/langgraph/pregel/log.py", "repo_id": "langgraph", "token_count": 18 }
1,077
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-readwise/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-readwise/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,371
export interface GAEvent { hitType: "event"; eventCategory: string; eventAction: string; eventLabel?: string; eventValue?: number; } // Send a Google Analytics event export function sendAnalyticsEvent({ eventCategory, eventAction, eventLabel, eventValue, }: Omit<GAEvent, "hitType">): void { // Mandatory fiel...
chat-ui/src/lib/utils/analytics.ts/0
{ "file_path": "chat-ui/src/lib/utils/analytics.ts", "repo_id": "chat-ui", "token_count": 313 }
104
import type { BaseChatModel } from "../language_models/chat_models.js"; import type { BasePromptTemplate } from "../prompts/base.js"; import type { BaseLanguageModelInterface } from "../language_models/base.js"; import type { BaseLLM } from "../language_models/llms.js"; import type { PartialValues } from "../utils/type...
langchainjs/langchain-core/src/example_selectors/conditional.ts/0
{ "file_path": "langchainjs/langchain-core/src/example_selectors/conditional.ts", "repo_id": "langchainjs", "token_count": 970 }
873
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/lycoris_utils.py/0
{ "file_path": "peft/src/peft/tuners/lycoris_utils.py", "repo_id": "peft", "token_count": 6993 }
319
# Additional Readings [[additional-readings]] These are **optional readings** if you want to go deeper. ## Deep Reinforcement Learning [[deep-rl]] - [Reinforcement Learning: An Introduction, Richard Sutton and Andrew G. Barto Chapter 1, 2 and 3](http://incompleteideas.net/book/RLbook2020.pdf) - [Foundations of Deep ...
deep-rl-class/units/en/unit1/additional-readings.mdx/0
{ "file_path": "deep-rl-class/units/en/unit1/additional-readings.mdx", "repo_id": "deep-rl-class", "token_count": 246 }
157
<jupyter_start><jupyter_text>Eleven Labs Text2SpeechThis notebook shows how to interact with the `ElevenLabs API` to achieve text-to-speech capabilities. First, you need to set up an ElevenLabs account. You can follow the instructions [here](https://docs.elevenlabs.io/welcome/introduction).<jupyter_code>%pip install --...
langchain/docs/docs/integrations/tools/eleven_labs_tts.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/eleven_labs_tts.ipynb", "repo_id": "langchain", "token_count": 509 }
168
from langchain.schema.language_model import __all__ EXPECTED_ALL = [ "BaseLanguageModel", "_get_token_ids_default_method", "get_tokenizer", "LanguageModelOutput", "LanguageModelInput", ] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
langchain/libs/langchain/tests/unit_tests/schema/test_language_model.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/schema/test_language_model.py", "repo_id": "langchain", "token_count": 111 }
672
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/pipelines/test_pipelines_text_classification.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_text_classification.py", "repo_id": "transformers", "token_count": 3566 }
855
import { sveltekit } from "@sveltejs/kit/vite"; import { defineConfig, type PluginOption } from "vite"; import Icons from "unplugin-icons/vite"; import { promises } from "fs"; // used to load fonts server side for thumbnail generation function loadTTFAsArrayBuffer(): PluginOption { return { name: "load-ttf-as-array...
chat-ui/vite.config.ts/0
{ "file_path": "chat-ui/vite.config.ts", "repo_id": "chat-ui", "token_count": 272 }
115
"""Loader that uses unstructured to load HTML files.""" import logging from typing import Any, Iterator, List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) class NewsURLLoader(BaseLoader): """Load news article...
langchain/libs/community/langchain_community/document_loaders/news.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/news.py", "repo_id": "langchain", "token_count": 2026 }
241
<jupyter_start><jupyter_text>Create a runnable with the `@chain` decoratorYou can also turn an arbitrary function into a chain by adding a `@chain` decorator. This is functionaly equivalent to wrapping in a [`RunnableLambda`](./functions).This will have the benefit of improved observability by tracing your chain correc...
langchain/docs/docs/expression_language/how_to/decorator.ipynb/0
{ "file_path": "langchain/docs/docs/expression_language/how_to/decorator.ipynb", "repo_id": "langchain", "token_count": 438 }
90
export * from "@langchain/core/tracers/tracer_langchain";
langchainjs/langchain/src/callbacks/handlers/tracer_langchain.ts/0
{ "file_path": "langchainjs/langchain/src/callbacks/handlers/tracer_langchain.ts", "repo_id": "langchainjs", "token_count": 19 }
877
#!/usr/bin/env python3 import logging import sys import time from dataclasses import field from pathlib import Path from typing import Dict, List, Optional, Union import flax import jax import jax.numpy as jnp import librosa import numpy as np import optax from datasets import DatasetDict, load_dataset from flax impor...
transformers/examples/research_projects/jax-projects/wav2vec2/run_wav2vec2_pretrain_flax.py/0
{ "file_path": "transformers/examples/research_projects/jax-projects/wav2vec2/run_wav2vec2_pretrain_flax.py", "repo_id": "transformers", "token_count": 10483 }
546
// 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/datacoord/compaction.go/0
{ "file_path": "milvus/internal/datacoord/compaction.go", "repo_id": "milvus", "token_count": 7815 }
1,825
from langchain_community.llms.huggingface_endpoint import ( HuggingFaceEndpoint, ) __all__ = ["HuggingFaceEndpoint"]
langchain/libs/langchain/langchain/llms/huggingface_endpoint.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/huggingface_endpoint.py", "repo_id": "langchain", "token_count": 44 }
538
# 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/owlvit/test_modeling_owlvit.py/0
{ "file_path": "transformers/tests/models/owlvit/test_modeling_owlvit.py", "repo_id": "transformers", "token_count": 15293 }
817
import sys from unittest.mock import MagicMock import pytest from llama_index.core.ingestion.data_sinks import ( ConfigurableDataSinks, ConfiguredDataSink, ) try: from llama_index.vector_store.weaviate import WeaviateVectorStore except ImportError: WeaviateVectorStore = None @pytest.mark.parametrize...
llama_index/llama-index-core/tests/ingestion/test_data_sinks.py/0
{ "file_path": "llama_index/llama-index-core/tests/ingestion/test_data_sinks.py", "repo_id": "llama_index", "token_count": 1018 }
1,161
from langchain_core.exceptions import LangChainException class InvalidKeyException(LangChainException): """Raised when a key is invalid; e.g., uses incorrect characters."""
langchain/libs/community/langchain_community/storage/exceptions.py/0
{ "file_path": "langchain/libs/community/langchain_community/storage/exceptions.py", "repo_id": "langchain", "token_count": 47 }
279
<jupyter_start><jupyter_text>Document ComparisonThis notebook shows how to use an agent to compare two documents.The high level idea is we will create a question-answering chain for each document, and then use that<jupyter_code>from langchain.agents import Tool from langchain.chains import RetrievalQA from langchain.te...
langchain/docs/docs/integrations/toolkits/document_comparison_toolkit.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/toolkits/document_comparison_toolkit.ipynb", "repo_id": "langchain", "token_count": 1776 }
169
--- sidebar_class_name: hidden --- # Moderation This notebook walks through examples of how to use a moderation chain, and several common ways for doing so. Moderation chains are useful for detecting text that could be hateful, violent, etc. This can be useful to apply on both user input, but also on the output of a ...
langchainjs/docs/core_docs/docs/modules/chains/additional/moderation.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/chains/additional/moderation.mdx", "repo_id": "langchainjs", "token_count": 392 }
727
from enum import Enum from typing import Dict, Type from llama_index.legacy.vector_stores.bagel import BagelVectorStore from llama_index.legacy.vector_stores.cassandra import CassandraVectorStore from llama_index.legacy.vector_stores.chatgpt_plugin import ChatGPTRetrievalPluginClient from llama_index.legacy.vector_sto...
llama_index/llama-index-legacy/llama_index/legacy/vector_stores/registry.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/vector_stores/registry.py", "repo_id": "llama_index", "token_count": 1270 }
1,655
# coding=utf-8 # Copyright 2022 Meta Platforms, Inc. 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/regnet/modeling_tf_regnet.py/0
{ "file_path": "transformers/src/transformers/models/regnet/modeling_tf_regnet.py", "repo_id": "transformers", "token_count": 10486 }
733
"""Models for the Constitutional AI chain.""" from langchain_core.pydantic_v1 import BaseModel class ConstitutionalPrinciple(BaseModel): """Class for a constitutional principle.""" critique_request: str revision_request: str name: str = "Constitutional Principle"
langchain/libs/langchain/langchain/chains/constitutional_ai/models.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/constitutional_ai/models.py", "repo_id": "langchain", "token_count": 80 }
464
/* Elements */ a { color: #2878A2; word-wrap: break-word; } a:focus { outline: none; } /* Anchor links */ a.headerlink { color: #c60f0f; font-size: 0.8em; padding: 0 4px 0 4px; text-decoration: none; visibility: hidden; } a.headerlink:hover { background-color: #c60f0f; color: white; } p { wor...
langchain/docs/api_reference/themes/scikit-learn-modern/static/css/theme.css/0
{ "file_path": "langchain/docs/api_reference/themes/scikit-learn-modern/static/css/theme.css", "repo_id": "langchain", "token_count": 10864 }
80
CREATE TABLE embeddings_queue ( seq_id INTEGER PRIMARY KEY, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, operation INTEGER NOT NULL, topic TEXT NOT NULL, id TEXT NOT NULL, vector BLOB, encoding TEXT, metadata TEXT );
chroma/chromadb/migrations/embeddings_queue/00001-embeddings.sqlite.sql/0
{ "file_path": "chroma/chromadb/migrations/embeddings_queue/00001-embeddings.sqlite.sql", "repo_id": "chroma", "token_count": 99 }
15
""" Ensemble retriever that ensemble the results of multiple retrievers by using weighted Reciprocal Rank Fusion """ import asyncio from typing import Any, Dict, List, Optional, cast from langchain_core.callbacks import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_c...
langchain/libs/langchain/langchain/retrievers/ensemble.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/ensemble.py", "repo_id": "langchain", "token_count": 4406 }
532
// 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/grpcclient/grpc_encoder.go/0
{ "file_path": "milvus/internal/util/grpcclient/grpc_encoder.go", "repo_id": "milvus", "token_count": 755 }
1,878
[package] name = "candle-wasm-example-sam" version.workspace = true edition.workspace = true description.workspace = true repository.workspace = true keywords.workspace = true categories.workspace = true license.workspace = true [dependencies] candle = { workspace = true } candle-nn = { workspace = true } candle-trans...
candle/candle-wasm-examples/segment-anything/Cargo.toml/0
{ "file_path": "candle/candle-wasm-examples/segment-anything/Cargo.toml", "repo_id": "candle", "token_count": 264 }
85
<jupyter_start><jupyter_text>DocArray>[DocArray](https://github.com/docarray/docarray) is a versatile, open-source tool for managing your multi-modal data. It lets you shape your data however you want, and offers the flexibility to store and search it using various document index backends. Plus, it gets even better - y...
langchain/docs/docs/integrations/retrievers/docarray_retriever.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/docarray_retriever.ipynb", "repo_id": "langchain", "token_count": 5050 }
164
// 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/exec/expression/BinaryArithOpEvalRangeExpr.h/0
{ "file_path": "milvus/internal/core/src/exec/expression/BinaryArithOpEvalRangeExpr.h", "repo_id": "milvus", "token_count": 4836 }
1,643
from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence from llama_index.core.base.base_selector import ( BaseSelector, MultiSelection, SelectorResult, SingleSelection, ) from llama_index.core.prompts.mixin import PromptDictType from llama_index.core.schema import QueryBundle from llama_index.c...
llama_index/llama-index-core/llama_index/core/selectors/pydantic_selectors.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/selectors/pydantic_selectors.py", "repo_id": "llama_index", "token_count": 2484 }
1,297
"""Test MongoDB Atlas Vector Search functionality.""" from __future__ import annotations import os from time import sleep from typing import List import pytest try: from pymongo import MongoClient INDEX_NAME = "llamaindex-test-index" NAMESPACE = "llamaindex_test_db.llamaindex_test_collection" CONNE...
llama_index/llama-index-legacy/tests/vector_stores/test_mongodb.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/vector_stores/test_mongodb.py", "repo_id": "llama_index", "token_count": 1983 }
1,549
from llama_index.legacy.multi_modal_llms.base import ( MultiModalLLM, MultiModalLLMMetadata, ) from llama_index.legacy.multi_modal_llms.dashscope import ( DashScopeMultiModal, DashScopeMultiModalModels, ) from llama_index.legacy.multi_modal_llms.gemini import GeminiMultiModal from llama_index.legacy.mul...
llama_index/llama-index-legacy/llama_index/legacy/multi_modal_llms/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/multi_modal_llms/__init__.py", "repo_id": "llama_index", "token_count": 315 }
1,591
import { type StructuredToolInterface, type ToolInterface, ToolInputParsingException, Tool, } from "@langchain/core/tools"; import { Runnable, type RunnableConfig } from "@langchain/core/runnables"; import { AgentAction, AgentFinish, AgentStep } from "@langchain/core/agents"; import { ChainValues } from "@langc...
langchainjs/langchain/src/agents/executor.ts/0
{ "file_path": "langchainjs/langchain/src/agents/executor.ts", "repo_id": "langchainjs", "token_count": 8441 }
838
import { test, expect } from "@jest/globals"; import * as url from "node:url"; import * as path from "node:path"; import * as fs from "node:fs/promises"; import { PDFLoader } from "../fs/pdf.js"; test("Test PDF loader from blob", async () => { const filePath = path.resolve( path.dirname(url.fileURLToPath(import....
langchainjs/langchain/src/document_loaders/tests/pdf-blob.test.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/pdf-blob.test.ts", "repo_id": "langchainjs", "token_count": 674 }
895
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "vectorstores/typesense", }); export * from "@langchain/community/vectorstores/typesense";
langchainjs/langchain/src/vectorstores/typesense.ts/0
{ "file_path": "langchainjs/langchain/src/vectorstores/typesense.ts", "repo_id": "langchainjs", "token_count": 72 }
984
--- hide_table_of_contents: true sidebar_label: Memory sidebar_position: 1 --- import CodeBlock from "@theme/CodeBlock"; # `MemoryVectorStore` MemoryVectorStore is an in-memory, ephemeral vectorstore that stores embeddings in-memory and does an exact, linear search for the most similar embeddings. The default simila...
langchainjs/docs/core_docs/docs/integrations/vectorstores/memory.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/vectorstores/memory.mdx", "repo_id": "langchainjs", "token_count": 356 }
795
from langchain_community.llms.cerebriumai import CerebriumAI __all__ = ["CerebriumAI"]
langchain/libs/langchain/langchain/llms/cerebriumai.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/cerebriumai.py", "repo_id": "langchain", "token_count": 32 }
509
from langchain.tools.base import __all__ EXPECTED_ALL = [ "BaseTool", "SchemaAnnotationError", "StructuredTool", "Tool", "ToolException", "create_schema_from_function", "tool", ] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
langchain/libs/langchain/tests/unit_tests/tools/test_base.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/tools/test_base.py", "repo_id": "langchain", "token_count": 120 }
614
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Callable, Iterator, List, Optional, Sequence, Union, ) from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader _NOT_SET = object() if TYPE_CHECKING: ...
langchain/libs/community/langchain_community/document_loaders/cassandra.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/cassandra.py", "repo_id": "langchain", "token_count": 1918 }
228
<jupyter_start><jupyter_text>Il est temps de trancher et de découper Installez les bibliothèques 🤗 Transformers et 🤗 Datasets pour exécuter ce *notebook*.<jupyter_code>!pip install datasets evaluate transformers[sentencepiece] !wget "https://archive.ics.uci.edu/ml/machine-learning-databases/00462/drugsCom_raw.zip" !u...
notebooks/course/fr/chapter5/section3.ipynb/0
{ "file_path": "notebooks/course/fr/chapter5/section3.ipynb", "repo_id": "notebooks", "token_count": 1912 }
286
# RAG with Multiple Indexes (Routing) A QA application that routes between different domain-specific retrievers given a user question. ## Environment Setup This application queries PubMed, ArXiv, Wikipedia, and [Kay AI](https://www.kay.ai) (for SEC filings). You will need to create a free Kay AI account and [get yo...
langchain/templates/rag-multi-index-router/README.md/0
{ "file_path": "langchain/templates/rag-multi-index-router/README.md", "repo_id": "langchain", "token_count": 685 }
737
# Contributing to langchain-cli Update CLI versions with `poe bump` to ensure that version commands display correctly.
langchain/libs/cli/CONTRIBUTING.md/0
{ "file_path": "langchain/libs/cli/CONTRIBUTING.md", "repo_id": "langchain", "token_count": 28 }
211
# LlamaIndex Postprocessor Integration: Cohere Rerank
llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-cohere-rerank/README.md/0
{ "file_path": "llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-cohere-rerank/README.md", "repo_id": "llama_index", "token_count": 14 }
1,434
--- hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; import Example from "@examples/retrievers/parent_document_retriever.ts"; import ExampleWithScoreThreshold from "@examples/retrievers/parent_document_retriever_score_threshold.ts"; # Parent Document Retriever When splitting documents for r...
langchainjs/docs/core_docs/docs/modules/data_connection/retrievers/parent-document-retriever.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/retrievers/parent-document-retriever.mdx", "repo_id": "langchainjs", "token_count": 530 }
764
import { GoogleVertexAILLMConnection } from "../../utils/googlevertexai-connection.js"; import { WebGoogleAuthOptions, WebGoogleAuth, } from "../../utils/googlevertexai-webauth.js"; import { BaseChatGoogleVertexAI, GoogleVertexAIChatInput } from "./common.js"; /** * Enables calls to the Google Cloud's Vertex AI A...
langchainjs/libs/langchain-community/src/chat_models/googlevertexai/web.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/chat_models/googlevertexai/web.ts", "repo_id": "langchainjs", "token_count": 627 }
977
# 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/deprecated/stochastic_karras_ve/pipeline_stochastic_karras_ve.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/deprecated/stochastic_karras_ve/pipeline_stochastic_karras_ve.py", "repo_id": "diffusers", "token_count": 2264 }
235