text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# 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/schedulers/scheduling_consistency_models.py/0
{ "file_path": "diffusers/src/diffusers/schedulers/scheduling_consistency_models.py", "repo_id": "diffusers", "token_count": 8102 }
256
/* eslint-disable no-process-env */ import * as uuid from "uuid"; import { test } from "@jest/globals"; import { LangChainTracer, Run } from "../tracer_langchain.js"; import { Serialized } from "../../load/serializable.js"; import { HumanMessage } from "../../messages/index.js"; const serialized: Serialized = { lc:...
langchainjs/langchain-core/src/tracers/tests/langchain_tracer.int.test.ts/0
{ "file_path": "langchainjs/langchain-core/src/tracers/tests/langchain_tracer.int.test.ts", "repo_id": "langchainjs", "token_count": 1027 }
871
# flake8: noqa from langchain.chains.prompt_selector import ConditionalPromptSelector, is_chat_model from langchain_core.prompts.chat import ( ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate, ) from langchain_core.prompts.prompt import PromptTemplate templ1 = """You are a smart ...
langchain/libs/langchain/langchain/chains/qa_generation/prompt.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/qa_generation/prompt.py", "repo_id": "langchain", "token_count": 552 }
463
import re from pathlib import Path from typing import Dict, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class IPYNBReader(BaseReader): """Image parser.""" def __init__( self, parser_config: Optional[Dict] = None, co...
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/ipynb/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/ipynb/base.py", "repo_id": "llama_index", "token_count": 560 }
1,491
[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 = ["OpenAIAgent", "OpenAIAgentWorker", "OpenAIAssistantAgent"] contains_example = false impor...
llama_index/llama-index-integrations/agent/llama-index-agent-openai/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/agent/llama-index-agent-openai/pyproject.toml", "repo_id": "llama_index", "token_count": 667 }
1,225
from typing import TYPE_CHECKING from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule _import_structure = {"pipeline_latent_diffusion_uncond": ["LDMPipeline"]} if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: from .pipeline_latent_diffusion_uncond import LDMPipeline else: import sys sys.modules[__name__]...
diffusers/src/diffusers/pipelines/deprecated/latent_diffusion_uncond/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/deprecated/latent_diffusion_uncond/__init__.py", "repo_id": "diffusers", "token_count": 190 }
242
import { SRTLoader } from "langchain/document_loaders/fs/srt"; export const run = async () => { const loader = new SRTLoader( "src/document_loaders/example_data/Star_Wars_The_Clone_Wars_S06E07_Crisis_at_the_Heart.srt" ); const docs = await loader.load(); console.log({ docs }); };
langchainjs/examples/src/document_loaders/srt.ts/0
{ "file_path": "langchainjs/examples/src/document_loaders/srt.ts", "repo_id": "langchainjs", "token_count": 109 }
811
package model import "github.com/milvus-io/milvus/internal/proto/internalpb" type Credential struct { Username string EncryptedPassword string Tenant string IsSuper bool Sha256Password string } func MarshalCredentialModel(cred *Credential) *internalpb.CredentialInfo { if cred =...
milvus/internal/metastore/model/credential.go/0
{ "file_path": "milvus/internal/metastore/model/credential.go", "repo_id": "milvus", "token_count": 251 }
1,727
package typeutil import ( "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/internal/proto/internalpb" "github.com/milvus-io/milvus/internal/proto/segcorepb" "github.com/milvus-io/milvus/pkg/util/typeutil" ) type RetrieveRes...
milvus/internal/util/typeutil/retrieve_result.go/0
{ "file_path": "milvus/internal/util/typeutil/retrieve_result.go", "repo_id": "milvus", "token_count": 727 }
1,804
"""Sentence Transformer Finetuning Engine.""" from typing import Any, Optional from llama_index.legacy.embeddings.base import BaseEmbedding from llama_index.legacy.embeddings.utils import resolve_embed_model from llama_index.legacy.finetuning.embeddings.common import ( EmbeddingQAFinetuneDataset, ) from llama_ind...
llama_index/llama-index-legacy/llama_index/legacy/finetuning/embeddings/sentence_transformer.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/finetuning/embeddings/sentence_transformer.py", "repo_id": "llama_index", "token_count": 1500 }
1,565
#!/usr/bin/env bash set -euxo pipefail export CI=true # enable extended globbing for omitting build artifacts shopt -s extglob # avoid copying build artifacts from the host cp -r ../langchain/!(node_modules|dist|dist-cjs|dist-esm|build|.next|.turbo) ./ yarn # Check the test command completes successfully NODE_OPT...
langchainjs/dependency_range_tests/scripts/test-langchain-with-latest-deps.sh/0
{ "file_path": "langchainjs/dependency_range_tests/scripts/test-langchain-with-latest-deps.sh", "repo_id": "langchainjs", "token_count": 150 }
764
# OpenDAL Loaders ## Base OpendalReader This loader parses any file via [Apache OpenDAL](https://github.com/apache/incubator-opendal). All files are temporarily downloaded locally and subsequently parsed with `SimpleDirectoryReader`. Hence, you may also specify a custom `file_extractor`, relying on any of the loader...
llama_index/llama-index-integrations/readers/llama-index-readers-opendal/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-opendal/README.md", "repo_id": "llama_index", "token_count": 1445 }
1,350
import importlib import torch import yaml from omegaconf import OmegaConf from taming.models.vqgan import VQModel def load_config(config_path, display=False): config = OmegaConf.load(config_path) if display: print(yaml.dump(OmegaConf.to_container(config))) return config def load_vqgan(device, c...
transformers/examples/research_projects/vqgan-clip/loaders.py/0
{ "file_path": "transformers/examples/research_projects/vqgan-clip/loaders.py", "repo_id": "transformers", "token_count": 926 }
618
# coding=utf-8 # Copyright 2022 Sea AI Lab and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
transformers/src/transformers/models/poolformer/modeling_poolformer.py/0
{ "file_path": "transformers/src/transformers/models/poolformer/modeling_poolformer.py", "repo_id": "transformers", "token_count": 7408 }
647
from langchain_community.document_loaders.nuclia import NucliaLoader __all__ = ["NucliaLoader"]
langchain/libs/langchain/langchain/document_loaders/nuclia.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/nuclia.py", "repo_id": "langchain", "token_count": 32 }
485
import { GoogleGenerativeAIEmbeddings } from "@langchain/google-genai"; import { TaskType } from "@google/generative-ai"; /* * Before running this, you should make sure you have created a * Google Cloud Project that has `generativelanguage` API enabled. * * You will also need to generate an API key and set * an e...
langchainjs/examples/src/models/embeddings/googlegenerativeai.ts/0
{ "file_path": "langchainjs/examples/src/models/embeddings/googlegenerativeai.ts", "repo_id": "langchainjs", "token_count": 1198 }
808
"""Office365 toolkit."""
langchain/libs/langchain/langchain/agents/agent_toolkits/office365/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/office365/__init__.py", "repo_id": "langchain", "token_count": 8 }
460
from llama_index.legacy.storage.kvstore.firestore_kvstore import FirestoreKVStore from llama_index.legacy.storage.kvstore.mongodb_kvstore import MongoDBKVStore from llama_index.legacy.storage.kvstore.redis_kvstore import RedisKVStore from llama_index.legacy.storage.kvstore.simple_kvstore import SimpleKVStore __all__ =...
llama_index/llama-index-legacy/llama_index/legacy/storage/kvstore/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/storage/kvstore/__init__.py", "repo_id": "llama_index", "token_count": 145 }
1,604
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/llms/llama-index-llms-openrouter/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-openrouter/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,295
/* eslint-disable no-process-env */ import { test, expect } from "@jest/globals"; import weaviate, { ApiKey } from "weaviate-ts-client"; import { OpenAIEmbeddings } from "@langchain/openai"; import { Document } from "@langchain/core/documents"; import { WeaviateStore } from "../vectorstores.js"; test("WeaviateStore", ...
langchainjs/libs/langchain-weaviate/src/tests/vectorstores.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-weaviate/src/tests/vectorstores.int.test.ts", "repo_id": "langchainjs", "token_count": 4329 }
1,069
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/proxy/util.go/0
{ "file_path": "milvus/internal/proxy/util.go", "repo_id": "milvus", "token_count": 18827 }
1,970
python_sources()
llama_index/llama-index-core/llama_index/core/indices/common/struct_store/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/common/struct_store/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,150
import { OpenAI } from "@langchain/openai"; import { ZapierNLAWrapper } from "langchain/tools"; import { initializeAgentExecutorWithOptions, ZapierToolKit, } from "langchain/agents"; const model = new OpenAI({ temperature: 0 }); const zapier = new ZapierNLAWrapper(); const toolkit = await ZapierToolKit.fromZapierN...
langchainjs/examples/src/agents/zapier_mrkl.ts/0
{ "file_path": "langchainjs/examples/src/agents/zapier_mrkl.ts", "repo_id": "langchainjs", "token_count": 260 }
814
from unittest.mock import MagicMock, patch from llama_index.core.graph_stores.types import GraphStore from llama_index.graph_stores.kuzu import KuzuGraphStore @patch("llama_index.graph_stores.kuzu.KuzuGraphStore") def test_kuzu_graph_store(MockKuzuGraphStore: MagicMock): instance: KuzuGraphStore = MockKuzuGraphS...
llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-kuzu/tests/test_graph_stores_kuzu.py/0
{ "file_path": "llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-kuzu/tests/test_graph_stores_kuzu.py", "repo_id": "llama_index", "token_count": 136 }
1,282
// 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/common/RangeSearchHelper.cpp/0
{ "file_path": "milvus/internal/core/src/common/RangeSearchHelper.cpp", "repo_id": "milvus", "token_count": 2436 }
1,745
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-awadb/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-awadb/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,448
# coding=utf-8 # Copyright 2020 HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
transformers/tests/models/funnel/test_modeling_tf_funnel.py/0
{ "file_path": "transformers/tests/models/funnel/test_modeling_tf_funnel.py", "repo_id": "transformers", "token_count": 6844 }
761
from llama_index.storage.docstore.firestore.base import FirestoreDocumentStore __all__ = ["FirestoreDocumentStore"]
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-firestore/llama_index/storage/docstore/firestore/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-firestore/llama_index/storage/docstore/firestore/__init__.py", "repo_id": "llama_index", "token_count": 33 }
1,591
// 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/query/Relational.h/0
{ "file_path": "milvus/internal/core/src/query/Relational.h", "repo_id": "milvus", "token_count": 842 }
1,760
"""Agent utils.""" from llama_index.core.agent.types import TaskStep from llama_index.core.base.llms.types import MessageRole from llama_index.core.llms.base import ChatMessage from llama_index.core.memory import BaseMemory def add_user_step_to_memory( step: TaskStep, memory: BaseMemory, verbose: bool = False )...
llama_index/llama-index-core/llama_index/core/agent/utils.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/agent/utils.py", "repo_id": "llama_index", "token_count": 188 }
1,117
from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.embeddings.openai import OpenAIEmbedding def test_openai_embedding_class(): names_of_base_classes = [b.__name__ for b in OpenAIEmbedding.__mro__] assert BaseEmbedding.__name__ in names_of_base_classes
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-openai/tests/test_embeddings_openai.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-openai/tests/test_embeddings_openai.py", "repo_id": "llama_index", "token_count": 108 }
1,195
# LlamaIndex Vector_Stores Integration: Jaguar
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-jaguar/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-jaguar/README.md", "repo_id": "llama_index", "token_count": 12 }
1,558
import { ChatOpenAI } from "@langchain/openai"; import { PromptTemplate } from "@langchain/core/prompts"; const model = new ChatOpenAI({}); const promptTemplate = PromptTemplate.fromTemplate( "Tell me a joke about {topic}" ); const chain = promptTemplate.pipe(model); const result = await chain.batch([{ topic: "bea...
langchainjs/examples/src/guides/expression_language/interface_batch.ts/0
{ "file_path": "langchainjs/examples/src/guides/expression_language/interface_batch.ts", "repo_id": "langchainjs", "token_count": 204 }
867
# LlamaIndex Embeddings Integration: Together
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-together/README.md/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-together/README.md", "repo_id": "llama_index", "token_count": 11 }
1,257
# 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...
transformers/src/transformers/integrations/aqlm.py/0
{ "file_path": "transformers/src/transformers/integrations/aqlm.py", "repo_id": "transformers", "token_count": 1821 }
635
import { OpenAI } from "@langchain/openai"; import { RegexParser } from "langchain/output_parsers"; import { PromptTemplate } from "@langchain/core/prompts"; export const run = async () => { const parser = new RegexParser( /Humor: ([0-9]+), Sophistication: (A|B|C|D|E)/, ["mark", "grade"], "noConfidence" ...
langchainjs/examples/src/prompts/regex_parser.ts/0
{ "file_path": "langchainjs/examples/src/prompts/regex_parser.ts", "repo_id": "langchainjs", "token_count": 366 }
814
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion_attend_and_excite.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion_attend_and_excite.py", "repo_id": "diffusers", "token_count": 3673 }
284
import type { Conversation } from "$lib/types/Conversation"; import type { Message } from "$lib/types/Message"; export function convertLegacyConversation( conv: Pick<Conversation, "messages" | "rootMessageId" | "preprompt"> ): Pick<Conversation, "messages" | "rootMessageId" | "preprompt"> { if (conv.rootMessageId) r...
chat-ui/src/lib/utils/tree/convertLegacyConversation.ts/0
{ "file_path": "chat-ui/src/lib/utils/tree/convertLegacyConversation.ts", "repo_id": "chat-ui", "token_count": 346 }
107
import torch from typing import Optional from text_generation_server.models.flash_mistral import BaseFlashMistral from text_generation_server.models.custom_modeling.flash_mixtral_modeling import ( MixtralConfig, FlashMixtralForCausalLM, ) class FlashMixtral(BaseFlashMistral): def __init__( self,...
text-generation-inference/server/text_generation_server/models/flash_mixtral.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/flash_mixtral.py", "repo_id": "text-generation-inference", "token_count": 379 }
403
<!--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/ja/quicktour.md/0
{ "file_path": "diffusers/docs/source/ja/quicktour.md", "repo_id": "diffusers", "token_count": 7835 }
191
<jupyter_start><jupyter_text>MongoDB>`MongoDB` is a source-available cross-platform document-oriented database program. Classified as a NoSQL database program, `MongoDB` uses `JSON`-like documents with optional schemas.>>`MongoDB` is developed by MongoDB Inc. and licensed under the Server Side Public License (SSPL). - ...
langchain/docs/docs/integrations/memory/mongodb_chat_message_history.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/memory/mongodb_chat_message_history.ipynb", "repo_id": "langchain", "token_count": 1057 }
136
from llama_index.retrievers.pathway.base import PathwayRetriever __all__ = ["PathwayRetriever"]
llama_index/llama-index-integrations/retrievers/llama-index-retrievers-pathway/llama_index/retrievers/pathway/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/retrievers/llama-index-retrievers-pathway/llama_index/retrievers/pathway/__init__.py", "repo_id": "llama_index", "token_count": 34 }
1,585
import random from datetime import datetime, timedelta from typing import List from langchain_core.exceptions import OutputParserException from langchain_core.output_parsers import BaseOutputParser from langchain_core.utils import comma_list def _generate_random_datetime_strings( pattern: str, n: int = 3, ...
langchain/libs/langchain/langchain/output_parsers/datetime.py/0
{ "file_path": "langchain/libs/langchain/langchain/output_parsers/datetime.py", "repo_id": "langchain", "token_count": 755 }
559
# Long Form Question Answering Author: @yjernite This folder contains the code for the Long Form Question answering [demo](http://35.226.96.115:8080/) as well as methods to train and use a fully end-to-end Long Form Question Answering system using the [🤗transformers](https://github.com/huggingface/transformers) and ...
transformers/examples/research_projects/longform-qa/README.md/0
{ "file_path": "transformers/examples/research_projects/longform-qa/README.md", "repo_id": "transformers", "token_count": 208 }
590
#!/usr/bin/env bash export PYTHONPATH="../":"${PYTHONPATH}" export WANDB_PROJECT=dmar export MAX_LEN=128 python finetune.py \ --learning_rate=3e-4 \ --do_train \ --do_predict \ --fp16 \ --val_check_interval 0.25 \ --data_dir $ENRO_DIR \ --max_source_length $MAX_LEN --max_target_length $MAX_LEN --val_max_t...
transformers/examples/research_projects/seq2seq-distillation/distil_marian_no_teacher.sh/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/distil_marian_no_teacher.sh", "repo_id": "transformers", "token_count": 274 }
554
""" Summary utilities Hacked together by / Copyright 2020 Ross Wightman """ import csv import os from collections import OrderedDict try: import wandb except ImportError: pass def get_outdir(path, *paths, inc=False): outdir = os.path.join(path, *paths) if not os.path.exists(outdir): os.maked...
pytorch-image-models/timm/utils/summary.py/0
{ "file_path": "pytorch-image-models/timm/utils/summary.py", "repo_id": "pytorch-image-models", "token_count": 633 }
376
# 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/src/transformers/pipelines/automatic_speech_recognition.py/0
{ "file_path": "transformers/src/transformers/pipelines/automatic_speech_recognition.py", "repo_id": "transformers", "token_count": 16936 }
761
[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 = ["TairVectorStore"] contains_example = false import_path = "llama_index.vector_stores.tair"...
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-tair/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-tair/pyproject.toml", "repo_id": "llama_index", "token_count": 649 }
1,679
//! Tensors are N-dimensional matrixes of elements using a single data type. #![allow(clippy::redundant_closure_call)] use crate::backend::{BackendDevice, BackendStorage}; use crate::op::{ BackpropOp, BinaryOp, CmpOp, CustomOp1, CustomOp2, CustomOp3, Op, ReduceOp, UnaryOp, }; use crate::scalar::TensorOrScalar; use ...
candle/candle-core/src/tensor.rs/0
{ "file_path": "candle/candle-core/src/tensor.rs", "repo_id": "candle", "token_count": 50067 }
34
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/core/src/common/FieldData.h/0
{ "file_path": "milvus/internal/core/src/common/FieldData.h", "repo_id": "milvus", "token_count": 1677 }
1,918
import base64 import io from pathlib import Path from langchain_community.vectorstores import Chroma from langchain_core.documents import Document from langchain_core.messages import HumanMessage from langchain_core.output_parsers import StrOutputParser from langchain_core.pydantic_v1 import BaseModel from langchain_c...
langchain/templates/rag-gemini-multi-modal/rag_gemini_multi_modal/chain.py/0
{ "file_path": "langchain/templates/rag-gemini-multi-modal/rag_gemini_multi_modal/chain.py", "repo_id": "langchain", "token_count": 1514 }
690
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export4.dtd"> <en-export export-date="20230613T110102Z" application="Evernote" version="10.56.9"> </en-export>
langchain/libs/community/tests/unit_tests/document_loaders/sample_documents/empty_export.enex/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/sample_documents/empty_export.enex", "repo_id": "langchain", "token_count": 88 }
373
from datetime import datetime from time import sleep from typing import Any, Callable, List, Union from uuid import uuid4 from langchain_core.chat_history import BaseChatMessageHistory from langchain_core.messages import ( BaseMessage, message_to_dict, messages_from_dict, ) class RocksetChatMessageHistor...
langchain/libs/community/langchain_community/chat_message_histories/rocksetdb.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_message_histories/rocksetdb.py", "repo_id": "langchain", "token_count": 4700 }
217
<!--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/beit.md/0
{ "file_path": "transformers/docs/source/en/model_doc/beit.md", "repo_id": "transformers", "token_count": 2186 }
477
# LlamaIndex Llms Integration: Litellm
llama_index/llama-index-integrations/llms/llama-index-llms-litellm/README.md/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-litellm/README.md", "repo_id": "llama_index", "token_count": 12 }
1,283
import re from contextlib import AbstractContextManager, nullcontext from typing import Dict, Optional, Tuple, Type, Union from unittest.mock import patch import pytest from langchain_core.utils import check_package_version from langchain_core.utils._merge import merge_dicts @pytest.mark.parametrize( ("package"...
langchain/libs/core/tests/unit_tests/utils/test_utils.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/utils/test_utils.py", "repo_id": "langchain", "token_count": 1789 }
452
from llama_index.core.base.base_query_engine import BaseQueryEngine # SQL from llama_index.core.indices.struct_store.sql_query import ( NLSQLTableQueryEngine, PGVectorSQLQueryEngine, SQLTableRetrieverQueryEngine, ) from llama_index.core.query_engine.citation_query_engine import CitationQueryEngine from lla...
llama_index/llama-index-core/llama_index/core/query_engine/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/query_engine/__init__.py", "repo_id": "llama_index", "token_count": 982 }
1,196
from langchain.schema.prompt import __all__ EXPECTED_ALL = ["PromptValue"] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
langchain/libs/langchain/tests/unit_tests/schema/test_prompt.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/schema/test_prompt.py", "repo_id": "langchain", "token_count": 60 }
617
# 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/swin/convert_swin_simmim_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/swin/convert_swin_simmim_to_pytorch.py", "repo_id": "transformers", "token_count": 2896 }
672
python_tests()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-jinaai/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-jinaai/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,248
import typing from typing import Sequence, Union from llama_index.legacy.core.llms.types import MessageRole from llama_index.legacy.llms.base import ( ChatMessage, ChatResponse, CompletionResponse, ) if typing.TYPE_CHECKING: import google.ai.generativelanguage as glm import google.generativeai as ...
llama_index/llama-index-legacy/llama_index/legacy/llms/gemini_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/gemini_utils.py", "repo_id": "llama_index", "token_count": 1683 }
1,504
[tool.poetry] name = "__package_name__" version = "0.0.1" description = "An integration package connecting __ModuleName__ and LangChain" authors = [] readme = "README.md" repository = "https://github.com/langchain-ai/langchain" license = "MIT" [tool.poetry.urls] "Source Code" = "https://github.com/langchain-ai/langcha...
langchain/libs/cli/langchain_cli/integration_template/pyproject.toml/0
{ "file_path": "langchain/libs/cli/langchain_cli/integration_template/pyproject.toml", "repo_id": "langchain", "token_count": 903 }
213
GIT_ROOT ?= $(shell git rev-parse --show-toplevel) help: ## Show all Makefile targets. @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}' format: ## Run code autoformatters (black). pre-commit install git ls-files | xargs pre-commit ru...
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-uptrain/Makefile/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-uptrain/Makefile", "repo_id": "llama_index", "token_count": 264 }
1,349
# Copyright 2021 AlQuraishi Laboratory # # 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 i...
transformers/src/transformers/models/esm/openfold_utils/chunk_utils.py/0
{ "file_path": "transformers/src/transformers/models/esm/openfold_utils/chunk_utils.py", "repo_id": "transformers", "token_count": 6590 }
600
# Example Selector Types | Name | Description | |------------|---------------------------------------------------------------------------------------------| | Similarity | Uses semantic similarity between inputs and examples to decid...
langchain/docs/docs/modules/model_io/prompts/example_selector_types/index.mdx/0
{ "file_path": "langchain/docs/docs/modules/model_io/prompts/example_selector_types/index.mdx", "repo_id": "langchain", "token_count": 241 }
214
--- hide_table_of_contents: true --- # Vector Store Once you've created a [Vector Store](/docs/modules/data_connection/vectorstores), the way to use it as a Retriever is very simple: ```typescript vectorStore = ... retriever = vectorStore.asRetriever() ```
langchainjs/docs/core_docs/docs/integrations/retrievers/vectorstore.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/retrievers/vectorstore.mdx", "repo_id": "langchainjs", "token_count": 85 }
787
from llama_index.core.vector_stores.types import VectorStore from llama_index.vector_stores.jaguar import JaguarVectorStore def test_class(): names_of_base_classes = [b.__name__ for b in JaguarVectorStore.__mro__] assert VectorStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-jaguar/tests/test_vector_stores_jaguar.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-jaguar/tests/test_vector_stores_jaguar.py", "repo_id": "llama_index", "token_count": 91 }
1,559
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/core/src/storage/ThreadPool.cpp/0
{ "file_path": "milvus/internal/core/src/storage/ThreadPool.cpp", "repo_id": "milvus", "token_count": 1353 }
1,775
python_sources() python_test_utils( name="test_utils", dependencies=[ 'llama-index-core/tests/indices/vector_store/mock_services.py', 'llama-index-core/tests/mock_utils/mock_predict.py', 'llama-index-core/tests/mock_utils/mock_text_splitter.py', 'llama-index-core/tests/mock_util...
llama_index/llama-index-core/tests/indices/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/indices/BUILD", "repo_id": "llama_index", "token_count": 211 }
1,186
// 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/TermExpr.cpp/0
{ "file_path": "milvus/internal/core/src/exec/expression/TermExpr.cpp", "repo_id": "milvus", "token_count": 9825 }
1,869
from langchain_community.tools.google_serper.tool import ( GoogleSerperResults, GoogleSerperRun, ) __all__ = ["GoogleSerperRun", "GoogleSerperResults"]
langchain/libs/langchain/langchain/tools/google_serper/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/google_serper/tool.py", "repo_id": "langchain", "token_count": 55 }
562
""" CBAM (sort-of) Attention Experimental impl of CBAM: Convolutional Block Attention Module: https://arxiv.org/abs/1807.06521 WARNING: Results with these attention layers have been mixed. They can significantly reduce performance on some tasks, especially fine-grained it seems. I may end up removing this impl. Hack...
pytorch-image-models/timm/layers/cbam.py/0
{ "file_path": "pytorch-image-models/timm/layers/cbam.py", "repo_id": "pytorch-image-models", "token_count": 2016 }
373
import { ChatOpenAI } from "@langchain/openai"; import { ConversationSummaryMemory } from "langchain/memory"; import { LLMChain } from "langchain/chains"; import { PromptTemplate } from "@langchain/core/prompts"; export const run = async () => { const memory = new ConversationSummaryMemory({ memoryKey: "chat_his...
langchainjs/examples/src/memory/summary_chat.ts/0
{ "file_path": "langchainjs/examples/src/memory/summary_chat.ts", "repo_id": "langchainjs", "token_count": 531 }
817
"""Integration test for JIRA API Wrapper.""" import json from datetime import datetime import pytest from langchain_community.utilities.clickup import ClickupAPIWrapper @pytest.fixture def clickup_wrapper() -> ClickupAPIWrapper: return ClickupAPIWrapper() def test_init(clickup_wrapper: ClickupAPIWrapper) -> N...
langchain/libs/community/tests/integration_tests/utilities/test_clickup.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/utilities/test_clickup.py", "repo_id": "langchain", "token_count": 1041 }
350
import { APIConnectionTimeoutError, APIUserAbortError, type OpenAI as OpenAIClient, } from "openai"; import { zodToJsonSchema } from "zod-to-json-schema"; import type { StructuredToolInterface } from "@langchain/core/tools"; import { convertToOpenAIFunction, convertToOpenAITool, } from "@langchain/core/utils/...
langchainjs/libs/langchain-openai/src/utils/openai.ts/0
{ "file_path": "langchainjs/libs/langchain-openai/src/utils/openai.ts", "repo_id": "langchainjs", "token_count": 436 }
1,040
# Wide ResNet **Wide Residual Networks** are a variant on [ResNets](https://paperswithcode.com/method/resnet) where we decrease depth and increase the width of residual networks. This is achieved through the use of [wide residual blocks](https://paperswithcode.com/method/wide-residual-block). {% include 'code_snippet...
pytorch-image-models/docs/models/.templates/models/wide-resnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/wide-resnet.md", "repo_id": "pytorch-image-models", "token_count": 1220 }
342
// 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/metastore/kv/binlog/binlog.go/0
{ "file_path": "milvus/internal/metastore/kv/binlog/binlog.go", "repo_id": "milvus", "token_count": 2154 }
1,859
"""Chain that combines documents by stuffing into context.""" from typing import Any, Dict, List, Optional, Tuple from langchain_core.callbacks import Callbacks from langchain_core.documents import Document from langchain_core.language_models import LanguageModelLike from langchain_core.output_parsers import BaseOutpu...
langchain/libs/langchain/langchain/chains/combine_documents/stuff.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/combine_documents/stuff.py", "repo_id": "langchain", "token_count": 4272 }
480
import { buildPrompt } from "$lib/buildPrompt"; import { authCondition } from "$lib/server/auth"; import { collections } from "$lib/server/database"; import { models } from "$lib/server/models"; import { buildSubtree } from "$lib/utils/tree/buildSubtree"; import { isMessageId } from "$lib/utils/tree/isMessageId"; impor...
chat-ui/src/routes/conversation/[id]/message/[messageId]/prompt/+server.ts/0
{ "file_path": "chat-ui/src/routes/conversation/[id]/message/[messageId]/prompt/+server.ts", "repo_id": "chat-ui", "token_count": 601 }
113
from langchain_community.tools.playwright.navigate_back import NavigateBackTool __all__ = ["NavigateBackTool"]
langchain/libs/langchain/langchain/tools/playwright/navigate_back.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/playwright/navigate_back.py", "repo_id": "langchain", "token_count": 33 }
554
from langchain_community.chat_models.mlflow import ChatMlflow __all__ = ["ChatMlflow"]
langchain/libs/langchain/langchain/chat_models/mlflow.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_models/mlflow.py", "repo_id": "langchain", "token_count": 31 }
475
# Postgres Embedding > [pg_embedding](https://github.com/neondatabase/pg_embedding) is an open-source package for > vector similarity search using `Postgres` and the `Hierarchical Navigable Small Worlds` > algorithm for approximate nearest neighbor search. ## Installation and Setup We need to install several python ...
langchain/docs/docs/integrations/providers/pg_embedding.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/pg_embedding.mdx", "repo_id": "langchain", "token_count": 154 }
156
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/pkg/mq/msgstream/msgstream_util_test.go/0
{ "file_path": "milvus/pkg/mq/msgstream/msgstream_util_test.go", "repo_id": "milvus", "token_count": 929 }
2,044
// 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/task_manager_test.go/0
{ "file_path": "milvus/internal/datanode/importv2/task_manager_test.go", "repo_id": "milvus", "token_count": 889 }
1,973
#!/usr/bin/env python3 import sys import argparse from argparse import Namespace import os, shutil import getopt from ruamel.yaml import YAML, yaml_object from ruamel.yaml.comments import CommentedSeq, CommentedMap from ruamel.yaml.tokens import CommentToken yaml = YAML(typ="rt") ## format yaml file yaml.indent(mappi...
milvus/tests/benchmark/ci/scripts/yaml_processor.py/0
{ "file_path": "milvus/tests/benchmark/ci/scripts/yaml_processor.py", "repo_id": "milvus", "token_count": 6297 }
1,851
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-multi-document-agents/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-multi-document-agents/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,593
"""SnscrapeTwitter reader.""" from typing import List from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class SnscrapeTwitterReader(BaseReader): """SnscrapeTwitter reader. Reads data from a twitter profile. Args: username (str): Twitter Username. ...
llama_index/llama-index-integrations/readers/llama-index-readers-snscrape-twitter/llama_index/readers/snscrape_twitter/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-snscrape-twitter/llama_index/readers/snscrape_twitter/base.py", "repo_id": "llama_index", "token_count": 479 }
1,443
from __future__ import annotations from typing import Any, Dict, Iterator, List, Optional, Tuple from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class SnowflakeLoader(BaseLoader): """Load from `Snowflake` API. Each document represents one row ...
langchain/libs/community/langchain_community/document_loaders/snowflake_loader.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/snowflake_loader.py", "repo_id": "langchain", "token_count": 2094 }
262
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 4911, "logprob": -6.9804688, "text": "User" ...
text-generation-inference/integration-tests/models/__snapshots__/test_idefics/test_idefics_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_idefics/test_idefics_load.json", "repo_id": "text-generation-inference", "token_count": 9573 }
378
import { LunaryHandler } from "@langchain/community/callbacks/handlers/lunary"; const handler = new LunaryHandler({ appId: "app ID", // verbose: true, // apiUrl: 'custom self hosting url' });
langchainjs/examples/src/callbacks/lunary_custom_app_id.ts/0
{ "file_path": "langchainjs/examples/src/callbacks/lunary_custom_app_id.ts", "repo_id": "langchainjs", "token_count": 65 }
797
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors, Allegro.pl and 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/li...
transformers/tests/models/herbert/test_tokenization_herbert.py/0
{ "file_path": "transformers/tests/models/herbert/test_tokenization_herbert.py", "repo_id": "transformers", "token_count": 2164 }
730
<jupyter_start><jupyter_text>BatchEvalRunner - Running Multiple EvaluationsThe `BatchEvalRunner` class can be used to run a series of evaluations asynchronously. The async jobs are limited to a defined size of `num_workers`. Setup<jupyter_code>%pip install llama-index-llms-openai # attach to the same event-loop import ...
llama_index/docs/examples/evaluation/batch_eval.ipynb/0
{ "file_path": "llama_index/docs/examples/evaluation/batch_eval.ipynb", "repo_id": "llama_index", "token_count": 1545 }
1,103
"""Interfaces to be implemented by general evaluators.""" from __future__ import annotations import logging from abc import ABC, abstractmethod from enum import Enum from typing import Any, Optional, Sequence, Tuple, Union from warnings import warn from langchain_core.agents import AgentAction from langchain_core.lan...
langchain/libs/langchain/langchain/evaluation/schema.py/0
{ "file_path": "langchain/libs/langchain/langchain/evaluation/schema.py", "repo_id": "langchain", "token_count": 7203 }
508
# def pull_image(image): # registry = image.split(":")[0] # image_tag = image.split(":")[1] # client = docker.APIClient(base_url='unix://var/run/docker.sock') # logger.info("Start pulling image: %s" % image) # return client.pull(registry, image_tag) # def run_server(image, mem_limit=None, timeout=...
milvus/tests/benchmark/milvus_benchmark/runners/docker_utils.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/runners/docker_utils.py", "repo_id": "milvus", "token_count": 2172 }
1,960
# 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 required by applicabl...
transformers/src/transformers/models/univnet/configuration_univnet.py/0
{ "file_path": "transformers/src/transformers/models/univnet/configuration_univnet.py", "repo_id": "transformers", "token_count": 2525 }
679
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-jaguar/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-jaguar/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,658
import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { Tool } from "@langchain/core/tools"; /** * Interface for parameters required by GooglePlacesAPI class. */ export interface GooglePlacesAPIParams { apiKey?: string; } /** * Tool that queries the Google Places API */ export class GoogleP...
langchainjs/libs/langchain-community/src/tools/google_places.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/google_places.ts", "repo_id": "langchainjs", "token_count": 1072 }
987
from __future__ import annotations from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Union from langchain_core.load.serializable import Serializable from langchain_core.pydantic_v1 import Extra, Field from langchain_core.utils import get_bolded_text from langchain_core.utils.interactive_env impor...
langchain/libs/core/langchain_core/messages/base.py/0
{ "file_path": "langchain/libs/core/langchain_core/messages/base.py", "repo_id": "langchain", "token_count": 3240 }
424
<!--- Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/examples/pytorch/translation/README.md/0
{ "file_path": "transformers/examples/pytorch/translation/README.md", "repo_id": "transformers", "token_count": 2710 }
566
--- sidebar_position: 0 --- # Quick Start Chat models are a variation on language models. While chat models use language models under the hood, the interface they use is a bit different. Rather than using a "text in, text out" API, they use an interface where "chat messages" are the inputs and outputs. ## Setup imp...
langchainjs/docs/core_docs/docs/modules/model_io/chat/quick_start.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/chat/quick_start.mdx", "repo_id": "langchainjs", "token_count": 1819 }
736