text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
/* eslint-disable @typescript-eslint/no-explicit-any, no-new, @typescript-eslint/no-misused-promises */ import { expect, jest, test } from "@jest/globals"; import { DocumentCollection, IDocument, NotFoundError, ZepClient, } from "@getzep/zep-js"; import type { EmbeddingsInterface } from "@langchain/core/embed...
langchainjs/libs/langchain-community/src/vectorstores/tests/zep.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/zep.test.ts", "repo_id": "langchainjs", "token_count": 3357 }
1,023
import { Chroma } from "@langchain/community/vectorstores/chroma"; import { Comparators, Operators } from "../../chains/query_constructor/ir.js"; import { BasicTranslator } from "./base.js"; /** * Specialized translator for the Chroma vector database. It extends the * BasicTranslator class and translates internal qu...
langchainjs/langchain/src/retrievers/self_query/chroma.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/self_query/chroma.ts", "repo_id": "langchainjs", "token_count": 426 }
917
# coding=utf-8 # Copyright 2022 The Fairseq Authors and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/...
transformers/src/transformers/models/opt/modeling_opt.py/0
{ "file_path": "transformers/src/transformers/models/opt/modeling_opt.py", "repo_id": "transformers", "token_count": 29787 }
650
from typing import Dict # Text Generation Inference Errors class ValidationError(Exception): def __init__(self, message: str): super().__init__(message) class GenerationError(Exception): def __init__(self, message: str): super().__init__(message) class OverloadedError(Exception): def _...
text-generation-inference/clients/python/text_generation/errors.py/0
{ "file_path": "text-generation-inference/clients/python/text_generation/errors.py", "repo_id": "text-generation-inference", "token_count": 1080 }
415
#!/usr/bin/env python import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers import MarianMTModel from tran...
transformers/examples/research_projects/seq2seq-distillation/_test_bash_script.py/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/_test_bash_script.py", "repo_id": "transformers", "token_count": 3934 }
536
import json import operator from typing import Annotated, Sequence, TypedDict from langchain_core.agents import AgentAction from langchain_core.messages import BaseMessage, FunctionMessage from langchain_core.runnables import RunnableLambda from langchain_core.utils.function_calling import convert_to_openai_function ...
langgraph/langgraph/prebuilt/chat_agent_executor.py/0
{ "file_path": "langgraph/langgraph/prebuilt/chat_agent_executor.py", "repo_id": "langgraph", "token_count": 1831 }
1,019
# LlamaIndex Llms Integration: Palm
llama_index/llama-index-integrations/llms/llama-index-llms-palm/README.md/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-palm/README.md", "repo_id": "llama_index", "token_count": 10 }
1,312
# -*- coding: utf-8 -*- import time import logging import string import random import requests import json import os from yaml.representer import SafeRepresenter # from yaml import full_load, dump import yaml import tableprint as tp import config logger = logging.getLogger("milvus_benchmark.utils") def timestr_to_in...
milvus/tests/benchmark/milvus_benchmark/utils.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/utils.py", "repo_id": "milvus", "token_count": 5284 }
2,156
from llama_index.core.ingestion.cache import IngestionCache from llama_index.core.ingestion.pipeline import ( DocstoreStrategy, IngestionPipeline, arun_transformations, run_transformations, ) __all__ = [ "DocstoreStrategy", "IngestionCache", "IngestionPipeline", "run_transformations", ...
llama_index/llama-index-core/llama_index/core/ingestion/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/ingestion/__init__.py", "repo_id": "llama_index", "token_count": 140 }
1,128
from typing import Any, Callable, Dict, Optional, Sequence from llama_index.core.base.llms.types import ChatMessage, LLMMetadata from llama_index.core.callbacks import CallbackManager from llama_index.core.constants import DEFAULT_NUM_OUTPUTS, DEFAULT_TEMPERATURE from llama_index.core.llms.generic_utils import get_fro...
llama_index/llama-index-integrations/llms/llama-index-llms-anyscale/llama_index/llms/anyscale/base.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-anyscale/llama_index/llms/anyscale/base.py", "repo_id": "llama_index", "token_count": 1209 }
1,216
grammar Plan; expr: IntegerConstant # Integer | FloatingConstant # Floating | BooleanConstant # Boolean | StringLiteral # String | Identifier # Identifier | JSO...
milvus/internal/parser/planparserv2/Plan.g4/0
{ "file_path": "milvus/internal/parser/planparserv2/Plan.g4", "repo_id": "milvus", "token_count": 2773 }
1,835
import { test, expect } from "@jest/globals"; import { BaseMessage, SystemMessage, HumanMessage, AIMessage, } from "@langchain/core/messages"; import { ChatExample, ChatGoogleVertexAI } from "../googlevertexai/web.js"; test("Google messages", async () => { const messages: BaseMessage[] = [ new HumanMessa...
langchainjs/libs/langchain-community/src/chat_models/tests/chatgooglevertexai_web.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/chat_models/tests/chatgooglevertexai_web.test.ts", "repo_id": "langchainjs", "token_count": 1432 }
964
import { NextRequest, NextResponse } from "next/server"; import { Client } from "langsmith"; export const runtime = "edge"; const langsmithClient = new Client(); /** * This handler retrieves a LangSmith trace URL for the given run. * It isn't used by default, but if you'd like to turn it on, set * "showTraceUrls...
langsmith-cookbook/feedback-examples/nextjs/app/api/trace/route.ts/0
{ "file_path": "langsmith-cookbook/feedback-examples/nextjs/app/api/trace/route.ts", "repo_id": "langsmith-cookbook", "token_count": 398 }
1,055
"""Util that calls GitHub.""" from __future__ import annotations import json from typing import TYPE_CHECKING, Any, Dict, List, Optional import requests from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator from langchain_core.utils import get_from_dict_or_env if TYPE_CHECKING: from github.Iss...
langchain/libs/community/langchain_community/utilities/github.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/github.py", "repo_id": "langchain", "token_count": 15914 }
321
import { ViolationOfExpectationsChain } from "langchain/experimental/chains/violation_of_expectations"; import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { AIMessage, HumanMessage } from "@langchain/core/messages"; // Short GPT...
langchainjs/examples/src/use_cases/advanced/violation_of_expectations_chain.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/advanced/violation_of_expectations_chain.ts", "repo_id": "langchainjs", "token_count": 956 }
887
python_tests()
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-postgres/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-postgres/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,460
# 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/kandinsky3/test_kandinsky3.py/0
{ "file_path": "diffusers/tests/pipelines/kandinsky3/test_kandinsky3.py", "repo_id": "diffusers", "token_count": 3516 }
291
python_sources()
llama_index/llama-index-core/llama_index/core/node_parser/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/node_parser/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,277
/* eslint-disable global-require,import/no-extraneous-dependencies */ // @ts-check // Note: type annotations allow type checking and IDEs autocompletion // eslint-disable-next-line import/no-extraneous-dependencies const { ProvidePlugin } = require("webpack"); const path = require("path"); const baseLightCodeBlockThe...
langchain/docs/docusaurus.config.js/0
{ "file_path": "langchain/docs/docusaurus.config.js", "repo_id": "langchain", "token_count": 5237 }
214
# Copyright 2022 The Impira 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 # # Unless r...
transformers/src/transformers/pipelines/document_question_answering.py/0
{ "file_path": "transformers/src/transformers/pipelines/document_question_answering.py", "repo_id": "transformers", "token_count": 10332 }
699
<jupyter_start><jupyter_text>MistralAI Embeddings If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-embeddings-mistralai !pip install llama-index # imports from llama_index.embeddings.mistralai import MistralAIEmbedding # get API key and cre...
llama_index/docs/examples/embeddings/mistralai.ipynb/0
{ "file_path": "llama_index/docs/examples/embeddings/mistralai.ipynb", "repo_id": "llama_index", "token_count": 228 }
1,101
import json from typing import Any, Callable, Optional, Union from langchain.evaluation.schema import StringEvaluator from langchain.output_parsers.json import parse_json_markdown class JsonEditDistanceEvaluator(StringEvaluator): """ An evaluator that calculates the edit distance between JSON strings. T...
langchain/libs/langchain/langchain/evaluation/parsing/json_distance.py/0
{ "file_path": "langchain/libs/langchain/langchain/evaluation/parsing/json_distance.py", "repo_id": "langchain", "token_count": 1445 }
528
"""Init params."""
llama_index/llama-index-core/tests/indices/document_summary/__init__.py/0
{ "file_path": "llama_index/llama-index-core/tests/indices/document_summary/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,310
import re from sphinx.directives.other import TocTree class TocTreeTags(TocTree): hasPat = re.compile("^\s*:(.+):(.+)$") def filter_entries(self, entries): filtered = [] for e in entries: m = self.hasPat.match(e) if m != None: if self.env.app.tags.has(m...
tokenizers/docs/source/_ext/toctree_tags.py/0
{ "file_path": "tokenizers/docs/source/_ext/toctree_tags.py", "repo_id": "tokenizers", "token_count": 345 }
445
# coding=utf-8 # Copyright 2021 The OpenAI Team 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/L...
transformers/src/transformers/models/clip/modeling_clip.py/0
{ "file_path": "transformers/src/transformers/models/clip/modeling_clip.py", "repo_id": "transformers", "token_count": 25734 }
577
# docstyle-ignore INSTALL_CONTENT = """ # Transformers installation ! pip install transformers datasets evaluate # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ notebook_first_cells ...
transformers/docs/source/_config.py/0
{ "file_path": "transformers/docs/source/_config.py", "repo_id": "transformers", "token_count": 156 }
488
from typing import Any, Callable, List, Optional, Sequence, TypedDict import numpy as np from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.core.bridge.pydantic import Field from llama_index.core.callbacks.base import CallbackManager from llama_index.core.node_parser import NodeParser fro...
llama_index/llama-index-core/llama_index/core/node_parser/text/semantic_splitter.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/node_parser/text/semantic_splitter.py", "repo_id": "llama_index", "token_count": 3859 }
1,190
"""Set of default prompts.""" from llama_index.core.prompts.base import PromptTemplate from llama_index.core.prompts.prompt_type import PromptType ############################################ # Tree ############################################ DEFAULT_SUMMARY_PROMPT_TMPL = ( "Write a summary of the following. Tr...
llama_index/llama-index-core/llama_index/core/prompts/default_prompts.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/prompts/default_prompts.py", "repo_id": "llama_index", "token_count": 5535 }
1,285
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datacoord/policy_test.go/0
{ "file_path": "milvus/internal/datacoord/policy_test.go", "repo_id": "milvus", "token_count": 6357 }
1,915
# 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 applicabl...
accelerate/src/accelerate/utils/environment.py/0
{ "file_path": "accelerate/src/accelerate/utils/environment.py", "repo_id": "accelerate", "token_count": 1509 }
17
import { PuppeteerWebBaseLoader } from "langchain/document_loaders/web/puppeteer"; const loaderWithOptions = new PuppeteerWebBaseLoader( "https://www.tabnews.com.br/", { launchOptions: { headless: true, }, gotoOptions: { waitUntil: "domcontentloaded", }, /** Pass custom evaluate , ...
langchainjs/examples/src/document_loaders/puppeteer_web.ts/0
{ "file_path": "langchainjs/examples/src/document_loaders/puppeteer_web.ts", "repo_id": "langchainjs", "token_count": 250 }
800
import logging from langchain_experimental.rl_chain.base import ( AutoSelectionScorer, BasedOn, Embed, Embedder, Policy, SelectionScorer, ToSelectFrom, VwPolicy, embed, stringify_embedding, ) from langchain_experimental.rl_chain.pick_best_chain import ( PickBest, PickBes...
langchain/libs/experimental/langchain_experimental/rl_chain/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/rl_chain/__init__.py", "repo_id": "langchain", "token_count": 461 }
436
--- sidebar_class_name: node-only keywords: [OpenSearchVectorStore] --- # OpenSearch :::tip Compatibility Only available on Node.js. ::: [OpenSearch](https://opensearch.org/) is a fork of [Elasticsearch](https://www.elastic.co/elasticsearch/) that is fully compatible with the Elasticsearch API. Read more about their...
langchainjs/docs/core_docs/docs/integrations/vectorstores/opensearch.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/vectorstores/opensearch.mdx", "repo_id": "langchainjs", "token_count": 1234 }
719
import json from langchain_community.vectorstores.jaguar import Jaguar from tests.integration_tests.vectorstores.fake_embeddings import ( ConsistentFakeEmbeddings, ) ############################################################################################# ## ## Requirement: fwww http server must be running a...
langchain/libs/community/tests/integration_tests/vectorstores/test_jaguar.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_jaguar.py", "repo_id": "langchain", "token_count": 1811 }
385
/* eslint-disable @typescript-eslint/no-explicit-any */ import { JsonRefs } from "./json-refs"; // jsonforms doesn't support schemas with root $ref // so we resolve root $ref and replace it with the actual schema export function simplifySchema(schema: any) { return JsonRefs.resolveRefs(schema).then((r: any) => r.res...
langserve/langserve/playground/src/utils/simplifySchema.ts/0
{ "file_path": "langserve/langserve/playground/src/utils/simplifySchema.ts", "repo_id": "langserve", "token_count": 111 }
1,132
// 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/msg_test.go/0
{ "file_path": "milvus/pkg/mq/msgstream/msg_test.go", "repo_id": "milvus", "token_count": 7086 }
1,828
<!--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/en/model_doc/open-llama.md/0
{ "file_path": "transformers/docs/source/en/model_doc/open-llama.md", "repo_id": "transformers", "token_count": 620 }
498
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-playgrounds/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-playgrounds/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,493
# Generated content DO NOT EDIT class PostProcessor: """ Base class for all post-processors This class is not supposed to be instantiated directly. Instead, any implementation of a PostProcessor will return an instance of this class when instantiated. """ def num_special_tokens_to_add(self, is...
tokenizers/bindings/python/py_src/tokenizers/processors/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/processors/__init__.pyi", "repo_id": "tokenizers", "token_count": 4779 }
463
#![deny(clippy::all)] pub const VERSION: &str = env!("CARGO_PKG_VERSION"); mod arc_rwlock_serde; pub mod decoders; pub mod encoding; pub mod models; pub mod normalizers; pub mod pre_tokenizers; pub mod processors; pub mod tasks; pub mod tokenizer; pub mod trainers; pub mod utils;
tokenizers/bindings/node/src/lib.rs/0
{ "file_path": "tokenizers/bindings/node/src/lib.rs", "repo_id": "tokenizers", "token_count": 102 }
442
"""Empty index. An index that doesn't contain any documents. Can only be used for pure LLM calls. """ from typing import Any, Dict, Optional, Sequence from llama_index.core.base.base_query_engine import BaseQueryEngine from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.data_structs...
llama_index/llama-index-core/llama_index/core/indices/empty/base.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/empty/base.py", "repo_id": "llama_index", "token_count": 1152 }
1,176
use crate::model::{Cache, Config, Llama}; use byteorder::{LittleEndian, ReadBytesExt}; use candle::{DType, Device, IndexOp, Result, Shape, Tensor}; use candle_nn::VarBuilder; use candle_transformers::generation::LogitsProcessor; use serde::{Deserialize, Serialize}; use tokenizers::Tokenizer; use wasm_bindgen::prelude::...
candle/candle-wasm-examples/llama2-c/src/worker.rs/0
{ "file_path": "candle/candle-wasm-examples/llama2-c/src/worker.rs", "repo_id": "candle", "token_count": 5770 }
84
import { LLMChain } from "langchain/chains"; import { ChatOpenAI } from "@langchain/openai"; import { ZeroShotAgent, AgentExecutor } from "langchain/agents"; import { ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate, } from "@langchain/core/prompts"; import { SerpAPI } from "@langchain/...
langchainjs/examples/src/chat/agent.ts/0
{ "file_path": "langchainjs/examples/src/chat/agent.ts", "repo_id": "langchainjs", "token_count": 506 }
768
use std::sync::{Arc, RwLock}; use crate::models::PyModel; use crate::tokenizer::PyAddedToken; use crate::utils::PyChar; use pyo3::exceptions; use pyo3::prelude::*; use pyo3::types::*; use serde::{Deserialize, Serialize}; use tk::models::TrainerWrapper; use tk::Trainer; use tokenizers as tk; /// Base class for all tra...
tokenizers/bindings/python/src/trainers.rs/0
{ "file_path": "tokenizers/bindings/python/src/trainers.rs", "repo_id": "tokenizers", "token_count": 17617 }
407
# LlamaIndex Callbacks Integration: UpTrain UpTrain is an open-source tool to evaluate and monitor the performance of language models. It provides a set of pre-built evaluations to assess the quality of responses generated by the model. Once you add UpTrainCallbackHandler to your existing LlamaIndex pipeline, it will ...
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-uptrain/README.md/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-uptrain/README.md", "repo_id": "llama_index", "token_count": 551 }
1,296
from llama_index.core.storage.index_store.keyval_index_store import KVIndexStore from llama_index.storage.index_store.redis import RedisIndexStore def test_class(): names_of_base_classes = [b.__name__ for b in RedisIndexStore.__mro__] assert KVIndexStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-redis/tests/test_storage_index_store_redis.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-redis/tests/test_storage_index_store_redis.py", "repo_id": "llama_index", "token_count": 105 }
1,422
#!/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/pytorch/contrastive-image-text/run_clip.py/0
{ "file_path": "transformers/examples/pytorch/contrastive-image-text/run_clip.py", "repo_id": "transformers", "token_count": 9756 }
523
use rand::distributions::WeightedIndex; use rand::prelude::*; use std::cell::RefCell; use std::cmp::{min, Ordering}; use std::collections::BinaryHeap; use std::rc::Rc; type NodeRef = Rc<RefCell<Node>>; type HypothesisRef = Rc<RefCell<Hypothesis>>; type Agenda = BinaryHeap<Hypothesis>; struct Hypothesis { node_ref...
tokenizers/tokenizers/src/models/unigram/lattice.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/unigram/lattice.rs", "repo_id": "tokenizers", "token_count": 12682 }
480
from typing import TYPE_CHECKING, Optional, Union if TYPE_CHECKING: from langchain.base_language import BaseLanguageModel from llama_index.legacy.llms.llama_cpp import LlamaCPP from llama_index.legacy.llms.llama_utils import completion_to_prompt, messages_to_prompt from llama_index.legacy.llms.llm import LLM from...
llama_index/llama-index-legacy/llama_index/legacy/llms/utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/utils.py", "repo_id": "llama_index", "token_count": 1031 }
1,684
python_sources()
llama_index/llama-index-packs/llama-index-packs-voyage-query-engine/examples/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-voyage-query-engine/examples/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,827
"""A simple, flexible implementation of a GPT model. Inspired by https://github.com/karpathy/minGPT/blob/master/mingpt/model.py """ import math import os import warnings from typing import List, Optional, Tuple, Union import torch import torch.nn as nn import torch.nn.functional as F from transformers import PreTraine...
text-generation-inference/server/text_generation_server/models/custom_modeling/mpt_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/mpt_modeling.py", "repo_id": "text-generation-inference", "token_count": 23558 }
402
# RSS Loader This loader allows fetching text from an RSS feed. It uses the `feedparser` module to fetch the feed and optionally the `html2text` module to sanitize it. ## Usage To use this loader, pass in an array of URL's. ```python from llama_index import download_loader RssReader = download_loader("RssReader") ...
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/rss/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/rss/README.md", "repo_id": "llama_index", "token_count": 184 }
1,568
# 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/stable_unclip_image_normalizer.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion/stable_unclip_image_normalizer.py", "repo_id": "diffusers", "token_count": 674 }
250
"""Tools for interacting with the user.""" import warnings from typing import Any from langchain_community.tools.human.tool import HumanInputRun def StdInInquireTool(*args: Any, **kwargs: Any) -> HumanInputRun: """Tool for asking the user for input.""" warnings.warn( "StdInInquireTool will be depre...
langchain/libs/community/langchain_community/tools/interaction/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/interaction/tool.py", "repo_id": "langchain", "token_count": 155 }
312
// 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/unittest/test_growing_index.cpp/0
{ "file_path": "milvus/internal/core/unittest/test_growing_index.cpp", "repo_id": "milvus", "token_count": 3976 }
1,818
# flake8: noqa from langchain_core.prompts.prompt import PromptTemplate _DEFAULT_TEMPLATE = """Question: Who lived longer, Muhammad Ali or Alan Turing? Are follow up questions needed here: Yes. Follow up: How old was Muhammad Ali when he died? Intermediate answer: Muhammad Ali was 74 years old when he died. Follow up:...
langchain/libs/langchain/langchain/agents/self_ask_with_search/prompt.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/self_ask_with_search/prompt.py", "repo_id": "langchain", "token_count": 483 }
478
<!--- 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 ...
transformers/docs/source/it/perf_hardware.md/0
{ "file_path": "transformers/docs/source/it/perf_hardware.md", "repo_id": "transformers", "token_count": 3009 }
533
import h5py import numpy as np import time import sys import threading from pathlib import Path from loguru import logger from pymilvus import connections, Collection all_index_types = ["IVF_FLAT", "IVF_SQ8", "HNSW"] def read_benchmark_hdf5(file_path): f = h5py.File(file_path, 'r') train = np.array(f["trai...
milvus/tests/python_client/deploy/scripts/second_recall_test.py/0
{ "file_path": "milvus/tests/python_client/deploy/scripts/second_recall_test.py", "repo_id": "milvus", "token_count": 1671 }
1,906
const CopyWebpackPlugin = require("copy-webpack-plugin"); const path = require('path'); module.exports = { entry: "./bootstrap.js", output: { path: path.resolve(__dirname, "dist"), filename: "bootstrap.js", }, mode: "development", plugins: [ new CopyWebpackPlugin(['index.html']) ], };
tokenizers/tokenizers/examples/unstable_wasm/www/webpack.config.js/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/webpack.config.js", "repo_id": "tokenizers", "token_count": 114 }
428
[tool.poetry] name = "neo4j-cypher-memory" version = "0.1.0" description = "Conversational interface for a Neo4j graph database" authors = [ "Tomaz Bratanic <tomaz.bratanic@neo4j.com>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" neo4j = ">5.12" openai = "<2" [tool...
langchain/templates/neo4j-cypher-memory/pyproject.toml/0
{ "file_path": "langchain/templates/neo4j-cypher-memory/pyproject.toml", "repo_id": "langchain", "token_count": 303 }
674
export type SchemaDraft = "4" | "7" | "2019-09" | "2020-12"; export const enum OutputFormat { Flag = 1 << 0, Basic = 1 << 1, Detailed = 1 << 2, } export type InstanceType = | "array" | "boolean" | "integer" | "null" | "number" | "object" | "string"; export interface Schema { $id?: string; $an...
langchainjs/langchain-core/src/utils/@cfworker/json-schema/src/types.ts/0
{ "file_path": "langchainjs/langchain-core/src/utils/@cfworker/json-schema/src/types.ts", "repo_id": "langchainjs", "token_count": 671 }
936
from __future__ import annotations import tempfile from typing import TYPE_CHECKING, List from langchain_core.documents import Document from langchain_core.pydantic_v1 import BaseModel, Field from langchain_community.document_loaders.base import BaseLoader from langchain_community.document_loaders.unstructured impor...
langchain/libs/community/langchain_community/document_loaders/onedrive_file.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/onedrive_file.py", "repo_id": "langchain", "token_count": 412 }
241
from langchain_community.document_transformers import __all__ EXPECTED_ALL = [ "BeautifulSoupTransformer", "DoctranQATransformer", "DoctranTextTranslator", "DoctranPropertyExtractor", "EmbeddingsClusteringFilter", "EmbeddingsRedundantFilter", "GoogleTranslateTransformer", "get_stateful_...
langchain/libs/community/tests/unit_tests/document_transformers/test_imports.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_transformers/test_imports.py", "repo_id": "langchain", "token_count": 205 }
372
"""Tool for the identification of prompt injection attacks.""" from __future__ import annotations from typing import TYPE_CHECKING, Union from langchain.pydantic_v1 import Field, root_validator from langchain.tools.base import BaseTool if TYPE_CHECKING: from transformers import Pipeline class PromptInjectionEx...
langchain/libs/experimental/langchain_experimental/prompt_injection_identifier/hugging_face_identifier.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/prompt_injection_identifier/hugging_face_identifier.py", "repo_id": "langchain", "token_count": 1218 }
424
Keyword Table Retrievers ========================= .. automodule:: llama_index.core.indices.keyword_table.retrievers :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper
llama_index/docs/api_reference/query/retrievers/table.rst/0
{ "file_path": "llama_index/docs/api_reference/query/retrievers/table.rst", "repo_id": "llama_index", "token_count": 85 }
1,040
from typing import List, cast import pytest try: import qdrant_client except ImportError: qdrant_client = None # type: ignore from llama_index.legacy.schema import NodeRelationship, RelatedNodeInfo, TextNode from llama_index.legacy.vector_stores import QdrantVectorStore from llama_index.legacy.vector_stores...
llama_index/llama-index-legacy/tests/vector_stores/test_qdrant.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/vector_stores/test_qdrant.py", "repo_id": "llama_index", "token_count": 3768 }
1,686
<jupyter_start><jupyter_text>BibTeX> BibTeX is a file format and reference management system commonly used in conjunction with LaTeX typesetting. It serves as a way to organize and store bibliographic information for academic and research documents.BibTeX files have a .bib extension and consist of plain text entries re...
langchain/docs/docs/integrations/document_loaders/bibtex.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/bibtex.ipynb", "repo_id": "langchain", "token_count": 1107 }
106
use crate::models::with_tracing::{linear, linear_no_bias, Linear}; use candle::{DType, Device, Module, Result, Tensor, D}; use candle_nn::{Activation, LayerNorm, VarBuilder}; use serde::Deserialize; use std::sync::Arc; // https://huggingface.co/stabilityai/stablelm-3b-4e1t/blob/main/configuration_stablelm_epoch.py #[d...
candle/candle-transformers/src/models/stable_lm.rs/0
{ "file_path": "candle/candle-transformers/src/models/stable_lm.rs", "repo_id": "candle", "token_count": 7718 }
69
from langchain_community.utilities.searchapi import SearchApiAPIWrapper __all__ = ["SearchApiAPIWrapper"]
langchain/libs/langchain/langchain/utilities/searchapi.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/searchapi.py", "repo_id": "langchain", "token_count": 33 }
620
from llama_index.core.indices import SummaryIndex from llama_index.core.schema import IndexNode, TextNode def test_composable_retrieval() -> None: """Test composable retrieval.""" text_node = TextNode(text="This is a test text node.", id_="test_text_node") index_node = IndexNode( text="This is a t...
llama_index/llama-index-core/tests/retrievers/test_composable_retriever.py/0
{ "file_path": "llama_index/llama-index-core/tests/retrievers/test_composable_retriever.py", "repo_id": "llama_index", "token_count": 296 }
1,326
from multiprocessing import Value class SharedCount: def __init__(self, epoch: int = 0): self.shared_epoch = Value('i', epoch) @property def value(self): return self.shared_epoch.value @value.setter def value(self, epoch): self.shared_epoch.value = epoch
pytorch-image-models/timm/data/readers/shared_count.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/shared_count.py", "repo_id": "pytorch-image-models", "token_count": 122 }
363
python_sources()
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-gemini/llama_index/multi_modal_llms/gemini/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-gemini/llama_index/multi_modal_llms/gemini/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,288
from langchain_community.document_loaders.tomarkdown import ToMarkdownLoader __all__ = ["ToMarkdownLoader"]
langchain/libs/langchain/langchain/document_loaders/tomarkdown.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/tomarkdown.py", "repo_id": "langchain", "token_count": 32 }
526
"""Test LiteLLM Router API wrapper.""" import asyncio from copy import deepcopy from typing import Any, AsyncGenerator, Coroutine, Dict, List, Tuple, Union, cast import pytest from langchain_core.messages import AIMessage, BaseMessage, HumanMessage from langchain_core.outputs import ChatGeneration, LLMResult from lan...
langchain/libs/community/tests/integration_tests/chat_models/test_litellm_router.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_models/test_litellm_router.py", "repo_id": "langchain", "token_count": 4761 }
319
<jupyter_start><jupyter_text>Que faire si mon jeu de données n'est pas sur le Hub ? Installez les bibliothèques 🤗 Transformers et 🤗 Datasets pour exécuter ce *notebook*.<jupyter_code>!pip install datasets evaluate transformers[sentencepiece] !wget https://github.com/crux82/squad-it/raw/master/SQuAD_it-train.json.gz !...
notebooks/course/fr/chapter5/section2.ipynb/0
{ "file_path": "notebooks/course/fr/chapter5/section2.ipynb", "repo_id": "notebooks", "token_count": 496 }
269
python_sources()
llama_index/llama-index-packs/llama-index-packs-snowflake-query-engine/llama_index/packs/snowflake_query_engine/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-snowflake-query-engine/llama_index/packs/snowflake_query_engine/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,677
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "cache/momento", newEntrypointName: "caches/momento", }); export * from "@langchain/community/caches/momento";
langchainjs/langchain/src/cache/momento.ts/0
{ "file_path": "langchainjs/langchain/src/cache/momento.ts", "repo_id": "langchainjs", "token_count": 85 }
922
extern crate tokenizers as tk; use crate::encoding::*; use crate::tokenizer::Tokenizer; use napi::bindgen_prelude::*; use tk::tokenizer::{EncodeInput, Encoding}; pub struct EncodeTask<'s> { pub tokenizer: Tokenizer, pub input: Option<EncodeInput<'s>>, pub add_special_tokens: bool, } impl Task for EncodeTask<'s...
tokenizers/bindings/node/src/tasks/tokenizer.rs/0
{ "file_path": "tokenizers/bindings/node/src/tasks/tokenizer.rs", "repo_id": "tokenizers", "token_count": 1295 }
455
# LlamaIndex Callbacks Integration: Arize Phoenix
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-arize-phoenix/README.md/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-arize-phoenix/README.md", "repo_id": "llama_index", "token_count": 12 }
1,262
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-wandb/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-wandb/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,264
""" MultiStep LR Scheduler Basic multi step LR schedule with warmup, noise. """ import torch import bisect from timm.scheduler.scheduler import Scheduler from typing import List class MultiStepLRScheduler(Scheduler): """ """ def __init__( self, optimizer: torch.optim.Optimizer, ...
pytorch-image-models/timm/scheduler/multistep_lr.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/multistep_lr.py", "repo_id": "pytorch-image-models", "token_count": 1029 }
363
<jupyter_start><jupyter_text>Comprendre la classe Interface Installez les bibliothèques 🤗 Transformers et 🤗 Gradio pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece] !pip install gradio import numpy as np import gradio as gr def reverse_audio(audio): sr, data = audio ...
notebooks/course/fr/chapter9/section3.ipynb/0
{ "file_path": "notebooks/course/fr/chapter9/section3.ipynb", "repo_id": "notebooks", "token_count": 759 }
298
import os from typing import Optional, Type from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import BaseModel, Field from langchain_core.tools import BaseTool from langchain_community.tools.file_management.utils import ( INVALID_PATH_TEMPLATE, BaseFileToolMixin, ...
langchain/libs/community/langchain_community/tools/file_management/list_dir.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/file_management/list_dir.py", "repo_id": "langchain", "token_count": 560 }
297
""" Official evaluation script for CUAD dataset. """ import argparse import json import re import string import sys import numpy as np IOU_THRESH = 0.5 def get_jaccard(prediction, ground_truth): remove_tokens = [".", ",", ";", ":"] for token in remove_tokens: ground_truth = ground_truth.replace(t...
datasets/metrics/cuad/evaluate.py/0
{ "file_path": "datasets/metrics/cuad/evaluate.py", "repo_id": "datasets", "token_count": 3035 }
119
## Sequence to Sequence Training and Evaluation This directory contains examples for finetuning and evaluating transformers on summarization and translation tasks. Author: Sam Shleifer (https://github.com/sshleifer) ### Supported Architectures - `BartForConditionalGeneration` (and anything that inherits from it) - ...
transformers/examples/research_projects/seq2seq-distillation/README.md/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/README.md", "repo_id": "transformers", "token_count": 6520 }
553
#!/usr/bin/env python # coding=utf-8 # Copyright The HuggingFace Team 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.ap...
transformers/examples/tensorflow/multiple-choice/run_swag.py/0
{ "file_path": "transformers/examples/tensorflow/multiple-choice/run_swag.py", "repo_id": "transformers", "token_count": 10190 }
597
import * as yaml from "yaml"; import { extname } from "./extname.js"; export const loadFileContents = (contents: string, format: string) => { switch (format) { case ".json": return JSON.parse(contents); case ".yml": case ".yaml": return yaml.parse(contents); default: throw new Error...
langchainjs/langchain/src/util/parse.ts/0
{ "file_path": "langchainjs/langchain/src/util/parse.ts", "repo_id": "langchainjs", "token_count": 260 }
962
// Code generated by mockery v2.30.1. DO NOT EDIT. package importutilv2 import ( storage "github.com/milvus-io/milvus/internal/storage" mock "github.com/stretchr/testify/mock" ) // MockReader is an autogenerated mock type for the Reader type type MockReader struct { mock.Mock } type MockReader_Expecter struct { ...
milvus/internal/util/importutilv2/mock_reader.go/0
{ "file_path": "milvus/internal/util/importutilv2/mock_reader.go", "repo_id": "milvus", "token_count": 1127 }
1,798
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-sub-question-weaviate/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-sub-question-weaviate/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,688
""" Batch size decay and retry helpers. Copyright 2022 Ross Wightman """ import math def decay_batch_step(batch_size, num_intra_steps=2, no_odd=False): """ power of two batch-size decay with intra steps Decay by stepping between powers of 2: * determine power-of-2 floor of current batch size (base batch...
pytorch-image-models/timm/utils/decay_batch.py/0
{ "file_path": "pytorch-image-models/timm/utils/decay_batch.py", "repo_id": "pytorch-image-models", "token_count": 656 }
384
import type { z } from "zod"; import { zodToJsonSchema, JsonSchema7Type } from "zod-to-json-schema"; import type { BaseOutputParser } from "@langchain/core/output_parsers"; import type { BasePromptTemplate } from "@langchain/core/prompts"; import type { Runnable, RunnableInterface } from "@langchain/core/runnables"; i...
langchainjs/langchain/src/chains/openai_functions/base.ts/0
{ "file_path": "langchainjs/langchain/src/chains/openai_functions/base.ts", "repo_id": "langchainjs", "token_count": 2589 }
862
from functools import lru_cache @lru_cache(10) def log_once(log, msg: str): log(msg)
text-generation-inference/server/text_generation_server/utils/log.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/log.py", "repo_id": "text-generation-inference", "token_count": 40 }
434
from langchain_community.tools.azure_cognitive_services.form_recognizer import ( AzureCogsFormRecognizerTool, ) __all__ = ["AzureCogsFormRecognizerTool"]
langchain/libs/langchain/langchain/tools/azure_cognitive_services/form_recognizer.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/azure_cognitive_services/form_recognizer.py", "repo_id": "langchain", "token_count": 55 }
596
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/langchain_helpers/agents/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/langchain_helpers/agents/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,609
package httpserver import ( "bytes" "context" "encoding/json" "fmt" "net/http" "net/http/httptest" "testing" "time" "github.com/gin-gonic/gin" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto...
milvus/internal/distributed/proxy/httpserver/handler_v2_test.go/0
{ "file_path": "milvus/internal/distributed/proxy/httpserver/handler_v2_test.go", "repo_id": "milvus", "token_count": 18149 }
1,715
<jupyter_start><jupyter_text>How to use a SmartLLMChainA SmartLLMChain is a form of self-critique chain that can help you if have particularly complex questions to answer. Instead of doing a single LLM pass, it instead performs these 3 steps:1. Ideation: Pass the user prompt n times through the LLM to get n output prop...
langchain/cookbook/smart_llm.ipynb/0
{ "file_path": "langchain/cookbook/smart_llm.ipynb", "repo_id": "langchain", "token_count": 1290 }
82
from llama_index.extractors.marvin.base import MarvinMetadataExtractor def test_marvin_class(): """TODO: mock this class and have proper test.""" assert MarvinMetadataExtractor.class_name() == "MarvinEntityExtractor"
llama_index/llama-index-integrations/extractors/llama-index-extractors-marvin/tests/test_extractors_marvin.py/0
{ "file_path": "llama_index/llama-index-integrations/extractors/llama-index-extractors-marvin/tests/test_extractors_marvin.py", "repo_id": "llama_index", "token_count": 72 }
1,280
/** * Sleep for a given amount of time. * @param ms - The number of milliseconds to sleep for. Defaults to 1000. * @returns A promise that resolves when the sleep is complete. */ export async function sleep(ms = 1000): Promise<void> { return new Promise<void>((resolve) => { setTimeout(resolve, ms); }); }
langchainjs/libs/langchain-community/src/utils/time.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/utils/time.ts", "repo_id": "langchainjs", "token_count": 94 }
1,080
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/program/predefined/evaporate/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/program/predefined/evaporate/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,590
import multiprocessing import numbers import random import numpy import threading import pytest import pandas as pd import decimal from decimal import Decimal, getcontext from time import sleep import heapq from base.client_base import TestcaseBase from utils.util_log import test_log as log from common import common_f...
milvus/tests/python_client/milvus_client/test_milvus_client_index.py/0
{ "file_path": "milvus/tests/python_client/milvus_client/test_milvus_client_index.py", "repo_id": "milvus", "token_count": 14278 }
2,004