text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/hpo_train.md/0
{ "file_path": "transformers/docs/source/ko/hpo_train.md", "repo_id": "transformers", "token_count": 3520 }
526
<jupyter_start><jupyter_text>BoardDocs CrawlLet's figure out how to crawl BoardDocs!We'll try the Redwood City School District site using BeautifulSoup.https://go.boarddocs.com/ca/redwood/Board.nsf/Public<jupyter_code># Each site may contain multiple committees, we have to pick which we want to index # For example, RCS...
llama_index/llama-index-integrations/readers/llama-index-readers-boarddocs/examples/crawl.ipynb/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-boarddocs/examples/crawl.ipynb", "repo_id": "llama_index", "token_count": 2838 }
1,385
# coding=utf-8 # Copyright 2022 Meta 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.0 # #...
transformers/src/transformers/models/esm/tokenization_esm.py/0
{ "file_path": "transformers/src/transformers/models/esm/tokenization_esm.py", "repo_id": "transformers", "token_count": 2598 }
601
import pickle import pytest from tokenizers.models import BPE, Model, WordLevel, WordPiece from ..utils import bert_files, data_dir, roberta_files class TestBPE: def test_instantiate(self, roberta_files): assert isinstance(BPE(), Model) assert isinstance(BPE(), BPE) vocab = {"a": 0, "b...
tokenizers/bindings/python/tests/bindings/test_models.py/0
{ "file_path": "tokenizers/bindings/python/tests/bindings/test_models.py", "repo_id": "tokenizers", "token_count": 2254 }
452
# LlamaIndex Program Integration: Evaporate
llama_index/llama-index-integrations/program/llama-index-program-evaporate/README.md/0
{ "file_path": "llama_index/llama-index-integrations/program/llama-index-program-evaporate/README.md", "repo_id": "llama_index", "token_count": 11 }
1,252
FROM opensearchproject/opensearch-dashboards:2.10.0 RUN /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin remove securityDashboards COPY --chown=opensearch-dashboards:opensearch-dashboards opensearch_dashboards.yml /usr/share/opensearch-dashboards/config/
langchain/libs/community/tests/integration_tests/vectorstores/docker-compose/opensearch/opensearch-dashboards-no-security.Dockerfile/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/docker-compose/opensearch/opensearch-dashboards-no-security.Dockerfile", "repo_id": "langchain", "token_count": 92 }
353
<!--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/openai-gpt.md/0
{ "file_path": "transformers/docs/source/en/model_doc/openai-gpt.md", "repo_id": "transformers", "token_count": 2422 }
482
# langchain-core ## 0.1.7 (Jan 5, 2024) #### Deleted No deletions. #### Deprecated - `BaseChatModel` methods `__call__`, `call_as_llm`, `predict`, `predict_messages`. Will be removed in 0.2.0. Use `BaseChatModel.invoke` instead. - `BaseChatModel` methods `apredict`, `apredict_messages`. Will be removed in 0.2.0. U...
langchain/docs/docs/changelog/core.mdx/0
{ "file_path": "langchain/docs/docs/changelog/core.mdx", "repo_id": "langchain", "token_count": 335 }
87
"""Airtable reader.""" from typing import List from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document from pyairtable import Table class AirtableReader(BaseReader): """Airtable reader. Reads data from a table in a base. Args: api_key (str): Airtable API key...
llama_index/llama-index-integrations/readers/llama-index-readers-airtable/llama_index/readers/airtable/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airtable/llama_index/readers/airtable/base.py", "repo_id": "llama_index", "token_count": 378 }
1,459
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/mobilevitv2/test_modeling_mobilevitv2.py/0
{ "file_path": "transformers/tests/models/mobilevitv2/test_modeling_mobilevitv2.py", "repo_id": "transformers", "token_count": 6229 }
827
# Rockset >[Rockset](https://rockset.com/product/) is a real-time analytics database service for serving low latency, high concurrency analytical queries at scale. It builds a Converged Indexโ„ข on structured and semi-structured data with an efficient store for vector embeddings. Its support for running SQL on schemales...
langchain/docs/docs/integrations/providers/rockset.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/rockset.mdx", "repo_id": "langchain", "token_count": 311 }
144
from langserve.lzstring import LZString def test_lzstring() -> None: s = "ลฝluลฅouฤkรฝ kลฏลˆ รบpฤ›l ฤรกbelskรฉ รณdy!" # generated with original js lib jsLzStringBase64 = ( "r6ABsK6KaAD2aLCADWBfgBPQ9oCAlAZAvgDobEARlB4QAEOAjAUxAGd4BL5AZ4BMBPAQiA==" ) jsLzStringBase64Json = "N4Ig5gNg9gzjCGAnAniAXKALgS...
langserve/tests/unit_tests/test_lzstring.py/0
{ "file_path": "langserve/tests/unit_tests/test_lzstring.py", "repo_id": "langserve", "token_count": 732 }
1,051
// 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/channel_manager.go/0
{ "file_path": "milvus/internal/datanode/channel_manager.go", "repo_id": "milvus", "token_count": 4963 }
1,969
import json import logging from typing import Any, List, Optional, Sequence from sqlalchemy.pool import QueuePool from llama_index.legacy.schema import BaseNode, MetadataMode from llama_index.legacy.vector_stores.types import ( BaseNode, VectorStore, VectorStoreQuery, VectorStoreQueryResult, ) from ll...
llama_index/llama-index-legacy/llama_index/legacy/vector_stores/singlestoredb.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/vector_stores/singlestoredb.py", "repo_id": "llama_index", "token_count": 4467 }
1,612
import { createClient } from "@supabase/supabase-js"; if (!process.env.NEXT_PUBLIC_SUPABASE_URL) { throw new Error("Missing NEXT_PUBLIC_SUPABASE_URL"); } if (!process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY) { throw new Error("Missing NEXT_PUBLIC_SUPABASE_ANON_KEY"); } export const supabase = createClient( process.e...
langchain-template-supabase/src/lib/supabase-client.ts/0
{ "file_path": "langchain-template-supabase/src/lib/supabase-client.ts", "repo_id": "langchain-template-supabase", "token_count": 160 }
65
import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { Tool } from "@langchain/core/tools"; /** * A tool for web search functionality using Bing's search engine. It * extends the base `Tool` class and implements the `_call` method to * perform the search operation. Requires an API key for Bing...
langchainjs/libs/langchain-community/src/tools/bingserpapi.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/bingserpapi.ts", "repo_id": "langchainjs", "token_count": 708 }
1,072
package connection import ( "context" "fmt" "strconv" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/metadata" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus/pkg/util" "github.com/milvus-io/milvus/pkg/util/funcutil" ) func ZapClientInfo(info *commonp...
milvus/internal/proxy/connection/util.go/0
{ "file_path": "milvus/internal/proxy/connection/util.go", "repo_id": "milvus", "token_count": 683 }
2,014
import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, BertEmbeddings, BertLayer, ...
transformers/examples/research_projects/deebert/src/modeling_highway_bert.py/0
{ "file_path": "transformers/examples/research_projects/deebert/src/modeling_highway_bert.py", "repo_id": "transformers", "token_count": 7800 }
534
from rag_conversation.chain import chain __all__ = ["chain"]
langchain/templates/rag-conversation/rag_conversation/__init__.py/0
{ "file_path": "langchain/templates/rag-conversation/rag_conversation/__init__.py", "repo_id": "langchain", "token_count": 20 }
673
import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex logger = logging.getLogger(__name__) class RayRetriever: def __init__(self): self.initialized = False def create_rag_retriever(sel...
transformers/examples/research_projects/rag-end2end-retriever/distributed_ray_retriever.py/0
{ "file_path": "transformers/examples/research_projects/rag-end2end-retriever/distributed_ray_retriever.py", "repo_id": "transformers", "token_count": 3358 }
611
# Tencent >[Tencent Holdings Ltd. (Wikipedia)](https://en.wikipedia.org/wiki/Tencent) (Chinese: ่…พ่ฎฏ; pinyin: Tรฉngxรนn) > is a Chinese multinational technology conglomerate and holding company headquartered > in Shenzhen. `Tencent` is one of the highest grossing multimedia companies in the > world based on revenue. It...
langchain/docs/docs/integrations/providers/tencent.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/tencent.mdx", "repo_id": "langchain", "token_count": 851 }
154
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/optimization/open_vino.md/0
{ "file_path": "diffusers/docs/source/en/optimization/open_vino.md", "repo_id": "diffusers", "token_count": 1109 }
185
"""Serialization for well known objects and callback events. Specialized JSON serialization for well known LangChain objects that can be expected to be frequently transmitted between chains. Callback events handle well known objects together with a few other common types like UUIDs and Exceptions that might appear in...
langserve/langserve/serialization.py/0
{ "file_path": "langserve/langserve/serialization.py", "repo_id": "langserve", "token_count": 2705 }
1,049
from langchain_community.chat_models import ChatOpenAI from langchain_community.embeddings import OpenAIEmbeddings from langchain_community.vectorstores import Chroma from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langchain_core.pydantic_v1 import Ba...
langchain/templates/rag-chroma/rag_chroma/chain.py/0
{ "file_path": "langchain/templates/rag-chroma/rag_chroma/chain.py", "repo_id": "langchain", "token_count": 668 }
677
## 8 Binlog InsertBinlogใ€DeleteBinlogใ€DDLBinlog Binlog is stored in a columnar storage format, every column in schema is stored in an individual file. Timestamp, schema, row id and primary key allocated by system are four special columns. Schema column records the DDL of the collection. ## Event format Binlog file ...
milvus/docs/developer_guides/chap08_binlog.md/0
{ "file_path": "milvus/docs/developer_guides/chap08_binlog.md", "repo_id": "milvus", "token_count": 3554 }
1,646
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPT2LMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpt2.tokenization_gpt2 import GPT2Tokenizer from transformers.testing_utils import require_keras_nlp, require_tf, slo...
transformers/tests/models/gpt2/test_tokenization_gpt2_tf.py/0
{ "file_path": "transformers/tests/models/gpt2/test_tokenization_gpt2_tf.py", "repo_id": "transformers", "token_count": 2520 }
748
import argparse import hashlib import os import mxnet as mx import gluoncv import torch from timm import create_model parser = argparse.ArgumentParser(description='Convert from MXNet') parser.add_argument('--model', default='all', type=str, metavar='MODEL', help='Name of model to train (default: "...
pytorch-image-models/convert/convert_from_mxnet.py/0
{ "file_path": "pytorch-image-models/convert/convert_from_mxnet.py", "repo_id": "pytorch-image-models", "token_count": 1786 }
343
# Metric Card for METEOR ## Metric description METEOR (Metric for Evaluation of Translation with Explicit ORdering) is a machine translation evaluation metric, which is calculated based on the harmonic mean of precision and recall, with recall weighted more than precision. METEOR is based on a generalized concept o...
datasets/metrics/meteor/README.md/0
{ "file_path": "datasets/metrics/meteor/README.md", "repo_id": "datasets", "token_count": 1340 }
131
# Creating a WASM app
candle/candle-book/src/apps/wasm.md/0
{ "file_path": "candle/candle-book/src/apps/wasm.md", "repo_id": "candle", "token_count": 7 }
29
from langchain_community.retrievers.zep import SearchScope, SearchType, ZepRetriever __all__ = ["SearchScope", "SearchType", "ZepRetriever"]
langchain/libs/langchain/langchain/retrievers/zep.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/zep.py", "repo_id": "langchain", "token_count": 46 }
536
python_tests()
llama_index/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,575
console.warn( `[WARNING]: The root "langchain" entrypoint is empty. Please use a specific entrypoint instead.` );
langchainjs/langchain/src/index.ts/0
{ "file_path": "langchainjs/langchain/src/index.ts", "repo_id": "langchainjs", "token_count": 33 }
942
import { getEnvironmentVariable } from "./env.js"; export function logVersion010MigrationWarning({ oldEntrypointName, newEntrypointName, newPackageName = "@langchain/community", }: { oldEntrypointName: string; newEntrypointName?: string; newPackageName?: string; }) { let finalEntrypointName = ""; if (n...
langchainjs/langchain/src/util/entrypoint_deprecation.ts/0
{ "file_path": "langchainjs/langchain/src/util/entrypoint_deprecation.ts", "repo_id": "langchainjs", "token_count": 500 }
977
.heading2Xl { font-size: 2.5rem; line-height: 1.2; font-weight: 800; letter-spacing: -0.05rem; margin: 1rem 0; } .headingXl { font-size: 2rem; line-height: 1.3; font-weight: 800; letter-spacing: -0.05rem; margin: 1rem 0; } .headingLg { font-size: 1.5rem; line-height: 1.4; margin: 1rem 0; } ...
auto-evaluator/nextjs/styles/utils.module.css/0
{ "file_path": "auto-evaluator/nextjs/styles/utils.module.css", "repo_id": "auto-evaluator", "token_count": 298 }
4
"""Test ChatYuan2 wrapper.""" from typing import List import pytest from langchain_core.callbacks import CallbackManager from langchain_core.messages import BaseMessage, HumanMessage, SystemMessage from langchain_core.outputs import ( ChatGeneration, LLMResult, ) from langchain_community.chat_models.yuan2 imp...
langchain/libs/community/tests/integration_tests/chat_models/test_yuan2.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_models/test_yuan2.py", "repo_id": "langchain", "token_count": 1884 }
345
export { BaseCallbackHandler, type CallbackHandlerMethods, type BaseCallbackHandlerInput, type NewTokenIndices, } from "./base.js"; export { type Run, type RunType, BaseTracer } from "./handlers/tracer.js"; export { ConsoleCallbackHandler } from "./handlers/console.js"; export { RunCollectorCallbackHandler }...
langchainjs/langchain/src/callbacks/index.ts/0
{ "file_path": "langchainjs/langchain/src/callbacks/index.ts", "repo_id": "langchainjs", "token_count": 265 }
887
# Generated content DO NOT EDIT class Decoder: """ Base class for all decoders This class is not supposed to be instantiated directly. Instead, any implementation of a Decoder will return an instance of this class when instantiated. """ def decode(self, tokens): """ Decode the ...
tokenizers/bindings/python/py_src/tokenizers/decoders/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/decoders/__init__.pyi", "repo_id": "tokenizers", "token_count": 3115 }
457
[tool.poetry] name = "propositional-retrieval" version = "0.1.0" description = "Dense retrieval using vectorized propositions." authors = [ "William Fu-Hinthorn <will@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "<2" tiktoken = ">=0.5.1" chr...
langchain/templates/propositional-retrieval/pyproject.toml/0
{ "file_path": "langchain/templates/propositional-retrieval/pyproject.toml", "repo_id": "langchain", "token_count": 316 }
664
import re from typing import Union from langchain_core.agents import AgentAction, AgentFinish from langchain_core.exceptions import OutputParserException from langchain.agents.agent import AgentOutputParser class ReActOutputParser(AgentOutputParser): """Output parser for the ReAct agent.""" def parse(self,...
langchain/libs/langchain/langchain/agents/react/output_parser.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/react/output_parser.py", "repo_id": "langchain", "token_count": 485 }
471
"""Test components.""" from typing import Any, List, Sequence import pytest from llama_index.core.base.base_selector import ( BaseSelector, MultiSelection, SelectorResult, SingleSelection, ) from llama_index.core.prompts.mixin import PromptDictType from llama_index.core.query_pipeline.components.argpac...
llama_index/llama-index-core/tests/query_pipeline/test_components.py/0
{ "file_path": "llama_index/llama-index-core/tests/query_pipeline/test_components.py", "repo_id": "llama_index", "token_count": 1899 }
1,274
[package] name = "text-generation-client" version.workspace = true edition.workspace = true authors.workspace = true homepage.workspace = true [dependencies] futures = "^0.3" grpc-metadata = { path = "../grpc-metadata" } prost = "^0.12" thiserror = "^1.0" tokio = { version = "^1.32", features = ["sync"] } tonic = "^0....
text-generation-inference/router/client/Cargo.toml/0
{ "file_path": "text-generation-inference/router/client/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 180 }
392
# TigerGraph This page covers how to use the TigerGraph ecosystem within LangChain. What is TigerGraph? **TigerGraph in a nutshell:** - TigerGraph is a natively distributed and high-performance graph database. - The storage of data in a graph format of vertices and edges leads to rich relationships, ideal for groud...
langchain/docs/docs/integrations/providers/tigergraph.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/tigergraph.mdx", "repo_id": "langchain", "token_count": 319 }
151
import type { Conversation } from "$lib/types/Conversation"; import type { Message } from "$lib/types/Message"; export function buildSubtree( conv: Pick<Conversation, "messages" | "rootMessageId">, id: Message["id"] ): Message[] { if (!conv.rootMessageId) { if (conv.messages.length === 0) return []; // legacy c...
chat-ui/src/lib/utils/tree/buildSubtree.ts/0
{ "file_path": "chat-ui/src/lib/utils/tree/buildSubtree.ts", "repo_id": "chat-ui", "token_count": 329 }
105
export { type ViolationOfExpectationsChainInput, ViolationOfExpectationsChain, } from "./violation_of_expectations_chain.js";
langchainjs/langchain/src/experimental/chains/violation_of_expectations/index.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/chains/violation_of_expectations/index.ts", "repo_id": "langchainjs", "token_count": 43 }
920
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
accelerate/tests/test_utils.py/0
{ "file_path": "accelerate/tests/test_utils.py", "repo_id": "accelerate", "token_count": 5482 }
20
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/readers/file/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/file/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,517
"""Relevancy evaluation.""" from __future__ import annotations import asyncio import re from typing import Any, Callable, Optional, Sequence, Tuple from llama_index.core import ServiceContext from llama_index.core.evaluation.base import BaseEvaluator, EvaluationResult from llama_index.core.llms.llm import LLM from ll...
llama_index/llama-index-core/llama_index/core/evaluation/answer_relevancy.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/evaluation/answer_relevancy.py", "repo_id": "llama_index", "token_count": 2124 }
1,121
import os import tempfile from typing import List, Union import streamlit as st import tiktoken from langchain.text_splitter import ( CharacterTextSplitter, RecursiveCharacterTextSplitter, ) from langchain.text_splitter import ( TextSplitter as LCSplitter, ) from langchain.text_splitter import TokenTextSpl...
llama_index/experimental/splitter_playground/app.py/0
{ "file_path": "llama_index/experimental/splitter_playground/app.py", "repo_id": "llama_index", "token_count": 1900 }
1,114
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/mega/convert_mega_original_pytorch_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/mega/convert_mega_original_pytorch_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 4993 }
691
from llama_index.vector_stores.clickhouse.base import ClickHouseVectorStore __all__ = ["ClickHouseVectorStore"]
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-clickhouse/llama_index/vector_stores/clickhouse/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-clickhouse/llama_index/vector_stores/clickhouse/__init__.py", "repo_id": "llama_index", "token_count": 32 }
1,516
# 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...
transformers/src/transformers/tf_utils.py/0
{ "file_path": "transformers/src/transformers/tf_utils.py", "repo_id": "transformers", "token_count": 3894 }
704
<jupyter_start><jupyter_text>Context-Augmented OpenAI Agent In this tutorial, we show you how to use our `ContextRetrieverOpenAIAgent` implementationto build an agent on top of OpenAI's function API and store/index an arbitrary number of tools. Our indexing/retrieval modules help to remove the complexity of having too ...
llama_index/docs/examples/agent/openai_agent_context_retrieval.ipynb/0
{ "file_path": "llama_index/docs/examples/agent/openai_agent_context_retrieval.ipynb", "repo_id": "llama_index", "token_count": 2201 }
1,088
import { BaseMessage, ChatMessage } from "@langchain/core/messages"; import { ChatResult, ChatGeneration } from "@langchain/core/outputs"; import { BaseChatModel, BaseChatModelParams, } from "@langchain/core/language_models/chat_models"; export interface BittensorInput extends BaseChatModelParams { systemPrompt?...
langchainjs/langchain/src/experimental/chat_models/bittensor.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/chat_models/bittensor.ts", "repo_id": "langchainjs", "token_count": 2247 }
936
from __future__ import annotations import logging import os from typing import Any, Dict, Optional, Union import requests from langchain_core._api import deprecated from langchain_core.messages import get_buffer_string from langchain_core.tracers.base import BaseTracer from langchain_core.tracers.schemas import ( ...
langchain/libs/core/langchain_core/tracers/langchain_v1.py/0
{ "file_path": "langchain/libs/core/langchain_core/tracers/langchain_v1.py", "repo_id": "langchain", "token_count": 3617 }
421
// 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/merr/utils.go/0
{ "file_path": "milvus/pkg/util/merr/utils.go", "repo_id": "milvus", "token_count": 8761 }
1,911
"""Milvus Retriever""" import warnings from typing import Any, Dict, List, Optional from langchain_core.callbacks import CallbackManagerForRetrieverRun from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import root_validator from langchain_cor...
langchain/libs/community/langchain_community/retrievers/milvus.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/milvus.py", "repo_id": "langchain", "token_count": 1047 }
288
# Using Datasets with TensorFlow This document is a quick introduction to using `datasets` with TensorFlow, with a particular focus on how to get `tf.Tensor` objects out of our datasets, and how to stream data from Hugging Face `Dataset` objects to Keras methods like `model.fit()`. ## Dataset format By default, data...
datasets/docs/source/use_with_tensorflow.mdx/0
{ "file_path": "datasets/docs/source/use_with_tensorflow.mdx", "repo_id": "datasets", "token_count": 3671 }
125
<jupyter_start><jupyter_text>CohereAI Embeddings If you're opening this Notebook on colab, you will probably need to install LlamaIndex ๐Ÿฆ™.<jupyter_code>%pip install llama-index-llms-litellm %pip install llama-index-embeddings-cohere !pip install llama-index # Initilise with your api key import os cohere_api_key = "YO...
llama_index/docs/examples/embeddings/cohereai.ipynb/0
{ "file_path": "llama_index/docs/examples/embeddings/cohereai.ipynb", "repo_id": "llama_index", "token_count": 1651 }
1,052
import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence from datasets.features import Array...
datasets/tests/test_arrow_writer.py/0
{ "file_path": "datasets/tests/test_arrow_writer.py", "repo_id": "datasets", "token_count": 6236 }
148
import glob import importlib from pathlib import Path def test_importable_all() -> None: for path in glob.glob("../community/langchain_community/*"): relative_path = Path(path).parts[-1] if relative_path.endswith(".typed"): continue module_name = relative_path.split(".")[0] ...
langchain/libs/community/tests/unit_tests/test_imports.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/test_imports.py", "repo_id": "langchain", "token_count": 213 }
380
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/proxy/task_test.go/0
{ "file_path": "milvus/internal/proxy/task_test.go", "repo_id": "milvus", "token_count": 45101 }
1,969
#!/bin/bash set -e # Exit immediately if a command exits with a non-zero status. instance_name=$1 # Define the etcdctl command with endpoints option etcdctl_cmd="etcdctl endpoint status -w table --endpoints" # Get the ip of all the etcd pods with the specified labels etcd_pods=$(kubectl get pods -l app.kubernetes.io/n...
milvus/tests/scripts/get_etcd_info.sh/0
{ "file_path": "milvus/tests/scripts/get_etcd_info.sh", "repo_id": "milvus", "token_count": 247 }
2,192
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/speech_encoder_decoder/modeling_speech_encoder_decoder.py/0
{ "file_path": "transformers/src/transformers/models/speech_encoder_decoder/modeling_speech_encoder_decoder.py", "repo_id": "transformers", "token_count": 13121 }
694
from langchain_community.llms.gradient_ai import GradientLLM, TrainResult __all__ = ["TrainResult", "GradientLLM"]
langchain/libs/langchain/langchain/llms/gradient_ai.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/gradient_ai.py", "repo_id": "langchain", "token_count": 37 }
561
"""Test base LLM functionality.""" from sqlalchemy import Column, Integer, Sequence, String, create_engine try: from sqlalchemy.orm import declarative_base except ImportError: from sqlalchemy.ext.declarative import declarative_base from langchain_core.outputs import Generation, LLMResult from langchain.cache...
langchain/libs/langchain/tests/unit_tests/llms/test_base.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/llms/test_base.py", "repo_id": "langchain", "token_count": 1117 }
606
FROM ontotext/graphdb:10.5.1 RUN mkdir -p /opt/graphdb/dist/data/repositories/langchain COPY config.ttl /opt/graphdb/dist/data/repositories/langchain/ COPY graphdb_create.sh /run.sh ENTRYPOINT bash /run.sh
langchain/docker/graphdb/Dockerfile/0
{ "file_path": "langchain/docker/graphdb/Dockerfile", "repo_id": "langchain", "token_count": 89 }
83
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/pipelines/test_pipelines_table_question_answering.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_table_question_answering.py", "repo_id": "transformers", "token_count": 14810 }
761
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/src/segcore/FieldIndexing.h/0
{ "file_path": "milvus/internal/core/src/segcore/FieldIndexing.h", "repo_id": "milvus", "token_count": 6030 }
1,666
# TODO: Deprecated import support for old text splitters from llama_index.core.node_parser.text.code import CodeSplitter from llama_index.core.node_parser.text.sentence import ( SentenceSplitter, ) from llama_index.core.node_parser.text.token import TokenTextSplitter __all__ = [ "SentenceSplitter", "TokenT...
llama_index/llama-index-core/llama_index/core/text_splitter/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/text_splitter/__init__.py", "repo_id": "llama_index", "token_count": 123 }
1,151
import type { ObjectId } from "mongodb"; import type { Message } from "./Message"; import type { Timestamps } from "./Timestamps"; import type { User } from "./User"; import type { Assistant } from "./Assistant"; export interface Conversation extends Timestamps { _id: ObjectId; sessionId?: string; userId?: User["_...
chat-ui/src/lib/types/Conversation.ts/0
{ "file_path": "chat-ui/src/lib/types/Conversation.ts", "repo_id": "chat-ui", "token_count": 175 }
105
from __future__ import annotations import asyncio import functools import logging from typing import ( Any, AsyncIterator, Callable, Dict, Iterator, List, Mapping, Optional, Union, cast, ) from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackMan...
langchain/libs/community/langchain_community/chat_models/tongyi.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/tongyi.py", "repo_id": "langchain", "token_count": 6423 }
228
from __future__ import annotations from typing import Any, Dict, Iterator, List from urllib.parse import urlparse from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseModel, PrivateAttr def _chunk(texts: List[str], size: int) -> Iterator[List[str]]: for i in range(0, len(t...
langchain/libs/community/langchain_community/embeddings/mlflow.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/mlflow.py", "repo_id": "langchain", "token_count": 1323 }
271
import type { BaseLanguageModel, BaseLanguageModelInterface, } from "@langchain/core/language_models/base"; import type { ToolInterface } from "@langchain/core/tools"; import { RunnablePassthrough, RunnableSequence, } from "@langchain/core/runnables"; import type { BasePromptTemplate } from "@langchain/core/pro...
langchainjs/langchain/src/agents/xml/index.ts/0
{ "file_path": "langchainjs/langchain/src/agents/xml/index.ts", "repo_id": "langchainjs", "token_count": 2275 }
846
""" AdaHessian Optimizer Lifted from https://github.com/davda54/ada-hessian/blob/master/ada_hessian.py Originally licensed MIT, Copyright 2020, David Samuel """ import torch class Adahessian(torch.optim.Optimizer): """ Implements the AdaHessian algorithm from "ADAHESSIAN: An Adaptive Second OrderOptimizer fo...
pytorch-image-models/timm/optim/adahessian.py/0
{ "file_path": "pytorch-image-models/timm/optim/adahessian.py", "repo_id": "pytorch-image-models", "token_count": 2955 }
385
import logging from typing import Optional import streamlit as st st.set_page_config( page_title="Realtime Evaluation of Production Runs", page_icon="๐Ÿฆœ๏ธ๏ธ๐Ÿ› ๏ธ", ) from chain import MEMORY, get_chain from langchain.callbacks import tracing_v2_enabled from langchain.callbacks.tracers.evaluation import Evaluator...
langsmith-cookbook/feedback-examples/streamlit-realtime-feedback/main.py/0
{ "file_path": "langsmith-cookbook/feedback-examples/streamlit-realtime-feedback/main.py", "repo_id": "langsmith-cookbook", "token_count": 2446 }
1,058
--- hide_table_of_contents: true sidebar_position: 0 --- # OpenAI functions Certain models (like OpenAI's gpt-3.5-turbo and gpt-4) have been fine-tuned to detect when a function should be called and respond with the inputs that should be passed to the function. In an API call, you can describe functions and have the ...
langchainjs/docs/core_docs/docs/modules/agents/agent_types/openai_functions_agent.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/agents/agent_types/openai_functions_agent.mdx", "repo_id": "langchainjs", "token_count": 1380 }
799
// 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/pkg/util/hardware/hardware_info_test.go/0
{ "file_path": "milvus/pkg/util/hardware/hardware_info_test.go", "repo_id": "milvus", "token_count": 584 }
1,968
""" Model / Layer Config singleton state """ import os import warnings from typing import Any, Optional import torch __all__ = [ 'is_exportable', 'is_scriptable', 'is_no_jit', 'use_fused_attn', 'set_exportable', 'set_scriptable', 'set_no_jit', 'set_layer_config', 'set_fused_attn' ] # Set to True if prefer to...
pytorch-image-models/timm/layers/config.py/0
{ "file_path": "pytorch-image-models/timm/layers/config.py", "repo_id": "pytorch-image-models", "token_count": 1787 }
352
from typing import Iterator, List, Optional, Sequence, Tuple from langchain_core.documents import Document from langchain_core.stores import BaseStore class MongoDBStore(BaseStore[str, Document]): """BaseStore implementation using MongoDB as the underlying store. Examples: Create a MongoDBStore inst...
langchain/libs/community/langchain_community/storage/mongodb.py/0
{ "file_path": "langchain/libs/community/langchain_community/storage/mongodb.py", "repo_id": "langchain", "token_count": 1970 }
281
import fnmatch 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, BaseF...
langchain/libs/community/langchain_community/tools/file_management/file_search.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/file_management/file_search.py", "repo_id": "langchain", "token_count": 819 }
297
<jupyter_start><jupyter_text>String Distance[](https://colab.research.google.com/github/langchain-ai/langchain/blob/master/docs/docs/guides/evaluation/string/string_distance.ipynb)>In information theory, linguistics, and computer science, the [Levenshtein distance (Wikipedia)](https://en.wikipedia.org/wiki/Levenshtein_...
langchain/docs/docs/guides/evaluation/string/string_distance.ipynb/0
{ "file_path": "langchain/docs/docs/guides/evaluation/string/string_distance.ipynb", "repo_id": "langchain", "token_count": 713 }
92
import inspect from typing import List, Optional, Union import torch from torch import nn from torch.nn import functional as F from torchvision import transforms from transformers import CLIPImageProcessor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, Diffu...
diffusers/examples/community/clip_guided_stable_diffusion.py/0
{ "file_path": "diffusers/examples/community/clip_guided_stable_diffusion.py", "repo_id": "diffusers", "token_count": 6643 }
196
use ::candle::Tensor; use pyo3::prelude::*; #[derive(Clone, Debug)] /// Represents an absolute shape e.g. (1, 2, 3) pub struct PyShape(Vec<usize>); impl<'source> pyo3::FromPyObject<'source> for PyShape { fn extract(ob: &'source PyAny) -> PyResult<Self> { if ob.is_none() { return Err(PyErr::new...
candle/candle-pyo3/src/shape.rs/0
{ "file_path": "candle/candle-pyo3/src/shape.rs", "repo_id": "candle", "token_count": 1646 }
67
# Evaluate predictions <Tip warning={true}> Metrics is deprecated in ๐Ÿค— Datasets. To learn more about how to use metrics, take a look at the library ๐Ÿค— [Evaluate](https://huggingface.co/docs/evaluate/index)! In addition to metrics, you can find more tools for evaluating models and datasets. </Tip> ๐Ÿค— Datasets provi...
datasets/docs/source/metrics.mdx/0
{ "file_path": "datasets/docs/source/metrics.mdx", "repo_id": "datasets", "token_count": 1193 }
122
export * from "./0_1.js";
langchainjs/libs/langchain-scripts/src/migrations/index.ts/0
{ "file_path": "langchainjs/libs/langchain-scripts/src/migrations/index.ts", "repo_id": "langchainjs", "token_count": 12 }
1,033
"""Wrapper around YandexGPT embedding models.""" from __future__ import annotations import logging import time from typing import Any, Callable, Dict, List from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseModel, SecretStr, root_validator from langchain_core.utils import conv...
langchain/libs/community/langchain_community/embeddings/yandex.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/yandex.py", "repo_id": "langchain", "token_count": 2684 }
256
import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { LLM, type BaseLLMParams } from "@langchain/core/language_models/llms"; const apiUrl = "https://llm.api.cloud.yandex.net/llm/v1alpha/instruct"; /** @deprecated Prefer @langchain/yandex */ export interface YandexGPTInputs extends BaseLLMParams...
langchainjs/libs/langchain-community/src/llms/yandex.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/llms/yandex.ts", "repo_id": "langchainjs", "token_count": 1305 }
960
# README ## Overview Milvus 2.2 has changed the meta structure for segment index. To upgrade a Milvus cluster of 2.1.x version you have installed, run this script to migrate the meta and upgrade the Milvus image version. > Note: > 1. This script only applies to Milvus installed on a K8s cluster which has storagecl...
milvus/deployments/migrate-meta/README.md/0
{ "file_path": "milvus/deployments/migrate-meta/README.md", "repo_id": "milvus", "token_count": 2147 }
1,639
# for backwards compatibility from llama_index.core.base.base_retriever import BaseRetriever __all__ = [ "BaseRetriever", ]
llama_index/llama-index-core/llama_index/core/indices/base_retriever.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/base_retriever.py", "repo_id": "llama_index", "token_count": 45 }
1,213
import { Redis } from "@upstash/redis"; import https from "https"; import { OpenAI } from "@langchain/openai"; import { UpstashRedisCache } from "@langchain/community/caches/upstash_redis"; // const client = new Redis({ // url: process.env.UPSTASH_REDIS_REST_URL!, // token: process.env.UPSTASH_REDIS_REST_TOKEN!, ...
langchainjs/examples/src/cache/upstash_redis_advanced.ts/0
{ "file_path": "langchainjs/examples/src/cache/upstash_redis_advanced.ts", "repo_id": "langchainjs", "token_count": 238 }
796
// 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/indexparams/index_params.go/0
{ "file_path": "milvus/pkg/util/indexparams/index_params.go", "repo_id": "milvus", "token_count": 3818 }
1,833
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 4321, "logprob": -13.90625, "text": "Test" }, { "id": 200...
text-generation-inference/integration-tests/models/__snapshots__/test_grammar_llama/test_flash_llama_grammar.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_grammar_llama/test_flash_llama_grammar.json", "repo_id": "text-generation-inference", "token_count": 1048 }
423
# coding=utf-8 # Copyright 2022 WeChatAI 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.0...
transformers/src/transformers/models/roc_bert/tokenization_roc_bert.py/0
{ "file_path": "transformers/src/transformers/models/roc_bert/tokenization_roc_bert.py", "repo_id": "transformers", "token_count": 23589 }
653
import pytest from chromadb.api.client import AdminClient, Client from chromadb.config import DEFAULT_DATABASE, DEFAULT_TENANT def test_database_tenant_collections(client: Client) -> None: client.reset() # Create a new database in the default tenant admin_client = AdminClient.from_system(client._system) ...
chroma/chromadb/test/client/test_database_tenant.py/0
{ "file_path": "chroma/chromadb/test/client/test_database_tenant.py", "repo_id": "chroma", "token_count": 2270 }
24
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is_torch_available()): ...
diffusers/src/diffusers/pipelines/unidiffuser/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/unidiffuser/__init__.py", "repo_id": "diffusers", "token_count": 733 }
236
import json import os.path import time import pyetcd import requests from pymilvus import connections from kubernetes import client, config from kubernetes.client.rest import ApiException from common.milvus_sys import MilvusSys from utils.util_log import test_log as log from chaos import chaos_commons as cc from common...
milvus/tests/python_client/utils/util_k8s.py/0
{ "file_path": "milvus/tests/python_client/utils/util_k8s.py", "repo_id": "milvus", "token_count": 8058 }
1,912
# coding=utf-8 # Copyright 2019-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 a...
transformers/tests/utils/test_skip_decorators.py/0
{ "file_path": "transformers/tests/utils/test_skip_decorators.py", "repo_id": "transformers", "token_count": 1214 }
866
from typing import List from langchain_core.retrievers import BaseRetriever, Document class SequentialRetriever(BaseRetriever): """Test util that returns a sequence of documents""" sequential_responses: List[List[Document]] response_index: int = 0 def _get_relevant_documents( # type: ignore[overri...
langchain/libs/langchain/tests/unit_tests/retrievers/sequential_retriever.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/retrievers/sequential_retriever.py", "repo_id": "langchain", "token_count": 304 }
608
<jupyter_start><jupyter_text>Token countingLangChain offers a context manager that allows you to count tokens.<jupyter_code>import asyncio from langchain.callbacks import get_openai_callback from langchain_openai import OpenAI llm = OpenAI(temperature=0) with get_openai_callback() as cb: llm("What is the square r...
langchain/docs/docs/modules/callbacks/token_counting.ipynb/0
{ "file_path": "langchain/docs/docs/modules/callbacks/token_counting.ipynb", "repo_id": "langchain", "token_count": 400 }
199
from langchain_community.document_loaders.parsers.audio import OpenAIWhisperParser from langchain_community.document_loaders.parsers.doc_intelligence import ( AzureAIDocumentIntelligenceParser, ) from langchain_community.document_loaders.parsers.docai import DocAIParser from langchain_community.document_loaders.par...
langchain/libs/community/langchain_community/document_loaders/parsers/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/parsers/__init__.py", "repo_id": "langchain", "token_count": 371 }
256