text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from typing import Any, Mapping, Sequence, Union from langgraph.channels.base import BaseChannel from langgraph.channels.last_value import LastValue from langgraph.pregel.read import ChannelBatch, ChannelInvoke from langgraph.pregel.reserved import ReservedChannels def validate_graph( nodes: Mapping[str, Union[C...
langgraph/langgraph/pregel/validate.py/0
{ "file_path": "langgraph/langgraph/pregel/validate.py", "repo_id": "langgraph", "token_count": 1071 }
1,020
import argparse import evaluate import torch from accelerate import Accelerator, DistributedDataParallelKwargs from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_li...
peft/examples/sequence_classification/peft_no_lora_accelerate.py/0
{ "file_path": "peft/examples/sequence_classification/peft_no_lora_accelerate.py", "repo_id": "peft", "token_count": 3361 }
342
<!--Copyright 2021 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/canine.md/0
{ "file_path": "transformers/docs/source/en/model_doc/canine.md", "repo_id": "transformers", "token_count": 1723 }
451
from typing import List import pytest from llama_index.legacy.schema import BaseNode, Document from llama_index.legacy.storage.docstore.mongo_docstore import MongoDocumentStore from llama_index.legacy.storage.kvstore.mongodb_kvstore import MongoDBKVStore try: from pymongo import MongoClient except ImportError: ...
llama_index/llama-index-legacy/tests/storage/docstore/test_mongo_docstore.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/storage/docstore/test_mongo_docstore.py", "repo_id": "llama_index", "token_count": 808 }
1,635
[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 = ["ElasticsearchEmbedding"] contains_example = false import_path = "llama_index.embeddings.e...
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-elasticsearch/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-elasticsearch/pyproject.toml", "repo_id": "llama_index", "token_count": 654 }
1,227
from __future__ import annotations import uuid from typing import TYPE_CHECKING, Any, Iterable, List, Optional, Tuple, Union from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.utils import get_from_env from langchain_core.vectorstores import VectorStore ...
langchain/libs/community/langchain_community/vectorstores/typesense.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/typesense.py", "repo_id": "langchain", "token_count": 4459 }
314
from langchain_community.tools.searchapi.tool import SearchAPIResults, SearchAPIRun __all__ = ["SearchAPIRun", "SearchAPIResults"]
langchain/libs/langchain/langchain/tools/searchapi/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/searchapi/tool.py", "repo_id": "langchain", "token_count": 43 }
556
<jupyter_start><jupyter_text>Trubrics>[Trubrics](https://trubrics.com) is an LLM user analytics platform that lets you collect, analyse and manage userprompts & feedback on AI models.>>Check out [Trubrics repo](https://github.com/trubrics/trubrics-sdk) for more information on `Trubrics`.In this guide, we will go over h...
langchain/docs/docs/integrations/callbacks/trubrics.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/callbacks/trubrics.ipynb", "repo_id": "langchain", "token_count": 1276 }
90
"""Docugami reader.""" import hashlib import io import logging import os import requests from pathlib import Path from typing import Any, Dict, List, Mapping, Optional, Sequence, Union from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document from dgml_utils.models import Chu...
llama_index/llama-index-integrations/readers/llama-index-readers-docugami/llama_index/readers/docugami/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-docugami/llama_index/readers/docugami/base.py", "repo_id": "llama_index", "token_count": 6692 }
1,394
# These kubernetes manifests are UNDER ACTIVE DEVELOPMENT and are not yet ready for production use. # They will be used for the upcoming distributed version of chroma. They are not even ready # for testing yet. Please do not use them unless you are working on the distributed version of chroma. apiVersion: v1 kind: Na...
chroma/k8s/deployment/kubernetes.yaml/0
{ "file_path": "chroma/k8s/deployment/kubernetes.yaml", "repo_id": "chroma", "token_count": 2594 }
57
<jupyter_start><jupyter_text>Generate a Certificate```bashopenssl req -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 \ -keyout ./serverkey.pem \ -out ./servercert.pem \ -subj "/O=Chroma/C=US" \ -config chromadb/test/openssl.cnf```> Note: The above command should be executed at the root of the repo (openssl.cn...
chroma/docs/cip/assets/CIP-01022024-test_self_signed.ipynb/0
{ "file_path": "chroma/docs/cip/assets/CIP-01022024-test_self_signed.ipynb", "repo_id": "chroma", "token_count": 387 }
39
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/pipelines/test_pipelines_video_classification.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_video_classification.py", "repo_id": "transformers", "token_count": 1516 }
763
<jupyter_start><jupyter_text>Bookend AILet's load the Bookend AI Embeddings class.<jupyter_code>from langchain_community.embeddings import BookendEmbeddings embeddings = BookendEmbeddings( domain="your_domain", api_token="your_api_token", model_id="your_embeddings_model_id", ) text = "This is a test documen...
langchain/docs/docs/integrations/text_embedding/bookend.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/bookend.ipynb", "repo_id": "langchain", "token_count": 161 }
161
import { GradientEmbeddings } from "@langchain/community/embeddings/gradient_ai"; const model = new GradientEmbeddings({}); const res = await model.embedQuery( "What would be a good company name a company that makes colorful socks?" ); console.log({ res });
langchainjs/examples/src/embeddings/gradient_ai.ts/0
{ "file_path": "langchainjs/examples/src/embeddings/gradient_ai.ts", "repo_id": "langchainjs", "token_count": 73 }
814
# coding=utf-8 # Copyright 2021 The UCLA NLP 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/visual_bert/modeling_visual_bert.py/0
{ "file_path": "transformers/src/transformers/models/visual_bert/modeling_visual_bert.py", "repo_id": "transformers", "token_count": 29493 }
684
<!--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/de/preprocessing.md/0
{ "file_path": "transformers/docs/source/de/preprocessing.md", "repo_id": "transformers", "token_count": 10556 }
490
<jupyter_start><jupyter_text>Pandas DataFrame ParserA Pandas DataFrame is a popular data structure in the Python programming language, commonly used for data manipulation and analysis. It provides a comprehensive set of tools for working with structured data, making it a versatile option for tasks such as data cleaning...
langchain/docs/docs/modules/model_io/output_parsers/types/pandas_dataframe.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/output_parsers/types/pandas_dataframe.ipynb", "repo_id": "langchain", "token_count": 1066 }
213
from langchain_experimental.agents.agent_toolkits import ( create_csv_agent, create_pandas_dataframe_agent, create_spark_dataframe_agent, create_xorbits_agent, ) __all__ = [ "create_csv_agent", "create_pandas_dataframe_agent", "create_spark_dataframe_agent", "create_xorbits_agent", ]
langchain/libs/experimental/langchain_experimental/agents/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/agents/__init__.py", "repo_id": "langchain", "token_count": 134 }
423
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-chatgpt-plugin/llama_index/readers/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-chatgpt-plugin/llama_index/readers/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,300
<jupyter_start><jupyter_text>Custom output parsersIf there is a custom format you want to transform a model's output into, you can subclass and create your own output parser.The simplest kind of output parser extends the [`BaseOutputParser` class](https://api.js.langchain.com/classes/langchain_core_output_parsers.BaseO...
langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/custom.ipynb/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/custom.ipynb", "repo_id": "langchainjs", "token_count": 3118 }
818
# Copyright 2024 ETH Zurich Computer Vision Lab 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...
diffusers/src/diffusers/pipelines/deprecated/repaint/pipeline_repaint.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/deprecated/repaint/pipeline_repaint.py", "repo_id": "diffusers", "token_count": 4202 }
233
# Pydantic compatibility - Pydantic v2 was released in June, 2023 (https://docs.pydantic.dev/2.0/blog/pydantic-v2-final/) - v2 contains has a number of breaking changes (https://docs.pydantic.dev/2.0/migration/) - Pydantic v2 and v1 are under the same package name, so both versions cannot be installed at the same time...
langchain/docs/docs/guides/pydantic_compatibility.md/0
{ "file_path": "langchain/docs/docs/guides/pydantic_compatibility.md", "repo_id": "langchain", "token_count": 1002 }
91
from typing import Callable def is_documented_by(function_with_docstring: Callable): """Decorator to share docstrings across common functions. Args: function_with_docstring (`Callable`): Name of the function with the docstring. """ def wrapper(target_function): target_function.__doc_...
datasets/src/datasets/utils/doc_utils.py/0
{ "file_path": "datasets/src/datasets/utils/doc_utils.py", "repo_id": "datasets", "token_count": 137 }
145
import { WeaviateFilter, WeaviateStore, } from "@langchain/community/vectorstores/weaviate"; import { Comparator, Comparators, Comparison, NOT, Operation, Operator, Operators, StructuredQuery, Visitor, } from "../../chains/query_constructor/ir.js"; import { BaseTranslator } from "./base.js"; impor...
langchainjs/langchain/src/retrievers/self_query/weaviate.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/self_query/weaviate.ts", "repo_id": "langchainjs", "token_count": 2841 }
919
import type { AwsCredentialIdentity, Provider } from "@aws-sdk/types"; export type CredentialType = | AwsCredentialIdentity | Provider<AwsCredentialIdentity>; /** Bedrock models. To authenticate, the AWS client uses the following methods to automatically load credentials: https://boto3.amazonaws.com/v1/do...
langchainjs/libs/langchain-community/src/utils/bedrock.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/utils/bedrock.ts", "repo_id": "langchainjs", "token_count": 1554 }
1,010
node_modules build .docusaurus docs/api docs/_static static
langchainjs/docs/core_docs/.prettierignore/0
{ "file_path": "langchainjs/docs/core_docs/.prettierignore", "repo_id": "langchainjs", "token_count": 21 }
744
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/examples/instruct_pix2pix/test_instruct_pix2pix.py/0
{ "file_path": "diffusers/examples/instruct_pix2pix/test_instruct_pix2pix.py", "repo_id": "diffusers", "token_count": 1823 }
214
from concurrent.futures import ThreadPoolExecutor from chromadb.api.client import AdminClient, Client from chromadb.config import DEFAULT_TENANT def test_multiple_clients_concurrently(client: Client) -> None: """Tests running multiple clients, each against their own database, concurrently.""" client.reset() ...
chroma/chromadb/test/client/test_multiple_clients_concurrency.py/0
{ "file_path": "chroma/chromadb/test/client/test_multiple_clients_concurrency.py", "repo_id": "chroma", "token_count": 652 }
22
poetry_requirements( name="poetry", module_mapping={"google-api-python-client": ["googleapiclient"], "google-auth-oauthlib": ["google_auth_oauthlib"]} ) python_requirements( name="reqs", ) python_sources( interpreter_constraints=["==3.10.*"], )
llama_index/llama-index-integrations/readers/llama-index-readers-google/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-google/BUILD", "repo_id": "llama_index", "token_count": 106 }
1,450
--- sidebar_class_name: hidden hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; import Extraction from "@examples/chains/openai_functions_extraction.ts"; # `Extraction` :::tip Compatibility Must be used with an [OpenAI Functions](https://platform.openai.com/docs/guides/gpt/function-calling)...
langchainjs/docs/core_docs/docs/modules/chains/additional/openai_functions/extraction.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/chains/additional/openai_functions/extraction.mdx", "repo_id": "langchainjs", "token_count": 211 }
758
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/src/diffusers/models/normalization.py/0
{ "file_path": "diffusers/src/diffusers/models/normalization.py", "repo_id": "diffusers", "token_count": 4029 }
241
"""Base agent type.""" import uuid from abc import abstractmethod from typing import Any, Dict, List, Optional from llama_index.legacy.bridge.pydantic import BaseModel, Field from llama_index.legacy.callbacks import CallbackManager, trace_method from llama_index.legacy.chat_engine.types import ( BaseChatEngine, ...
llama_index/llama-index-legacy/llama_index/legacy/agent/types.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/agent/types.py", "repo_id": "llama_index", "token_count": 2933 }
1,579
import { test, expect } from "@jest/globals"; import { Document } from "@langchain/core/documents"; import { FakeEmbeddings } from "@langchain/core/utils/testing"; import { VoyVectorStore, VoyClient } from "../voy.js"; const fakeClient: VoyClient = { index: ({ embeddings }) => embeddings.map((i) => i.id).join(","), ...
langchainjs/libs/langchain-community/src/vectorstores/tests/voy.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/voy.test.ts", "repo_id": "langchainjs", "token_count": 635 }
1,055
import { Redis } from "ioredis"; import { BufferMemory } from "langchain/memory"; import { RedisChatMessageHistory } from "@langchain/community/stores/message/ioredis"; import { ChatOpenAI } from "@langchain/openai"; import { ConversationChain } from "langchain/chains"; const client = new Redis("redis://localhost:6379...
langchainjs/examples/src/memory/redis-advanced.ts/0
{ "file_path": "langchainjs/examples/src/memory/redis-advanced.ts", "repo_id": "langchainjs", "token_count": 340 }
889
from typing import Any, Optional from langchain_core.runnables.base import Input, Output, RunnableBindingBase class HubRunnable(RunnableBindingBase[Input, Output]): """ An instance of a runnable stored in the LangChain Hub. """ owner_repo_commit: str def __init__( self, owner_re...
langchain/libs/langchain/langchain/runnables/hub.py/0
{ "file_path": "langchain/libs/langchain/langchain/runnables/hub.py", "repo_id": "langchain", "token_count": 385 }
573
// Code generated by mockery v2.32.4. DO NOT EDIT. package datacoord import ( sessionutil "github.com/milvus-io/milvus/internal/util/sessionutil" mock "github.com/stretchr/testify/mock" ) // MockVersionManager is an autogenerated mock type for the IndexEngineVersionManager type type MockVersionManager struct { mo...
milvus/internal/datacoord/mock_index_engine_version_manager.go/0
{ "file_path": "milvus/internal/datacoord/mock_index_engine_version_manager.go", "repo_id": "milvus", "token_count": 2755 }
1,795
# 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/...
transformers/src/transformers/models/mvp/configuration_mvp.py/0
{ "file_path": "transformers/src/transformers/models/mvp/configuration_mvp.py", "repo_id": "transformers", "token_count": 3390 }
698
package writebuffer import ( "math" "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" "github.com/milvus-io/milvus/internal/storage" "github.com/milvus-io/milvus/pkg/util/paramtable" "github.com/milvus-io/milvus/pkg/util/typeutil" ) type DeltaBuffer struct { BufferBase buffer *storage.DeleteData } func Ne...
milvus/internal/datanode/writebuffer/delta_buffer.go/0
{ "file_path": "milvus/internal/datanode/writebuffer/delta_buffer.go", "repo_id": "milvus", "token_count": 592 }
1,704
python_sources()
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-ollama/llama_index/multi_modal_llms/ollama/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-ollama/llama_index/multi_modal_llms/ollama/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,429
from typing import Dict, Iterator, List, Optional, Tuple, Union from .. import AddedToken, Tokenizer, decoders, pre_tokenizers, trainers from ..models import BPE from ..normalizers import BertNormalizer, Lowercase, Sequence, unicode_normalizer_from_str from .base_tokenizer import BaseTokenizer class CharBPETokenizer...
tokenizers/bindings/python/py_src/tokenizers/implementations/char_level_bpe.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/char_level_bpe.py", "repo_id": "tokenizers", "token_count": 2509 }
403
from llama_index.response_synthesizers.google.base import ( GoogleTextSynthesizer, SynthesizedResponse, ) from llama_index.vector_stores.google import set_google_config __all__ = [ "GoogleTextSynthesizer", "set_google_config", "SynthesizedResponse", ]
llama_index/llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/llama_index/response_synthesizers/google/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/llama_index/response_synthesizers/google/__init__.py", "repo_id": "llama_index", "token_count": 102 }
1,582
python_sources()
llama_index/llama-index-finetuning/llama_index/finetuning/embeddings/BUILD/0
{ "file_path": "llama_index/llama-index-finetuning/llama_index/finetuning/embeddings/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,282
# # 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 to in writing, software # distributed under the ...
milvus/internal/core/cmake/FindClangTools.cmake/0
{ "file_path": "milvus/internal/core/cmake/FindClangTools.cmake", "repo_id": "milvus", "token_count": 1388 }
1,651
<jupyter_start><jupyter_text>Pydantic ExtractorHere we test out the capabilities of our `PydanticProgramExtractor` - being able to extract out an entire Pydantic object using an LLM (either a standard text completion LLM or a function calling LLM).The advantage of this over using a "single" metadata extractor is that w...
llama_index/docs/examples/metadata_extraction/PydanticExtractor.ipynb/0
{ "file_path": "llama_index/docs/examples/metadata_extraction/PydanticExtractor.ipynb", "repo_id": "llama_index", "token_count": 1119 }
1,149
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-chroma/llama_index/vector_stores/chroma/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-chroma/llama_index/vector_stores/chroma/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,518
<jupyter_start><jupyter_text>IndexingHere, we will look at a basic indexing workflow using the LangChain indexing API. The indexing API lets you load and keep in sync documents from any source into a vector store. Specifically, it helps:* Avoid writing duplicated content into the vector store* Avoid re-writing unchange...
langchain/docs/docs/modules/data_connection/indexing.ipynb/0
{ "file_path": "langchain/docs/docs/modules/data_connection/indexing.ipynb", "repo_id": "langchain", "token_count": 3639 }
192
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { test } from "@jest/globals"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { SystemMessage, AIMessage, HumanMessage, } from "@langchain/core/messages"; import { ChatLlamaCpp } from "../llama_cpp.js"; const llamaP...
langchainjs/libs/langchain-community/src/chat_models/tests/chatllama_cpp.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/chat_models/tests/chatllama_cpp.int.test.ts", "repo_id": "langchainjs", "token_count": 864 }
951
import { OpenAI } from "@langchain/openai"; import { initializeAgentExecutorWithOptions } from "langchain/agents"; import { Calculator } from "langchain/tools/calculator"; import process from "process"; import { SerpAPI } from "@langchain/community/tools/serpapi"; export const run = async () => { process.env.LANGCHA...
langchainjs/examples/src/agents/mrkl_with_tracing.ts/0
{ "file_path": "langchainjs/examples/src/agents/mrkl_with_tracing.ts", "repo_id": "langchainjs", "token_count": 336 }
757
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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 cop...
transformers/src/transformers/models/electra/configuration_electra.py/0
{ "file_path": "transformers/src/transformers/models/electra/configuration_electra.py", "repo_id": "transformers", "token_count": 3700 }
599
--- hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; import WithoutReference from "@examples/guides/evaluation/string/criteria_without_reference.ts"; import WithReference from "@examples/guides/evaluation/string/criteria_with_reference.ts"; import Constitutional from "@examples/guides/evaluat...
langchainjs/docs/core_docs/docs/guides/evaluation/string/criteria.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/guides/evaluation/string/criteria.mdx", "repo_id": "langchainjs", "token_count": 1217 }
706
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/models/unets/test_models_unet_2d_condition.py/0
{ "file_path": "diffusers/tests/models/unets/test_models_unet_2d_condition.py", "repo_id": "diffusers", "token_count": 23035 }
271
import torch import torch.nn as nn import torch.nn.functional as F from .cross_entropy import LabelSmoothingCrossEntropy class JsdCrossEntropy(nn.Module): """ Jensen-Shannon Divergence + Cross-Entropy Loss Based on impl here: https://github.com/google-research/augmix/blob/master/imagenet.py From paper: ...
pytorch-image-models/timm/loss/jsd.py/0
{ "file_path": "pytorch-image-models/timm/loss/jsd.py", "repo_id": "pytorch-image-models", "token_count": 639 }
380
/* eslint-disable no-process-env */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import * as url from "node:url"; import * as path from "node:path"; import { test, expect } from "@jest/globals"; import { UnstructuredDirectoryLoader, UnstructuredLoader, UnknownHandling, } from "../fs/unstructured...
langchainjs/langchain/src/document_loaders/tests/unstructured.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/unstructured.int.test.ts", "repo_id": "langchainjs", "token_count": 644 }
897
import json from typing import Any, Dict, List, Optional from langchain_community.chat_models.ollama import ChatOllama from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models import BaseChatModel from langchain_core.messages import AIMessage, BaseMessage from langchain_core.ou...
langchain/libs/experimental/langchain_experimental/llms/ollama_functions.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/llms/ollama_functions.py", "repo_id": "langchain", "token_count": 2190 }
463
""" Polynomial Scheduler Polynomial LR schedule with warmup, noise. Hacked together by / Copyright 2021 Ross Wightman """ import math import logging import torch from .scheduler import Scheduler _logger = logging.getLogger(__name__) class PolyLRScheduler(Scheduler): """ Polynomial LR Scheduler w/ warmup, no...
pytorch-image-models/timm/scheduler/poly_lr.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/poly_lr.py", "repo_id": "pytorch-image-models", "token_count": 1967 }
408
<!--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 applicable law or agreed...
diffusers/docs/source/en/stable_diffusion.md/0
{ "file_path": "diffusers/docs/source/en/stable_diffusion.md", "repo_id": "diffusers", "token_count": 3962 }
190
import { check, randomSeed } from 'k6'; import http from 'k6/http'; import { Trend, Counter } from 'k6/metrics'; import { randomItem } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js'; const seed = 0; const host = __ENV.HOST || '127.0.0.1:8000'; const timePerToken = new Trend('time_per_token', true); const tokens =...
text-generation-inference/load_tests/common.js/0
{ "file_path": "text-generation-inference/load_tests/common.js", "repo_id": "text-generation-inference", "token_count": 1026 }
391
from llama_index.core.multi_modal_llms.base import MultiModalLLM from llama_index.multi_modal_llms.dashscope import DashScopeMultiModal def test_class(): names_of_base_classes = [b.__name__ for b in DashScopeMultiModal.__mro__] assert MultiModalLLM.__name__ in names_of_base_classes
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-dashscope/tests/test_multi_modal_llms_dashscope.py/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-dashscope/tests/test_multi_modal_llms_dashscope.py", "repo_id": "llama_index", "token_count": 108 }
1,247
import { type BaseMessage } from "@langchain/core/messages"; import { type BaseLanguageModelCallOptions } from "@langchain/core/language_models/base"; import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager"; import { type BaseChatModelParams, SimpleChatModel, } from "@langchain/core/language_m...
langchainjs/libs/create-langchain-integration/template/src/chat_models.ts/0
{ "file_path": "langchainjs/libs/create-langchain-integration/template/src/chat_models.ts", "repo_id": "langchainjs", "token_count": 921 }
970
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-memos/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-memos/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,479
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/readers/google_readers/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/google_readers/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,593
from __future__ import annotations import logging import uuid from typing import Any, Iterable, List, Optional, Type import numpy as np from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.vectorstores import VectorStore logger = logging.getLogger(__name_...
langchain/libs/community/langchain_community/vectorstores/atlas.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/atlas.py", "repo_id": "langchain", "token_count": 5672 }
312
from langchain_community.vectorstores.llm_rails import LLMRails, LLMRailsRetriever __all__ = ["LLMRails", "LLMRailsRetriever"]
langchain/libs/langchain/langchain/vectorstores/llm_rails.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/llm_rails.py", "repo_id": "langchain", "token_count": 45 }
573
import { test, expect, beforeEach, afterEach } from "@jest/globals"; import { DataSource } from "typeorm"; import { SqlDatabase } from "../sql_db.js"; let datasource: DataSource; beforeEach(async () => { datasource = new DataSource({ type: "sqlite", database: ":memory:", synchronize: true, }); await...
langchainjs/langchain/src/tests/sql_database.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/tests/sql_database.int.test.ts", "repo_id": "langchainjs", "token_count": 1588 }
940
<jupyter_start><jupyter_text>Blackboard>[Blackboard Learn](https://en.wikipedia.org/wiki/Blackboard_Learn) (previously the Blackboard Learning Management System) is a web-based virtual learning environment and learning management system developed by Blackboard Inc. The software features course management, customizable ...
langchain/docs/docs/integrations/document_loaders/blackboard.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/blackboard.ipynb", "repo_id": "langchain", "token_count": 416 }
103
# 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/rwkv/test_modeling_rwkv.py/0
{ "file_path": "transformers/tests/models/rwkv/test_modeling_rwkv.py", "repo_id": "transformers", "token_count": 8254 }
787
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Liu" given-names: "Jerry" orcid: "https://orcid.org/0000-0002-6694-3517" title: "LlamaIndex" doi: 10.5281/zenodo.1234 date-released: 2022-11-1 url: "https://github.com/jerryjliu/llama_index"
llama_index/CITATION.cff/0
{ "file_path": "llama_index/CITATION.cff", "repo_id": "llama_index", "token_count": 130 }
1,073
"""Utils for interacting with the Semantic Scholar API.""" import logging from typing import Any, Dict, Optional from langchain_core.pydantic_v1 import BaseModel, root_validator logger = logging.getLogger(__name__) class SemanticScholarAPIWrapper(BaseModel): """Wrapper around semanticscholar.org API. https:...
langchain/libs/community/langchain_community/utilities/semanticscholar.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/semanticscholar.py", "repo_id": "langchain", "token_count": 1188 }
322
import logging from typing import Any, Dict, Set, cast from overrides import override import yaml from chromadb.auth import ( AuthorizationContext, ServerAuthorizationConfigurationProvider, ServerAuthorizationProvider, ) from chromadb.auth.registry import register_provider, resolve_provider from chromadb.co...
chroma/chromadb/auth/authz/__init__.py/0
{ "file_path": "chroma/chromadb/auth/authz/__init__.py", "repo_id": "chroma", "token_count": 1882 }
16
stable
tokenizers/tokenizers/rust-toolchain/0
{ "file_path": "tokenizers/tokenizers/rust-toolchain", "repo_id": "tokenizers", "token_count": 2 }
478
from pprint import pformat from typing import Any, Iterator, Mapping from langchain_core.runnables import Runnable from langchain_core.utils.input import get_bolded_text, get_colored_text from langgraph.channels.base import BaseChannel, EmptyChannelError def print_step_start(step: int, next_tasks: list[tuple[Runnab...
langgraph/langgraph/pregel/debug.py/0
{ "file_path": "langgraph/langgraph/pregel/debug.py", "repo_id": "langgraph", "token_count": 507 }
994
# Generated content DO NOT EDIT class Normalizer: """ Base class for all normalizers This class is not supposed to be instantiated directly. Instead, any implementation of a Normalizer will return an instance of this class when instantiated. """ def normalize(self, normalized): """ ...
tokenizers/bindings/python/py_src/tokenizers/normalizers/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/normalizers/__init__.pyi", "repo_id": "tokenizers", "token_count": 8053 }
442
import asyncio import json from typing import Optional, Sequence import langsmith.client from fastapi import APIRouter, BackgroundTasks, HTTPException, Request from fastapi.exceptions import RequestValidationError from langchain.pydantic_v1 import ValidationError from langchain_core.messages import AnyMessage from lan...
opengpts/backend/app/api/runs.py/0
{ "file_path": "opengpts/backend/app/api/runs.py", "repo_id": "opengpts", "token_count": 1707 }
1,913
#include "cuda_utils.cuh" #include<stdint.h> #define AFFINE_OP(TYPENAME, FN_NAME) \ extern "C" __global__ void FN_NAME( \ const size_t numel, \ const size_t num_dims, \ const size_t *info, \ const TYPENAME *inp, \ TYPENAME *out, \ const TYPENAME mul, \ const TYPENAME add \ ) { \ cons...
candle/candle-kernels/src/affine.cu/0
{ "file_path": "candle/candle-kernels/src/affine.cu", "repo_id": "candle", "token_count": 654 }
58
import { ChatOpenAI } from "@langchain/openai"; import { createSqlQueryChain } from "langchain/chains/sql_db"; import { SqlDatabase } from "langchain/sql_db"; import { DataSource } from "typeorm"; import { QuerySqlTool } from "langchain/tools/sql"; const datasource = new DataSource({ type: "sqlite", database: "../...
langchainjs/examples/src/use_cases/sql/quickstart_execute_sql.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/sql/quickstart_execute_sql.ts", "repo_id": "langchainjs", "token_count": 258 }
857
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-chroma-autoretrieval/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-chroma-autoretrieval/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,661
"""Logic for converting internal query language to a valid Milvus query.""" from typing import Tuple, Union from langchain.chains.query_constructor.ir import ( Comparator, Comparison, Operation, Operator, StructuredQuery, Visitor, ) COMPARATOR_TO_BER = { Comparator.EQ: "==", Comparator...
langchain/libs/langchain/langchain/retrievers/self_query/milvus.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/self_query/milvus.py", "repo_id": "langchain", "token_count": 1355 }
570
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/tests/models/perceiver/test_tokenization_perceiver.py/0
{ "file_path": "transformers/tests/models/perceiver/test_tokenization_perceiver.py", "repo_id": "transformers", "token_count": 6120 }
830
python_tests()
llama_index/llama-index-packs/llama-index-packs-retry-engine-weaviate/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-retry-engine-weaviate/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,591
<html> <head> <meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> <title>Candle Llama.c Rust/WASM</title> </head> <body></body> </html> <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <style> ...
candle/candle-wasm-examples/llama2-c/lib-example.html/0
{ "file_path": "candle/candle-wasm-examples/llama2-c/lib-example.html", "repo_id": "candle", "token_count": 6089 }
83
# Installation and Setup The LlamaIndex ecosystem is structured using a collection of namespaced packages. What this means for users is that LlamaIndex comes with a core starter bundle, and additional integrations can be installed as needed. A complete list of packages and available integrations is available in our ...
llama_index/docs/getting_started/installation.md/0
{ "file_path": "llama_index/docs/getting_started/installation.md", "repo_id": "llama_index", "token_count": 949 }
1,116
from langchain_community.document_loaders.notion import NotionDirectoryLoader __all__ = ["NotionDirectoryLoader"]
langchain/libs/langchain/langchain/document_loaders/notion.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/notion.py", "repo_id": "langchain", "token_count": 31 }
494
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.arize_phoenix_query_engine import ( ArizePhoenixQueryEnginePack, ) def test_class(): names_of_base_classes = [b.__name__ for b in ArizePhoenixQueryEnginePack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/tests/test_packs_arize_phoenix_query_engine.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/tests/test_packs_arize_phoenix_query_engine.py", "repo_id": "llama_index", "token_count": 114 }
1,833
from langchain_community.llms.minimax import ( Minimax, ) __all__ = ["Minimax"]
langchain/libs/langchain/langchain/llms/minimax.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/minimax.py", "repo_id": "langchain", "token_count": 36 }
522
import { writable } from "svelte/store"; export interface WebSearchParameters { useSearch: boolean; nItems: number; } export const webSearchParameters = writable<WebSearchParameters>({ useSearch: false, nItems: 5, });
chat-ui/src/lib/stores/webSearchParameters.ts/0
{ "file_path": "chat-ui/src/lib/stores/webSearchParameters.ts", "repo_id": "chat-ui", "token_count": 68 }
92
from langchain_community.agent_toolkits.file_management.toolkit import ( FileManagementToolkit, ) __all__ = ["FileManagementToolkit"]
langchain/libs/langchain/langchain/agents/agent_toolkits/file_management/toolkit.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/file_management/toolkit.py", "repo_id": "langchain", "token_count": 44 }
433
#!/usr/bin/env python3 import torch from diffusers import DiffusionPipeline class UnetSchedulerOneForwardPipeline(DiffusionPipeline): def __init__(self, unet, scheduler): super().__init__() self.register_modules(unet=unet, scheduler=scheduler) def __call__(self): image = torch.randn...
diffusers/examples/community/one_step_unet.py/0
{ "file_path": "diffusers/examples/community/one_step_unet.py", "repo_id": "diffusers", "token_count": 299 }
209
package grpccoordinator import ( "context" "testing" "github.com/chroma/chroma-coordinator/internal/common" "github.com/chroma/chroma-coordinator/internal/grpccoordinator/grpcutils" "github.com/chroma/chroma-coordinator/internal/metastore/db/dbcore" "github.com/chroma/chroma-coordinator/internal/proto/coordinat...
chroma/go/coordinator/internal/grpccoordinator/collection_service_test.go/0
{ "file_path": "chroma/go/coordinator/internal/grpccoordinator/collection_service_test.go", "repo_id": "chroma", "token_count": 1632 }
45
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-graphdb-cypher/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-graphdb-cypher/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,410
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-ai21/llama_index/llms/ai21/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-ai21/llama_index/llms/ai21/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,298
ENVIRONMENT=development
auto-evaluator/api/.env/0
{ "file_path": "auto-evaluator/api/.env", "repo_id": "auto-evaluator", "token_count": 7 }
0
from langchain import output_parsers from tests.unit_tests import assert_all_importable EXPECTED_ALL = [ "BooleanOutputParser", "CombiningOutputParser", "CommaSeparatedListOutputParser", "DatetimeOutputParser", "EnumOutputParser", "GuardrailsOutputParser", "ListOutputParser", "MarkdownL...
langchain/libs/langchain/tests/unit_tests/output_parsers/test_imports.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/output_parsers/test_imports.py", "repo_id": "langchain", "token_count": 335 }
663
# candle [![discord server](https://dcbadge.vercel.app/api/server/hugging-face-879548962464493619)](https://discord.gg/hugging-face-879548962464493619) [![Latest version](https://img.shields.io/crates/v/candle-core.svg)](https://crates.io/crates/candle-core) [![Documentation](https://docs.rs/candle-core/badge.svg)](htt...
candle/README.md/0
{ "file_path": "candle/README.md", "repo_id": "candle", "token_count": 7311 }
31
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/dit/convert_dit_unilm_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/dit/convert_dit_unilm_to_pytorch.py", "repo_id": "transformers", "token_count": 4018 }
653
<jupyter_start><jupyter_text>Infinity`Infinity` allows to create `Embeddings` using a MIT-licensed Embedding Server. This notebook goes over how to use Langchain with Embeddings with the [Infinity Github Project](https://github.com/michaelfeil/infinity). Imports<jupyter_code>from langchain_community.embeddings import ...
langchain/docs/docs/integrations/text_embedding/infinity.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/infinity.ipynb", "repo_id": "langchain", "token_count": 878 }
164
from typing import Any, Callable, Dict, List, Optional, Union import numpy as np import PIL.Image import torch from diffusers import StableDiffusionImg2ImgPipeline from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput class MaskedStableDiffusionImg2ImgPipeline(StableDiffusionImg2ImgPipeline...
diffusers/examples/community/masked_stable_diffusion_img2img.py/0
{ "file_path": "diffusers/examples/community/masked_stable_diffusion_img2img.py", "repo_id": "diffusers", "token_count": 6312 }
200
import contextlib import re from pathlib import Path from typing import Any, List, Optional, Tuple from urllib.parse import unquote from langchain_core.documents import Document from langchain_community.document_loaders.directory import DirectoryLoader from langchain_community.document_loaders.pdf import PyPDFLoader ...
langchain/libs/community/langchain_community/document_loaders/blackboard.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/blackboard.py", "repo_id": "langchain", "token_count": 4619 }
227
// 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/pipeline/manager_test.go/0
{ "file_path": "milvus/internal/querynodev2/pipeline/manager_test.go", "repo_id": "milvus", "token_count": 1401 }
1,772
import { test, expect } from "@jest/globals"; import { OpenAIEmbeddings } from "@langchain/openai"; import { Document } from "@langchain/core/documents"; import { VectorStoreRetrieverMemory } from "../vector_store.js"; import { MemoryVectorStore } from "../../vectorstores/memory.js"; test("Test vector store memory", a...
langchainjs/langchain/src/memory/tests/vector_store_memory.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/memory/tests/vector_store_memory.int.test.ts", "repo_id": "langchainjs", "token_count": 467 }
935
#!/bin/bash # Verify PIP tarball tarball=$(readlink -f $1) if [ -f "$tarball" ]; then echo "Testing PIP package from tarball: $tarball" else echo "Could not find PIP package: $tarball" fi # Create temporary project dir dir=$(mktemp -d) echo "Building python project dir at $dir ..." cd $dir python3 -m venv ...
chroma/bin/test-package.sh/0
{ "file_path": "chroma/bin/test-package.sh", "repo_id": "chroma", "token_count": 163 }
11