text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-postgres/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-postgres/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,456
package command import ( "context" "github.com/milvus-io/milvus/cmd/tools/migration/configs" "github.com/milvus-io/milvus/cmd/tools/migration/console" "github.com/milvus-io/milvus/cmd/tools/migration/migration" ) func Backup(c *configs.Config) { ctx := context.Background() runner := migration.NewRunner(ctx, c)...
milvus/cmd/tools/migration/command/backup.go/0
{ "file_path": "milvus/cmd/tools/migration/command/backup.go", "repo_id": "milvus", "token_count": 220 }
1,896
package planparserv2 const float64EqualityThreshold = 1e-9 func floatingEqual(a, b float64) bool { // return math.Abs(a-b) <= float64EqualityThreshold return a == b }
milvus/internal/parser/planparserv2/floating_comparision.go/0
{ "file_path": "milvus/internal/parser/planparserv2/floating_comparision.go", "repo_id": "milvus", "token_count": 63 }
2,006
# candle-bert Bert is a general large language model. In this example it can be used for two different tasks: - Compute sentence embeddings for a prompt. - Compute similarities between a set of sentences. ## Sentence embeddings Bert is used to compute the sentence embeddings for a prompt. The model weights are down...
candle/candle-examples/examples/bert/README.md/0
{ "file_path": "candle/candle-examples/examples/bert/README.md", "repo_id": "candle", "token_count": 1564 }
42
""" Inception-V3 Originally from torchvision Inception3 model Licensed BSD-Clause 3 https://github.com/pytorch/vision/blob/master/LICENSE """ from functools import partial import torch import torch.nn as nn import torch.nn.functional as F from timm.data import IMAGENET_DEFAULT_STD, IMAGENET_DEFAULT_MEAN, IMAGENET_IN...
pytorch-image-models/timm/models/inception_v3.py/0
{ "file_path": "pytorch-image-models/timm/models/inception_v3.py", "repo_id": "pytorch-image-models", "token_count": 8581 }
399
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 15, "logprob": null, "text": "," }, { "id": 1669, "logprob": -5.4414062, "text": " il" }, { "id": 1158...
text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m_all_params.json", "repo_id": "text-generation-inference", "token_count": 1199 }
403
# Copyright 2024 Stanford University Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
diffusers/src/diffusers/schedulers/scheduling_ddim_flax.py/0
{ "file_path": "diffusers/src/diffusers/schedulers/scheduling_ddim_flax.py", "repo_id": "diffusers", "token_count": 5374 }
261
from langchain_community.agent_toolkits import SQLDatabaseToolkit from langchain_community.utilities.sql_database import SQLDatabase from langchain.agents import create_sql_agent from tests.unit_tests.llms.fake_llm import FakeLLM def test_create_sql_agent() -> None: db = SQLDatabase.from_uri("sqlite:///:memory:"...
langchain/libs/langchain/tests/unit_tests/agents/test_sql.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/agents/test_sql.py", "repo_id": "langchain", "token_count": 229 }
593
import { CallbackManagerForToolRun } from "@langchain/core/callbacks/manager"; import { Tool, type ToolParams } from "@langchain/core/tools"; import Exa, { ContentsOptions, RegularSearchOptions } from "exa-js"; /** * Options for the ExaSearchResults tool. */ export type ExaSearchRetrieverFields< T extends Contents...
langchainjs/libs/langchain-exa/src/tools.ts/0
{ "file_path": "langchainjs/libs/langchain-exa/src/tools.ts", "repo_id": "langchainjs", "token_count": 667 }
1,004
import requests from kor.extraction import create_extraction_chain from kor.nodes import Object, Text, Number from langchain.chat_models import ChatOpenAI from langchain.docstore.document import Document # Extraction schema - schema = Object( id = "episode_id", description = "An ID for each Lex Fridman podcas...
auto-evaluator/streamlit/kor_retriever_lex.py/0
{ "file_path": "auto-evaluator/streamlit/kor_retriever_lex.py", "repo_id": "auto-evaluator", "token_count": 575 }
6
// 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/util/lock/key_lock.go/0
{ "file_path": "milvus/pkg/util/lock/key_lock.go", "repo_id": "milvus", "token_count": 1129 }
1,941
from langchain_community.document_loaders.brave_search import BraveSearchLoader __all__ = ["BraveSearchLoader"]
langchain/libs/langchain/langchain/document_loaders/brave_search.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/brave_search.py", "repo_id": "langchain", "token_count": 31 }
477
use candle::{Result, Tensor}; #[derive(Debug, Clone)] pub struct DDPMWSchedulerConfig { scaler: f64, s: f64, } impl Default for DDPMWSchedulerConfig { fn default() -> Self { Self { scaler: 1f64, s: 0.008f64, } } } pub struct DDPMWScheduler { init_alpha_cump...
candle/candle-transformers/src/models/wuerstchen/ddpm.rs/0
{ "file_path": "candle/candle-transformers/src/models/wuerstchen/ddpm.rs", "repo_id": "candle", "token_count": 1537 }
80
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
transformers/src/transformers/models/llama/modeling_llama.py/0
{ "file_path": "transformers/src/transformers/models/llama/modeling_llama.py", "repo_id": "transformers", "token_count": 30119 }
682
<html> <div role="main"> Hello World! </div> </html>
langchain/libs/community/tests/unit_tests/document_loaders/test_docs/readthedocs/div_role_main/test.html/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_docs/readthedocs/div_role_main/test.html", "repo_id": "langchain", "token_count": 31 }
370
from llama_index.core.readers.base import BaseReader from llama_index.readers.patentsview import PatentsviewReader def test_class(): names_of_base_classes = [b.__name__ for b in PatentsviewReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-patentsview/tests/test_readers_patentsview.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-patentsview/tests/test_readers_patentsview.py", "repo_id": "llama_index", "token_count": 91 }
1,364
use candle::{DType, Device, IndexOp, Result, Tensor, D}; use candle_nn::{embedding, Embedding, LayerNorm, Linear, Module, VarBuilder}; fn linear(size1: usize, size2: usize, bias: bool, vb: VarBuilder) -> Result<Linear> { let weight = vb.get((size2, size1), "weight")?; let bias = if bias { Some(vb.get(s...
candle/candle-transformers/src/models/bigcode.rs/0
{ "file_path": "candle/candle-transformers/src/models/bigcode.rs", "repo_id": "candle", "token_count": 6402 }
66
<!--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...
accelerate/docs/source/usage_guides/tracking.md/0
{ "file_path": "accelerate/docs/source/usage_guides/tracking.md", "repo_id": "accelerate", "token_count": 2703 }
4
"""Base interfaces for tracing runs.""" from __future__ import annotations import logging import sys import traceback from abc import ABC, abstractmethod from datetime import datetime, timezone from typing import ( TYPE_CHECKING, Any, Dict, List, Literal, Optional, Sequence, Set, Un...
langchain/libs/core/langchain_core/tracers/base.py/0
{ "file_path": "langchain/libs/core/langchain_core/tracers/base.py", "repo_id": "langchain", "token_count": 11426 }
399
<jupyter_start><jupyter_text>Lantern Vector Store (auto-retriever)This guide shows how to perform **auto-retrieval** in LlamaIndex. Many popular vector DBs support a set of metadata filters in addition to a query string for semantic search. Given a natural language query, we first use the LLM to infer a set of metadata...
llama_index/docs/examples/vector_stores/LanternAutoRetriever.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/LanternAutoRetriever.ipynb", "repo_id": "llama_index", "token_count": 2156 }
1,111
{ "name": "@langchain/cohere", "version": "0.0.5", "description": "Cohere integration for LangChain.js", "type": "module", "engines": { "node": ">=18" }, "main": "./index.js", "types": "./index.d.ts", "repository": { "type": "git", "url": "git@github.com:langchain-ai/langchainjs.git" }, ...
langchainjs/libs/langchain-cohere/package.json/0
{ "file_path": "langchainjs/libs/langchain-cohere/package.json", "repo_id": "langchainjs", "token_count": 1659 }
972
// 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/querycoordv2/job/job_sync.go/0
{ "file_path": "milvus/internal/querycoordv2/job/job_sync.go", "repo_id": "milvus", "token_count": 996 }
1,759
"""Abstract interface for document loader implementations.""" from __future__ import annotations from abc import ABC, abstractmethod from typing import TYPE_CHECKING, AsyncIterator, Iterator, List, Optional from langchain_core.documents import Document from langchain_core.runnables import run_in_executor from langch...
langchain/libs/community/langchain_community/document_loaders/base.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/base.py", "repo_id": "langchain", "token_count": 1306 }
245
import { BaseMessage, HumanMessage } from "../../messages/index.js"; import { RunnableLambda } from "../base.js"; import { RunnableConfig } from "../config.js"; import { RunnableWithMessageHistory } from "../history.js"; import { BaseChatMessageHistory, BaseListChatMessageHistory, } from "../../chat_history.js"; im...
langchainjs/langchain-core/src/runnables/tests/runnable_history.test.ts/0
{ "file_path": "langchainjs/langchain-core/src/runnables/tests/runnable_history.test.ts", "repo_id": "langchainjs", "token_count": 1642 }
839
import { Runnable, RunnableLike, _coerceToDict, _coerceToRunnable, } from "./base.js"; import { RunnableConfig, getCallbackManagerForConfig, patchConfig, } from "./config.js"; import { CallbackManagerForChainRun } from "../callbacks/manager.js"; import { concat } from "../utils/stream.js"; /** * Type fo...
langchainjs/langchain-core/src/runnables/branch.ts/0
{ "file_path": "langchainjs/langchain-core/src/runnables/branch.ts", "repo_id": "langchainjs", "token_count": 3206 }
857
# coding=utf-8 # Copyright 2021 The Facebook AI Research Team Authors 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/licenses/LIC...
transformers/src/transformers/models/mbart50/tokenization_mbart50.py/0
{ "file_path": "transformers/src/transformers/models/mbart50/tokenization_mbart50.py", "repo_id": "transformers", "token_count": 7343 }
630
<jupyter_start><jupyter_code>from main import benchmark df = benchmark(verbose=True, models=["llama13b-v2-chat", "llama70b-v2-chat"])<jupyter_output>========================================= Evaluating | react | llama13b-v2-chat | What is 123 + 321 * 2? | Response: To evaluate the expression `123 + 32...
llama_index/benchmarks/agent/agent_benchmark.ipynb/0
{ "file_path": "llama_index/benchmarks/agent/agent_benchmark.ipynb", "repo_id": "llama_index", "token_count": 542 }
1,074
python_sources()
llama_index/llama-index-finetuning/llama_index/finetuning/cross_encoders/BUILD/0
{ "file_path": "llama_index/llama-index-finetuning/llama_index/finetuning/cross_encoders/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,220
package model import ( "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus/internal/proto/indexpb" ) var ( segmentID = int64(1) buildID = int64(1) segmentIdxPb = &indexpb.SegmentIndex{ CollectionID: colID, PartitionID: p...
milvus/internal/metastore/model/segment_index_test.go/0
{ "file_path": "milvus/internal/metastore/model/segment_index_test.go", "repo_id": "milvus", "token_count": 595 }
1,829
"""Init file of LlamaIndex.""" from pathlib import Path with open(Path(__file__).absolute().parents[0] / "VERSION") as _f: __version__ = _f.read().strip() import logging from logging import NullHandler from typing import Callable, Optional # import global eval handler from llama_index.legacy.callbacks.global_h...
llama_index/llama-index-legacy/llama_index/legacy/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/__init__.py", "repo_id": "llama_index", "token_count": 1594 }
1,634
from llama_index.core.readers.base import BaseReader from llama_index.readers.bitbucket import BitbucketReader def test_class(): names_of_base_classes = [b.__name__ for b in BitbucketReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-bitbucket/tests/test_readers_bitbucket.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-bitbucket/tests/test_readers_bitbucket.py", "repo_id": "llama_index", "token_count": 91 }
1,344
from langchain_community.vectorstores.xata import XataVectorStore __all__ = ["XataVectorStore"]
langchain/libs/langchain/langchain/vectorstores/xata.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/xata.py", "repo_id": "langchain", "token_count": 29 }
581
from typing import Any, List, Literal from langchain_core.messages.base import ( BaseMessage, BaseMessageChunk, merge_content, ) class FunctionMessage(BaseMessage): """Message for passing the result of executing a function back to a model.""" name: str """The name of the function that was ex...
langchain/libs/core/langchain_core/messages/function.py/0
{ "file_path": "langchain/libs/core/langchain_core/messages/function.py", "repo_id": "langchain", "token_count": 688 }
414
""" ECA module from ECAnet paper: ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks https://arxiv.org/abs/1910.03151 Original ECA model borrowed from https://github.com/BangguWu/ECANet Modified circular ECA implementation and adaption for use in timm package by Chris Ha https://github.com/V...
pytorch-image-models/timm/layers/eca.py/0
{ "file_path": "pytorch-image-models/timm/layers/eca.py", "repo_id": "pytorch-image-models", "token_count": 2411 }
332
"""Test Neo4j functionality.""" from langchain_community.vectorstores.neo4j_vector import remove_lucene_chars def test_escaping_lucene() -> None: """Test escaping lucene characters""" assert remove_lucene_chars("Hello+World") == "Hello World" assert remove_lucene_chars("Hello World\\") == "Hello World" ...
langchain/libs/community/tests/unit_tests/vectorstores/test_neo4j.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/vectorstores/test_neo4j.py", "repo_id": "langchain", "token_count": 650 }
418
# Tracing Similar to the Python `langchain` package, JS `langchain` also supports tracing. You can view the tracing docs, including the JS Quickstart [here.](https://docs.smith.langchain.com/docs/)
langchainjs/docs/core_docs/docs/production/tracing.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/production/tracing.mdx", "repo_id": "langchainjs", "token_count": 56 }
773
// 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/data_node_test.go/0
{ "file_path": "milvus/internal/datanode/data_node_test.go", "repo_id": "milvus", "token_count": 2748 }
1,693
package common const ( DefaultTenant = "default_tenant" DefaultDatabase = "default_database" )
chroma/go/coordinator/internal/common/constants.go/0
{ "file_path": "chroma/go/coordinator/internal/common/constants.go", "repo_id": "chroma", "token_count": 33 }
45
#!/usr/bin/env python # coding=utf-8 # 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-...
transformers/examples/research_projects/layoutlmv3/run_funsd_cord.py/0
{ "file_path": "transformers/examples/research_projects/layoutlmv3/run_funsd_cord.py", "repo_id": "transformers", "token_count": 8703 }
604
// 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/util/cache/lru_impl_test.go/0
{ "file_path": "milvus/pkg/util/cache/lru_impl_test.go", "repo_id": "milvus", "token_count": 1576 }
1,831
//! Contrastive Language-Image Pre-Training //! //! Contrastive Language-Image Pre-Training (CLIP) is an architecture trained on //! pairs of images with related texts. //! //! https://github.com/openai/CLIP use candle::{DType, Device, Result, Tensor, D}; use candle_nn as nn; use candle_nn::Module; #[derive(Debug, Clo...
candle/candle-transformers/src/models/stable_diffusion/clip.rs/0
{ "file_path": "candle/candle-transformers/src/models/stable_diffusion/clip.rs", "repo_id": "candle", "token_count": 6474 }
77
// Inspired by // https://github.com/NVIDIA/DALI/blob/main/include/dali/core/static_switch.h // and https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/Dispatch.h #pragma once /// @param COND - a boolean expression to switch by /// @param CONST_NAME - a name given for the constexpr bool variable. /// @...
candle/candle-flash-attn/kernels/static_switch.h/0
{ "file_path": "candle/candle-flash-attn/kernels/static_switch.h", "repo_id": "candle", "token_count": 1516 }
57
import sqlalchemy.orm import langchain_community # noqa: F401 def test_configure_mappers() -> None: sqlalchemy.orm.configure_mappers()
langchain/libs/community/tests/unit_tests/test_sqlalchemy.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/test_sqlalchemy.py", "repo_id": "langchain", "token_count": 51 }
384
import os import argparse from transformers import ( AutoModelForCausalLM, AutoTokenizer, set_seed, default_data_collator, ) from datasets import load_from_disk import torch from transformers import Trainer, TrainingArguments from peft import PeftConfig, PeftModel import shutil def parse_arge(): "...
notebooks/sagemaker/24_train_bloom_peft_lora/scripts/run_clm.py/0
{ "file_path": "notebooks/sagemaker/24_train_bloom_peft_lora/scripts/run_clm.py", "repo_id": "notebooks", "token_count": 2010 }
310
<jupyter_start><jupyter_text>CTranslate2 **CTranslate2** is a C++ and Python library for efficient inference with Transformer models.The project implements a custom runtime that applies many performance optimization techniques such as weights quantization, layers fusion, batch reordering, etc., to accelerate and reduce...
langchain/docs/docs/integrations/llms/ctranslate2.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/ctranslate2.ipynb", "repo_id": "langchain", "token_count": 1768 }
118
"""All integration tests for Cache objects."""
langchain/libs/langchain/tests/integration_tests/cache/__init__.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/cache/__init__.py", "repo_id": "langchain", "token_count": 10 }
635
<jupyter_start><jupyter_text>Async ChromiumChromium is one of the browsers supported by Playwright, a library used to control browser automation. By running `p.chromium.launch(headless=True)`, we are launching a headless instance of Chromium. Headless mode means that the browser is running without a graphical user inte...
langchain/docs/docs/integrations/document_loaders/async_chromium.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/async_chromium.ipynb", "repo_id": "langchain", "token_count": 282 }
97
#!/bin/bash # 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 applica...
milvus/tests/scripts/qa/uninstall_milvus.sh/0
{ "file_path": "milvus/tests/scripts/qa/uninstall_milvus.sh", "repo_id": "milvus", "token_count": 1808 }
1,909
from langchain_mistralai.chat_models import ChatMistralAI from langchain_mistralai.embeddings import MistralAIEmbeddings __all__ = ["ChatMistralAI", "MistralAIEmbeddings"]
langchain/libs/partners/mistralai/langchain_mistralai/__init__.py/0
{ "file_path": "langchain/libs/partners/mistralai/langchain_mistralai/__init__.py", "repo_id": "langchain", "token_count": 58 }
618
import { DataSource } from "typeorm"; import { OpenAI } from "@langchain/openai"; import { SqlDatabase } from "langchain/sql_db"; import { SqlDatabaseChain } from "langchain/chains/sql_db"; /** * This example uses a SAP HANA Cloud database. You can create a free trial database via https://developers.sap.com/tutorials...
langchainjs/examples/src/chains/sql_db_saphana_legacy.ts/0
{ "file_path": "langchainjs/examples/src/chains/sql_db_saphana_legacy.ts", "repo_id": "langchainjs", "token_count": 418 }
850
from typing import Any, Dict, List, Optional from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator from langchain_community.llms.sagemaker_endpoint import ContentHandlerBase class EmbeddingsContentHandler(ContentHandlerBase[List[str], List[List[floa...
langchain/libs/community/langchain_community/embeddings/sagemaker_endpoint.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/sagemaker_endpoint.py", "repo_id": "langchain", "token_count": 3248 }
260
from llama_index.readers.file.epub.base import EpubReader __all__ = ["EpubReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/epub/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/epub/__init__.py", "repo_id": "llama_index", "token_count": 31 }
1,488
"""Base index classes.""" import logging from abc import ABC, abstractmethod from typing import Any, Dict, Generic, List, Optional, Sequence, Type, TypeVar, cast from llama_index.legacy.chat_engine.types import BaseChatEngine, ChatMode from llama_index.legacy.core.base_query_engine import BaseQueryEngine from llama_i...
llama_index/llama-index-legacy/llama_index/legacy/indices/base.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/base.py", "repo_id": "llama_index", "token_count": 6706 }
1,559
# coding=utf-8 # Copyright 2023 The Salesforce Authors 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/LI...
transformers/src/transformers/models/blip_2/modeling_blip_2.py/0
{ "file_path": "transformers/src/transformers/models/blip_2/modeling_blip_2.py", "repo_id": "transformers", "token_count": 35021 }
608
# Monday Loader This loader loads data from monday.com. The user specifies an API token to initialize the MondayReader. They then specify a monday.com board id to load in the corresponding Document objects. ## Usage Here's an example usage of the MondayReader. ```python from llama_index import download_loader Mond...
llama_index/llama-index-integrations/readers/llama-index-readers-mondaydotcom/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mondaydotcom/README.md", "repo_id": "llama_index", "token_count": 261 }
1,523
--- sidebar_position: 4 --- # Custom chat models This notebook goes over how to create a custom chat model wrapper, in case you want to use your own chat model or a different wrapper than one that is directly supported in LangChain. There are a few required things that a chat model needs to implement after extending...
langchainjs/docs/core_docs/docs/modules/model_io/chat/custom_chat.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/chat/custom_chat.mdx", "repo_id": "langchainjs", "token_count": 2519 }
792
import os import sys from typing import Any, List from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseModel, Extra class JohnSnowLabsEmbeddings(BaseModel, Embeddings): """JohnSnowLabs embedding models To use, you should have the ``johnsnowlabs`` python package install...
langchain/libs/community/langchain_community/embeddings/johnsnowlabs.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/johnsnowlabs.py", "repo_id": "langchain", "token_count": 1298 }
258
# coding=utf-8 # Copyright 2021 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...
transformers/tests/models/wav2vec2/test_feature_extraction_wav2vec2.py/0
{ "file_path": "transformers/tests/models/wav2vec2/test_feature_extraction_wav2vec2.py", "repo_id": "transformers", "token_count": 4411 }
849
from typing import List, cast import pandas as pd from agent_utils import AGENTS, ALL_MODELS, get_model, is_valid_combination from button_tasks import TASKS as BUTTON_TASKS from fire import Fire from llama_index.agent.types import BaseAgent from math_tasks import TASKS as MATH_TASKS ALL_TASKS = list(MATH_TASKS.keys()...
llama_index/benchmarks/agent/main.py/0
{ "file_path": "llama_index/benchmarks/agent/main.py", "repo_id": "llama_index", "token_count": 1196 }
1,026
import { expect, test } from "@jest/globals"; import { v4 as uuid } from "uuid"; import { ZepMemory } from "../zep.js"; const sessionId = uuid(); const baseURL = "http://localhost:8000"; const zepMemory = new ZepMemory({ sessionId, baseURL }); beforeEach((done) => { setTimeout(done, 1000); // 1-second delay before ...
langchainjs/libs/langchain-community/src/memory/tests/zep_memory.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/memory/tests/zep_memory.int.test.ts", "repo_id": "langchainjs", "token_count": 480 }
1,031
// 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/util/lifetime/lifetime.go/0
{ "file_path": "milvus/pkg/util/lifetime/lifetime.go", "repo_id": "milvus", "token_count": 878 }
1,843
import { ChatOpenAI } from "@langchain/openai"; import { createSqlQueryChain } from "langchain/chains/sql_db"; import { SqlDatabase } from "langchain/sql_db"; import { DataSource } from "typeorm"; const datasource = new DataSource({ type: "sqlite", database: "../../../../Chinook.db", }); const db = await SqlDataba...
langchainjs/examples/src/use_cases/sql/quickstart_chain.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/sql/quickstart_chain.ts", "repo_id": "langchainjs", "token_count": 259 }
869
#!/usr/bin/env node const { spawn } = require("child_process"); const fs = require("fs"); let folderName = '.'; if (process.argv.length >= 3) { folderName = process.argv[2]; if (!fs.existsSync(folderName)) { fs.mkdirSync(folderName); } } const clone = spawn("git", ["clone", "https://github.com/rustwasm/cr...
tokenizers/tokenizers/examples/unstable_wasm/www/.bin/create-wasm-app.js/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/.bin/create-wasm-app.js", "repo_id": "tokenizers", "token_count": 210 }
454
ALTER TABLE collections ADD COLUMN dimension INTEGER;
chroma/chromadb/migrations/sysdb/00003-collection-dimension.sqlite.sql/0
{ "file_path": "chroma/chromadb/migrations/sysdb/00003-collection-dimension.sqlite.sql", "repo_id": "chroma", "token_count": 14 }
17
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/herbert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/herbert.md", "repo_id": "transformers", "token_count": 956 }
508
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-faiss/llama_index/readers/faiss/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-faiss/llama_index/readers/faiss/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,397
.PHONY: all format lint test tests integration_tests help # Default target executed when no arguments are given to make. all: help # Define a variable for the test file path. TEST_FILE ?= tests/unit_tests/ test: poetry run pytest $(TEST_FILE) tests: poetry run pytest $(TEST_FILE) check_imports: $(shell find lang...
langchain/libs/partners/nvidia-ai-endpoints/Makefile/0
{ "file_path": "langchain/libs/partners/nvidia-ai-endpoints/Makefile", "repo_id": "langchain", "token_count": 720 }
634
--- hide_table_of_contents: true --- # SerpAPI Loader This guide shows how to use SerpAPI with LangChain to load web search results. ## Overview [SerpAPI](https://serpapi.com/) is a real-time API that provides access to search results from various search engines. It is commonly used for tasks like competitor analys...
langchainjs/docs/core_docs/docs/integrations/document_loaders/web_loaders/serpapi.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/document_loaders/web_loaders/serpapi.mdx", "repo_id": "langchainjs", "token_count": 417 }
716
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-nvidia-tensorrt/llama_index/llms/nvidia_tensorrt/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-nvidia-tensorrt/llama_index/llms/nvidia_tensorrt/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,289
from langchain_community.document_loaders.blob_loaders.file_system import ( FileSystemBlobLoader, ) from langchain_community.document_loaders.blob_loaders.schema import Blob, BlobLoader from langchain_community.document_loaders.blob_loaders.youtube_audio import ( YoutubeAudioLoader, ) __all__ = ["BlobLoader", ...
langchain/libs/community/langchain_community/document_loaders/blob_loaders/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/blob_loaders/__init__.py", "repo_id": "langchain", "token_count": 123 }
251
"""Empty Index.""" from llama_index.core.indices.empty.base import EmptyIndex, GPTEmptyIndex from llama_index.core.indices.empty.retrievers import EmptyIndexRetriever __all__ = ["EmptyIndex", "EmptyIndexRetriever", "GPTEmptyIndex"]
llama_index/llama-index-core/llama_index/core/indices/empty/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/empty/__init__.py", "repo_id": "llama_index", "token_count": 78 }
1,152
# coding=utf-8 # Copyright 2020, The RAG Authors 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/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/rag/tokenization_rag.py/0
{ "file_path": "transformers/src/transformers/models/rag/tokenization_rag.py", "repo_id": "transformers", "token_count": 1854 }
659
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/import_utils.py/0
{ "file_path": "peft/src/peft/import_utils.py", "repo_id": "peft", "token_count": 843 }
331
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py", "repo_id": "diffusers", "token_count": 33602 }
249
from langchain_community.vectorstores.zep import CollectionConfig, ZepVectorStore __all__ = ["CollectionConfig", "ZepVectorStore"]
langchain/libs/langchain/langchain/vectorstores/zep.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/zep.py", "repo_id": "langchain", "token_count": 36 }
620
<jupyter_start><jupyter_text>LangChain EmbeddingsThis guide shows you how to use embedding models from [LangChain](https://python.langchain.com/docs/integrations/text_embedding/). If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-embeddings-...
llama_index/docs/examples/embeddings/Langchain.ipynb/0
{ "file_path": "llama_index/docs/examples/embeddings/Langchain.ipynb", "repo_id": "llama_index", "token_count": 377 }
1,099
python_sources() python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/news/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/news/BUILD", "repo_id": "llama_index", "token_count": 24 }
1,433
from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def test_patch_submodule(): import os as original_os from os import path as original_path from os import rename as original_rename from os.path import dirname as original_dirname from os.path impor...
datasets/tests/test_patching.py/0
{ "file_path": "datasets/tests/test_patching.py", "repo_id": "datasets", "token_count": 2274 }
153
# coding=utf-8 # Copyright 2021 Microsoft 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/deberta_v2/modeling_tf_deberta_v2.py/0
{ "file_path": "transformers/src/transformers/models/deberta_v2/modeling_tf_deberta_v2.py", "repo_id": "transformers", "token_count": 36390 }
588
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 1724, "logprob": -7.6914062, "text": "What" }, { "id": 33...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_awq_sharded/test_flash_llama_awq_sharded.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_awq_sharded/test_flash_llama_awq_sharded.json", "repo_id": "text-generation-inference", "token_count": 1238 }
404
<jupyter_start><jupyter_text>Metadata Replacement + Node Sentence WindowIn this notebook, we use the `SentenceWindowNodeParser` to parse documents into single sentences per node. Each node also contains a "window" with the sentences on either side of the node sentence.Then, during retrieval, before passing the retrieve...
llama_index/docs/examples/node_postprocessor/MetadataReplacementDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/node_postprocessor/MetadataReplacementDemo.ipynb", "repo_id": "llama_index", "token_count": 4377 }
1,097
# @langchain/cohere This package contains the LangChain.js integrations for Cohere through their SDK. ## Installation ```bash npm2yarn npm install @langchain/cohere ``` This package, along with the main LangChain package, depends on [`@langchain/core`](https://npmjs.com/package/@langchain/core/). If you are using t...
langchainjs/libs/langchain-cohere/README.md/0
{ "file_path": "langchainjs/libs/langchain-cohere/README.md", "repo_id": "langchainjs", "token_count": 994 }
932
MAX_SUM_OFFSET_AND_LIMIT = 16384
milvus/tests/restful_client/utils/constant.py/0
{ "file_path": "milvus/tests/restful_client/utils/constant.py", "repo_id": "milvus", "token_count": 18 }
1,978
<!--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 applicable law or agreed...
transformers/docs/source/ja/perf_infer_cpu.md/0
{ "file_path": "transformers/docs/source/ja/perf_infer_cpu.md", "repo_id": "transformers", "token_count": 1977 }
545
import type { Conversation } from "$lib/types/Conversation"; import type { Message } from "$lib/types/Message"; import { format } from "date-fns"; import { downloadFile } from "./files/downloadFile"; export async function preprocessMessages( messages: Message[], multimodal: boolean, id: Conversation["_id"] ): Promi...
chat-ui/src/lib/server/preprocessMessages.ts/0
{ "file_path": "chat-ui/src/lib/server/preprocessMessages.ts", "repo_id": "chat-ui", "token_count": 1373 }
90
<jupyter_start><jupyter_text>DashScopeLet's load the DashScope Embedding class.<jupyter_code>from langchain_community.embeddings import DashScopeEmbeddings embeddings = DashScopeEmbeddings( model="text-embedding-v1", dashscope_api_key="your-dashscope-api-key" ) text = "This is a test document." query_result = embed...
langchain/docs/docs/integrations/text_embedding/dashscope.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/dashscope.ipynb", "repo_id": "langchain", "token_count": 162 }
171
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-wikipedia/llama_index/tools/wikipedia/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-wikipedia/llama_index/tools/wikipedia/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,637
CONFIG_KEY_SEND = "__pregel_send" CONFIG_KEY_READ = "__pregel_read"
langgraph/langgraph/constants.py/0
{ "file_path": "langgraph/langgraph/constants.py", "repo_id": "langgraph", "token_count": 33 }
1,037
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/util/flowgraph/node.go/0
{ "file_path": "milvus/internal/util/flowgraph/node.go", "repo_id": "milvus", "token_count": 2436 }
1,896
"""Test pipeline functionality.""" from typing import Dict, List, Optional import pytest from langchain.callbacks.manager import ( AsyncCallbackManagerForChainRun, CallbackManagerForChainRun, ) from langchain.chains.base import Chain from langchain.chains.sequential import SequentialChain, SimpleSequentialCh...
langchain/libs/langchain/tests/unit_tests/chains/test_sequential.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/chains/test_sequential.py", "repo_id": "langchain", "token_count": 3408 }
622
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/extended/test_trainer_ext.py/0
{ "file_path": "transformers/tests/extended/test_trainer_ext.py", "repo_id": "transformers", "token_count": 6361 }
715
# coding=utf-8 # Copyright 2018 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/xlnet/convert_xlnet_original_tf_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/xlnet/convert_xlnet_original_tf_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 1468 }
722
from typing import Dict, Iterator, List, Optional, Tuple, Union from tokenizers import AddedToken, Tokenizer, decoders, pre_tokenizers, trainers from tokenizers.models import BPE from tokenizers.normalizers import NFKC from .base_tokenizer import BaseTokenizer class SentencePieceBPETokenizer(BaseTokenizer): """...
tokenizers/bindings/python/py_src/tokenizers/implementations/sentencepiece_bpe.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/sentencepiece_bpe.py", "repo_id": "tokenizers", "token_count": 1655 }
414
try: from pydantic.v1.main import * # noqa: F403 except ImportError: from pydantic.main import * # noqa: F403
langchain/libs/core/langchain_core/pydantic_v1/main.py/0
{ "file_path": "langchain/libs/core/langchain_core/pydantic_v1/main.py", "repo_id": "langchain", "token_count": 49 }
418
# Copyright 2022 The HuggingFace Inc. team and the AI-Sweden team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
transformers/src/transformers/models/gpt_sw3/convert_megatron_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/gpt_sw3/convert_megatron_to_pytorch.py", "repo_id": "transformers", "token_count": 3464 }
680
import os from typing import Callable, Union import PIL.Image import PIL.ImageOps import requests def load_image( image: Union[str, PIL.Image.Image], convert_method: Callable[[PIL.Image.Image], PIL.Image.Image] = None ) -> PIL.Image.Image: """ Loads `image` to a PIL Image. Args: image (`str`...
diffusers/src/diffusers/utils/loading_utils.py/0
{ "file_path": "diffusers/src/diffusers/utils/loading_utils.py", "repo_id": "diffusers", "token_count": 660 }
263
import { getAccessToken, getCredentials, Credentials, } from "web-auth-library/google"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import type { GoogleAbstractedClient, GoogleAbstractedClientOps, } from "../types/googlevertexai-types.js"; import { GoogleVertexAIStream } from "./google...
langchainjs/libs/langchain-community/src/utils/googlevertexai-webauth.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/utils/googlevertexai-webauth.ts", "repo_id": "langchainjs", "token_count": 1225 }
1,000
# Copyright 2024 TencentARC and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
diffusers/examples/community/pipeline_stable_diffusion_xl_controlnet_adapter.py/0
{ "file_path": "diffusers/examples/community/pipeline_stable_diffusion_xl_controlnet_adapter.py", "repo_id": "diffusers", "token_count": 34159 }
205
# coding=utf-8 # Copyright 2020 The SqueezeBert authors 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/licenses/LICENSE-2.0 # # U...
transformers/tests/models/squeezebert/test_modeling_squeezebert.py/0
{ "file_path": "transformers/tests/models/squeezebert/test_modeling_squeezebert.py", "repo_id": "transformers", "token_count": 5314 }
737
# Agents Putting together an agent in LlamaIndex can be done by defining a set of tools and providing them to our ReActAgent implementation. We're using it here with OpenAI, but it can be used with any sufficiently capable LLM: ```python from llama_index.core.tools import FunctionTool from llama_index.llms.openai imp...
llama_index/docs/understanding/putting_it_all_together/agents.md/0
{ "file_path": "llama_index/docs/understanding/putting_it_all_together/agents.md", "repo_id": "llama_index", "token_count": 1430 }
1,165