text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 ...
transformers/tests/models/flaubert/test_modeling_tf_flaubert.py/0
{ "file_path": "transformers/tests/models/flaubert/test_modeling_tf_flaubert.py", "repo_id": "transformers", "token_count": 6472 }
746
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/chat_templating.md/0
{ "file_path": "transformers/docs/source/ja/chat_templating.md", "repo_id": "transformers", "token_count": 7023 }
523
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-awadb/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-awadb/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,447
"""Test HuggingFace Pipeline wrapper.""" from pathlib import Path from langchain_community.llms.huggingface_pipeline import HuggingFacePipeline from langchain_community.llms.loading import load_llm from tests.integration_tests.llms.utils import assert_llm_equality def test_huggingface_pipeline_text_generation() -> ...
langchain/libs/community/tests/integration_tests/llms/test_huggingface_pipeline.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_huggingface_pipeline.py", "repo_id": "langchain", "token_count": 1099 }
338
# Chaindesk Retriever This example shows how to use the Chaindesk Retriever in a retrieval chain to retrieve documents from a Chaindesk.ai datastore. ## Usage import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <IntegrationInstallTooltip></IntegrationInstallTooltip> ```bash npm...
langchainjs/docs/core_docs/docs/integrations/retrievers/chaindesk-retriever.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/retrievers/chaindesk-retriever.mdx", "repo_id": "langchainjs", "token_count": 155 }
709
"""Test generic loader.""" import os import tempfile from pathlib import Path from typing import Any, Generator, Iterator import pytest from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseBlobParser from langchain_community.document_loaders.blob_loaders import Blob,...
langchain/libs/community/tests/unit_tests/document_loaders/test_generic_loader.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_generic_loader.py", "repo_id": "langchain", "token_count": 1942 }
378
# coding=utf-8 # Copyright 2024 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...
diffusers/utils/check_dummies.py/0
{ "file_path": "diffusers/utils/check_dummies.py", "repo_id": "diffusers", "token_count": 2591 }
263
# coding=utf-8 # Copyright 2022 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/mobilevit/test_modeling_mobilevit.py/0
{ "file_path": "transformers/tests/models/mobilevit/test_modeling_mobilevit.py", "repo_id": "transformers", "token_count": 6035 }
741
"""Integration test for Polygon API Wrapper.""" from langchain_community.utilities.polygon import PolygonAPIWrapper def test_get_last_quote() -> None: """Test for getting the last quote of a ticker from the Polygon API.""" polygon = PolygonAPIWrapper() output = polygon.run("get_last_quote", "AAPL") as...
langchain/libs/community/tests/integration_tests/utilities/test_polygon.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/utilities/test_polygon.py", "repo_id": "langchain", "token_count": 111 }
367
<jupyter_start><jupyter_text>Polars DataFrameThis notebook goes over how to load data from a [polars](https://pola-rs.github.io/polars-book/user-guide/) DataFrame.<jupyter_code>%pip install --upgrade --quiet polars import polars as pl df = pl.read_csv("example_data/mlb_teams_2012.csv") df.head() from langchain_communi...
langchain/docs/docs/integrations/document_loaders/polars_dataframe.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/polars_dataframe.ipynb", "repo_id": "langchain", "token_count": 586 }
109
import { type BaseLLMCallOptions, type BaseLLMParams, LLM, } from "@langchain/core/language_models/llms"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; /** * The WatsonxAIParams interface defines the input parameters for * the WatsonxAI class. */ export interface WatsonxAIParams extends ...
langchainjs/libs/langchain-community/src/llms/watsonx_ai.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/llms/watsonx_ai.ts", "repo_id": "langchainjs", "token_count": 1962 }
975
[package] name = "candle-wasm-example-llama2" version.workspace = true edition.workspace = true description.workspace = true repository.workspace = true keywords.workspace = true categories.workspace = true license.workspace = true [dependencies] candle = { workspace = true } candle-nn = { workspace = true } candle-tr...
candle/candle-wasm-examples/llama2-c/Cargo.toml/0
{ "file_path": "candle/candle-wasm-examples/llama2-c/Cargo.toml", "repo_id": "candle", "token_count": 434 }
73
import json from typing import List, Sequence, Tuple from langchain_core.agents import AgentAction, AgentActionMessageLog from langchain_core.messages import AIMessage, BaseMessage, FunctionMessage def _convert_agent_action_to_messages( agent_action: AgentAction, observation: str ) -> List[BaseMessage]: """C...
langchain/libs/langchain/langchain/agents/format_scratchpad/openai_functions.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/format_scratchpad/openai_functions.py", "repo_id": "langchain", "token_count": 748 }
473
""" This script modified from https://github.com/huggingface/diffusers/blob/bc691231360a4cbc7d19a58742ebb8ed0f05e027/scripts/convert_original_stable_diffusion_to_diffusers.py Convert original Zero1to3 checkpoint to diffusers checkpoint. # run the convert script $ python convert_zero123_to_diffusers.py \ --checkpoi...
diffusers/scripts/convert_zero123_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_zero123_to_diffusers.py", "repo_id": "diffusers", "token_count": 15249 }
230
import itertools import os import re from string import Template from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple from tokenizers import Encoding, Tokenizer dirname = os.path.dirname(__file__) css_filename = os.path.join(dirname, "visualizer-styles.css") with open(css_filename) as f: css...
tokenizers/bindings/python/py_src/tokenizers/tools/visualizer.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/tools/visualizer.py", "repo_id": "tokenizers", "token_count": 6750 }
437
import json import logging from typing import Optional, Type from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import BaseModel, Field from langchain_community.tools.slack.base import SlackBaseTool class SlackGetMessageSchema(BaseModel): """Input schema for SlackGetM...
langchain/libs/community/langchain_community/tools/slack/get_message.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/slack/get_message.py", "repo_id": "langchain", "token_count": 555 }
293
Vector Store Retrievers ======================= .. automodule:: llama_index.core.indices.vector_store.retrievers.retriever :members: :inherited-members: .. automodule:: llama_index.core.indices.vector_store.retrievers.auto_retriever.auto_retriever :members: :inherited-members: .. automodule:: llama_index...
llama_index/docs/api_reference/query/retrievers/vector_store.rst/0
{ "file_path": "llama_index/docs/api_reference/query/retrievers/vector_store.rst", "repo_id": "llama_index", "token_count": 172 }
1,116
import "react-toastify/dist/ReactToastify.css"; import { emojisplosion } from "emojisplosion"; export type Source = { url: string; title: string; images: string[]; defaultSourceUrl?: string; }; export function SourceBubble(props: { source: Source; highlighted: boolean; index: number; onMouseEnter: () ...
weblangchain/nextjs/app/components/SourceBubble.tsx/0
{ "file_path": "weblangchain/nextjs/app/components/SourceBubble.tsx", "repo_id": "weblangchain", "token_count": 460 }
1,920
import { JSDOM, VirtualConsole } from "jsdom"; export async function parseWeb(url: string) { const abortController = new AbortController(); setTimeout(() => abortController.abort(), 10000); const htmlString = await fetch(url, { signal: abortController.signal }) .then((response) => response.text()) .catch(); c...
chat-ui/src/lib/server/websearch/parseWeb.ts/0
{ "file_path": "chat-ui/src/lib/server/websearch/parseWeb.ts", "repo_id": "chat-ui", "token_count": 320 }
98
// import all entrypoints to test, do not do this in your own app import "../entrypoints.js"; import Head from "next/head"; import styles from "@/styles/Home.module.css"; import { useCallback } from "react"; import { ChatOpenAI } from "langchain/chat_models/openai"; import { CallbackManager } from "langchain/callbacks...
langchainjs/environment_tests/test-exports-vercel/src/pages/index.tsx/0
{ "file_path": "langchainjs/environment_tests/test-exports-vercel/src/pages/index.tsx", "repo_id": "langchainjs", "token_count": 654 }
774
from __future__ import annotations import importlib from typing import ( Any, AsyncIterator, Dict, Iterable, List, Mapping, Sequence, Union, overload, ) from langchain_core.chat_sessions import ChatSession from langchain_core.messages import ( AIMessage, AIMessageChunk, ...
langchain/libs/community/langchain_community/adapters/openai.py/0
{ "file_path": "langchain/libs/community/langchain_community/adapters/openai.py", "repo_id": "langchain", "token_count": 5371 }
209
package model import ( "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus/internal/proto/etcdpb" ) var ( dbPB = &etcdpb.DatabaseInfo{ TenantId: "1", Name: "test", Id: 1, CreatedTime: 1, State: etcdpb.DatabaseState_DatabaseCreated, } dbModel = &Datab...
milvus/internal/metastore/model/database_test.go/0
{ "file_path": "milvus/internal/metastore/model/database_test.go", "repo_id": "milvus", "token_count": 446 }
1,944
# Model Based Reinforcement Learning (MBRL) Model-based reinforcement learning only differs from its model-free counterpart in learning a *dynamics model*, but that has substantial downstream effects on how the decisions are made. The dynamics model usually models the environment transition dynamics, \\( s_{t+1} = f_...
deep-rl-class/units/en/unitbonus3/model-based.mdx/0
{ "file_path": "deep-rl-class/units/en/unitbonus3/model-based.mdx", "repo_id": "deep-rl-class", "token_count": 641 }
174
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-graphql/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-graphql/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,505
<script lang="ts"> export let name: string; export let description: string = ""; export let createdByName: string | undefined; export let avatar: string | undefined; import logo from "../../../../../static/huggingchat/logo.svg?raw"; </script> <div class="flex h-full w-full flex-col items-center justify-center bg...
chat-ui/src/routes/assistant/[assistantId]/thumbnail.png/ChatThumbnail.svelte/0
{ "file_path": "chat-ui/src/routes/assistant/[assistantId]/thumbnail.png/ChatThumbnail.svelte", "repo_id": "chat-ui", "token_count": 545 }
109
import type { extname as ExtnameT, resolve as ResolveT } from "node:path"; import type { readdir as ReaddirT } from "node:fs/promises"; import { Document } from "@langchain/core/documents"; import { getEnv } from "@langchain/core/utils/env"; import { BaseDocumentLoader } from "../base.js"; // TypeScript enums are not ...
langchainjs/langchain/src/document_loaders/fs/directory.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/fs/directory.ts", "repo_id": "langchainjs", "token_count": 1784 }
874
import type { BaseLLMParams } from "@langchain/core/language_models/llms"; export interface GoogleConnectionParams<AuthOptions> { authOptions?: AuthOptions; } export interface GoogleVertexAIConnectionParams<AuthOptions> extends GoogleConnectionParams<AuthOptions> { /** Hostname for the API call */ endpoint?: ...
langchainjs/libs/langchain-community/src/types/googlevertexai-types.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/types/googlevertexai-types.ts", "repo_id": "langchainjs", "token_count": 758 }
1,019
FROM python:3.11 RUN pip install langchain
langchain/docker/Dockerfile.base/0
{ "file_path": "langchain/docker/Dockerfile.base", "repo_id": "langchain", "token_count": 16 }
83
<jupyter_start><jupyter_text>LLM Reranker Demonstration (2021 Lyft 10-k)This tutorial showcases how to do a two-stage pass for retrieval. Use embedding-based retrieval with a high top-k valuein order to maximize recall and get a large set of candidate items. Then, use LLM-based retrievalto dynamically select the nodes ...
llama_index/docs/examples/node_postprocessor/LLMReranker-Lyft-10k.ipynb/0
{ "file_path": "llama_index/docs/examples/node_postprocessor/LLMReranker-Lyft-10k.ipynb", "repo_id": "llama_index", "token_count": 1583 }
1,152
"""Load Documents from Docusarus Documentation""" from typing import Any, List, Optional from langchain_community.document_loaders.sitemap import SitemapLoader class DocusaurusLoader(SitemapLoader): """Load from Docusaurus Documentation. It leverages the SitemapLoader to loop through the generated pages of ...
langchain/libs/community/langchain_community/document_loaders/docusaurus.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/docusaurus.py", "repo_id": "langchain", "token_count": 713 }
248
<jupyter_start><jupyter_text>SceneXplain[SceneXplain](https://scenex.jina.ai/) is an ImageCaptioning service accessible through the SceneXplain Tool.To use this tool, you'll need to make an account and fetch your API Token [from the website](https://scenex.jina.ai/api). Then you can instantiate the tool.<jupyter_code>i...
langchain/docs/docs/integrations/tools/sceneXplain.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/sceneXplain.ipynb", "repo_id": "langchain", "token_count": 741 }
186
//go:build !linux // +build !linux package accesslog import ( "os" ) func chown(_ string, _ os.FileInfo) error { return nil }
milvus/internal/proxy/accesslog/chown.go/0
{ "file_path": "milvus/internal/proxy/accesslog/chown.go", "repo_id": "milvus", "token_count": 51 }
1,738
#!/bin/bash # 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...
milvus/build/build_image_gpu.sh/0
{ "file_path": "milvus/build/build_image_gpu.sh", "repo_id": "milvus", "token_count": 784 }
1,691
<jupyter_start><jupyter_code>import os import torch from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, default_data_collator, get_linear_schedule_with_warmup from peft import get_peft_model, PromptTuningConfig, TaskType, PromptTuningInit from torch.utils.data import DataLoader from tqdm import tqdm from da...
peft/examples/conditional_generation/peft_prompt_tuning_seq2seq.ipynb/0
{ "file_path": "peft/examples/conditional_generation/peft_prompt_tuning_seq2seq.ipynb", "repo_id": "peft", "token_count": 2336 }
326
from typing import Optional, Tuple from llama_index.core.llms.generic_utils import get_from_param_or_env DEFAULT_ANYSCALE_API_BASE = "https://api.endpoints.anyscale.com/v1" DEFAULT_ANYSCALE_API_VERSION = "" def resolve_anyscale_credentials( api_key: Optional[str] = None, api_base: Optional[str] = None, ...
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-anyscale/llama_index/embeddings/anyscale/utils.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-anyscale/llama_index/embeddings/anyscale/utils.py", "repo_id": "llama_index", "token_count": 446 }
1,301
<jupyter_start><jupyter_text>Diffbot Graph Transformer[](https://colab.research.google.com/github/langchain-ai/langchain/blob/master/docs/docs/use_cases/graph/diffbot_graphtransformer.ipynb) Use caseText data often contain rich relationships and insights that can be useful for various analytics, recommendation engines,...
langchain/docs/docs/use_cases/graph/diffbot_graphtransformer.ipynb/0
{ "file_path": "langchain/docs/docs/use_cases/graph/diffbot_graphtransformer.ipynb", "repo_id": "langchain", "token_count": 1555 }
210
"""JinaChat wrapper.""" from __future__ import annotations import logging from typing import ( Any, AsyncIterator, Callable, Dict, Iterator, List, Mapping, Optional, Tuple, Type, Union, ) from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, Callback...
langchain/libs/community/langchain_community/chat_models/jinachat.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/jinachat.py", "repo_id": "langchain", "token_count": 6491 }
225
# coding=utf-8 # Copyright 2018 Microsoft Authors and the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
transformers/tests/models/deberta/test_modeling_deberta.py/0
{ "file_path": "transformers/tests/models/deberta/test_modeling_deberta.py", "repo_id": "transformers", "token_count": 5314 }
811
import tempfile from enum import Enum from typing import Any, Dict, Optional, Union from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import root_validator from langchain_core.tools import BaseTool from langchain_core.utils import get_from_dict_or_env def _import_elevenla...
langchain/libs/community/langchain_community/tools/eleven_labs/text2speech.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/eleven_labs/text2speech.py", "repo_id": "langchain", "token_count": 1091 }
285
"""Integration test for Arxiv API Wrapper.""" from typing import List import pytest from langchain_core.documents import Document from langchain_community.retrievers import ArxivRetriever @pytest.fixture def retriever() -> ArxivRetriever: return ArxivRetriever() def assert_docs(docs: List[Document], all_meta:...
langchain/libs/community/tests/integration_tests/retrievers/test_arxiv.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/retrievers/test_arxiv.py", "repo_id": "langchain", "token_count": 606 }
362
import { protos } from "@google-ai/generativelanguage"; import { expect, test } from "@jest/globals"; import { AIMessage, BaseMessage, HumanMessage, SystemMessage, } from "@langchain/core/messages"; import { ChatGooglePaLM } from "../googlepalm.js"; // Test class extending actual class to test private & protec...
langchainjs/libs/langchain-community/src/chat_models/tests/chatgooglepalm.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/chat_models/tests/chatgooglepalm.test.ts", "repo_id": "langchainjs", "token_count": 2765 }
1,052
from langchain_community.graphs.rdf_graph import ( RdfGraph, ) __all__ = [ "RdfGraph", ]
langchain/libs/langchain/langchain/graphs/rdf_graph.py/0
{ "file_path": "langchain/libs/langchain/langchain/graphs/rdf_graph.py", "repo_id": "langchain", "token_count": 44 }
541
# Required Environment Variables: OPENAI_API_KEY from llama_index.core.llama_dataset import download_llama_dataset from llama_index.core.llama_pack import download_llama_pack from llama_index.core import VectorStoreIndex # download a LabelledRagDataset from llama-hub rag_dataset, documents = download_llama_dataset( ...
llama_index/llama-index-packs/llama-index-packs-rag-evaluator/examples/example.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-rag-evaluator/examples/example.py", "repo_id": "llama_index", "token_count": 331 }
1,808
# Utilities ## Configure logging 🤗 Datasets strives to be transparent and explicit about how it works, but this can be quite verbose at times. We have included a series of logging methods which allow you to easily adjust the level of verbosity of the entire library. Currently the default verbosity of the library is ...
datasets/docs/source/package_reference/utilities.mdx/0
{ "file_path": "datasets/docs/source/package_reference/utilities.mdx", "repo_id": "datasets", "token_count": 725 }
114
from langchain_community.tools.office365.events_search import ( O365SearchEvents, SearchEventsInput, ) __all__ = ["SearchEventsInput", "O365SearchEvents"]
langchain/libs/langchain/langchain/tools/office365/events_search.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/office365/events_search.py", "repo_id": "langchain", "token_count": 53 }
562
#!/usr/bin/env python # 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 # # Unles...
accelerate/src/accelerate/commands/config/default.py/0
{ "file_path": "accelerate/src/accelerate/commands/config/default.py", "repo_id": "accelerate", "token_count": 1955 }
10
<jupyter_start><jupyter_code>!pip install -qU nougat-ocr llama-index from google.colab import files upload = files.upload() from google.colab import files upload = files.upload() from base import PDFNougatOCR from pathlib import Path reader = PDFNougatOCR() pdf_path = Path("mathpaper.pdf") docs = reader.load_data(pdf...
llama_index/llama-index-integrations/readers/llama-index-readers-nougat-ocr/examples/NougatOCR.ipynb/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-nougat-ocr/examples/NougatOCR.ipynb", "repo_id": "llama_index", "token_count": 131 }
1,415
from __future__ import annotations from enum import Enum from typing import List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document import assemblyai class TranscriptFormat(Enum): """Transcript format to use for the document reader.""" TEXT = "text"...
llama_index/llama-index-integrations/readers/llama-index-readers-assemblyai/llama_index/readers/assemblyai/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-assemblyai/llama_index/readers/assemblyai/base.py", "repo_id": "llama_index", "token_count": 1433 }
1,263
import WebSocket from "ws"; import { BaseChatIflytekXinghuo } from "./common.js"; import { BaseWebSocketStream, WebSocketStreamOptions, } from "../../utils/iflytek_websocket_stream.js"; class WebSocketStream extends BaseWebSocketStream { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-igno...
langchainjs/libs/langchain-community/src/chat_models/iflytek_xinghuo/index.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/chat_models/iflytek_xinghuo/index.ts", "repo_id": "langchainjs", "token_count": 594 }
982
from langchain.schema.memory import __all__ EXPECTED_ALL = ["BaseMemory"] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
langchain/libs/langchain/tests/unit_tests/schema/test_memory.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/schema/test_memory.py", "repo_id": "langchain", "token_count": 58 }
652
import { RetrievalQAChain, loadQAStuffChain } from "langchain/chains"; import { CheerioWebBaseLoader } from "langchain/document_loaders/web/cheerio"; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { Ollama } from "@la...
langchainjs/examples/src/use_cases/local_retrieval_qa/qa_chain.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/local_retrieval_qa/qa_chain.ts", "repo_id": "langchainjs", "token_count": 1281 }
867
# 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/memory.py/0
{ "file_path": "accelerate/src/accelerate/utils/memory.py", "repo_id": "accelerate", "token_count": 2036 }
15
"""Test caching for LLMs and ChatModels.""" import sqlite3 from typing import Dict, Generator, List, Union import pytest from _pytest.fixtures import FixtureRequest from langchain_community.chat_models import FakeListChatModel from langchain_community.llms import FakeListLLM from langchain_core.language_models.chat_mo...
langchain/libs/langchain/tests/unit_tests/test_cache.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/test_cache.py", "repo_id": "langchain", "token_count": 3128 }
619
package common import ( "reflect" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" ) type KeyValuePairs []*commonpb.KeyValuePair func (pairs KeyValuePairs) Clone() KeyValuePairs { clone := make(KeyValuePairs, 0, len(pairs)) for _, pair := range pairs { clone = append(clone, &commonpb.KeyValuePair{ Ke...
milvus/pkg/common/key_value_pairs.go/0
{ "file_path": "milvus/pkg/common/key_value_pairs.go", "repo_id": "milvus", "token_count": 303 }
1,806
"""Integration test for POWERBI API Wrapper.""" import pytest from langchain_core.utils import get_from_env from langchain_community.utilities.powerbi import PowerBIDataset def azure_installed() -> bool: try: from azure.core.credentials import TokenCredential # noqa: F401 from azure.identity im...
langchain/libs/community/tests/integration_tests/utilities/test_powerbi_api.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/utilities/test_powerbi_api.py", "repo_id": "langchain", "token_count": 467 }
349
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base"; import { BaseLLMOutputParser } from "@langchain/core/output_parsers"; import { ChainValues } from "@langchain/core/utils/types"; import { ChatGeneration, Generation, RUN_KEY } from "@langchain/core/outputs"; import { BasePromptTempl...
langchainjs/langchain/src/evaluation/criteria/criteria.ts/0
{ "file_path": "langchainjs/langchain/src/evaluation/criteria/criteria.ts", "repo_id": "langchainjs", "token_count": 3202 }
982
# 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/src/transformers/models/xglm/__init__.py/0
{ "file_path": "transformers/src/transformers/models/xglm/__init__.py", "repo_id": "transformers", "token_count": 1587 }
701
"""For backwards compatibility.""" from langchain_community.utilities.python import PythonREPL __all__ = ["PythonREPL"]
langchain/libs/langchain/langchain/python.py/0
{ "file_path": "langchain/libs/langchain/langchain/python.py", "repo_id": "langchain", "token_count": 33 }
528
python_sources()
llama_index/llama-index-core/llama_index/core/graph_stores/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/graph_stores/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,119
// 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.go/0
{ "file_path": "milvus/internal/datacoord/policy.go", "repo_id": "milvus", "token_count": 4532 }
1,965
import ctypes def is_libcublas_available() -> bool: try: ctypes.CDLL("libcublas.so") return True except OSError: return False
langchain/libs/experimental/tests/unit_tests/__init__.py/0
{ "file_path": "langchain/libs/experimental/tests/unit_tests/__init__.py", "repo_id": "langchain", "token_count": 76 }
430
from typing import List import numpy as np from chromadb.api import ServerAPI from chromadb.api.models.Collection import Collection def test_many_collections(api: ServerAPI) -> None: """Test that we can create a large number of collections and that the system # remains responsive.""" api.reset() N =...
chroma/chromadb/test/stress/test_many_collections.py/0
{ "file_path": "chroma/chromadb/test/stress/test_many_collections.py", "repo_id": "chroma", "token_count": 417 }
26
from langchain_community.document_loaders.url_playwright import ( PlaywrightEvaluator, PlaywrightURLLoader, UnstructuredHtmlEvaluator, ) __all__ = ["PlaywrightEvaluator", "UnstructuredHtmlEvaluator", "PlaywrightURLLoader"]
langchain/libs/langchain/langchain/document_loaders/url_playwright.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/url_playwright.py", "repo_id": "langchain", "token_count": 89 }
540
python_sources()
llama_index/llama-index-core/llama_index/core/command_line/new_package/templates/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/command_line/new_package/templates/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,167
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/param_tuner/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/param_tuner/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,531
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "storage/ioredis", }); export * from "@langchain/community/storage/ioredis";
langchainjs/langchain/src/storage/ioredis.ts/0
{ "file_path": "langchainjs/langchain/src/storage/ioredis.ts", "repo_id": "langchainjs", "token_count": 72 }
967
#!/usr/bin/env bash export PYTHONPATH="../":"${PYTHONPATH}" export WANDB_PROJECT=dmar # export MAX_LEN=128 python distillation.py \ --learning_rate=3e-4 \ --do_train \ --fp16 \ --val_check_interval 0.25 \ --teacher Helsinki-NLP/opus-mt-en-ro \ --max_source_length $MAX_LEN --max_target_length $MAX_LEN --val_...
transformers/examples/research_projects/seq2seq-distillation/distil_marian_enro_teacher.sh/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/distil_marian_enro_teacher.sh", "repo_id": "transformers", "token_count": 310 }
575
const { Application, Converter, Context, ReflectionKind, DeclarationReflection, RendererEvent, } = require("typedoc"); const fs = require("fs"); const path = require("path"); const PATH_TO_LANGCHAIN_PKG_JSON = "../../langchain/package.json"; const BASE_OUTPUT_DIR = "./public"; const SCRIPT_HTML = `<script>...
langchainjs/docs/api_refs/typedoc_plugins/hide_underscore_lc.js/0
{ "file_path": "langchainjs/docs/api_refs/typedoc_plugins/hide_underscore_lc.js", "repo_id": "langchainjs", "token_count": 1926 }
689
<jupyter_start><jupyter_text>Hackathon DreamBooth 🏆 Bienvenue au Hackathon DreamBooth ! Dans cette compétition, vous allez **personnaliser un modèle de Stable Diffusion en le *finetunant* sur une poignée de vos propres images**. Pour cela, nous allons utiliser une technique appelée [_DreamBooth_](https://arxiv.org/abs...
diffusion-models-class/units/fr/events/dreambooth.ipynb/0
{ "file_path": "diffusion-models-class/units/fr/events/dreambooth.ipynb", "repo_id": "diffusion-models-class", "token_count": 11430 }
296
use super::{Metadata, MetadataValueConversionError, SegmentScope, SegmentScopeConversionError}; use crate::{ chroma_proto, errors::{ChromaError, ErrorCodes}, }; use thiserror::Error; use uuid::Uuid; #[derive(Debug, PartialEq)] pub(crate) enum SegmentType { HnswDistributed, } #[derive(Debug, PartialEq)] pu...
chroma/rust/worker/src/types/segment.rs/0
{ "file_path": "chroma/rust/worker/src/types/segment.rs", "repo_id": "chroma", "token_count": 2111 }
64
[build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" [tool.llamahub] classes = ["MultionToolSpec"] contains_example = false import_path = "llama_index.tools.multion" [to...
llama_index/llama-index-integrations/tools/llama-index-tools-multion/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-multion/pyproject.toml", "repo_id": "llama_index", "token_count": 680 }
1,486
# Generated content DO NOT EDIT class Model: """ Base class for all models The model represents the actual tokenization algorithm. This is the part that will contain and manage the learned vocabulary. This class cannot be constructed directly. Please use one of the concrete models. """ de...
tokenizers/bindings/python/py_src/tokenizers/models/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/models/__init__.pyi", "repo_id": "tokenizers", "token_count": 7567 }
447
<jupyter_start><jupyter_text>MistralAI If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-llms-mistralai !pip install llama-index<jupyter_output><empty_output><jupyter_text>Call `complete` with a prompt<jupyter_code>from llama_index.llms.mist...
llama_index/docs/examples/llm/mistralai.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/mistralai.ipynb", "repo_id": "llama_index", "token_count": 2590 }
1,114
from typing import Optional, Type, TypeVar from llama_index.core.bridge.pydantic import BaseModel from llama_index.core.output_parsers.base import OutputParserException from llama_index.core.output_parsers.utils import parse_json_markdown def convert_to_handlebars(text: str) -> str: """Convert a python format st...
llama_index/llama-index-core/llama_index/core/prompts/guidance_utils.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/prompts/guidance_utils.py", "repo_id": "llama_index", "token_count": 2240 }
1,207
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # 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....
datasets/metrics/code_eval/execute.py/0
{ "file_path": "datasets/metrics/code_eval/execute.py", "repo_id": "datasets", "token_count": 2368 }
127
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
transformers/tests/models/vitmatte/test_image_processing_vitmatte.py/0
{ "file_path": "transformers/tests/models/vitmatte/test_image_processing_vitmatte.py", "repo_id": "transformers", "token_count": 3229 }
744
<!--- Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/docs/source/it/pr_checks.md/0
{ "file_path": "transformers/docs/source/it/pr_checks.md", "repo_id": "transformers", "token_count": 2370 }
509
<!--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/using-diffusers/inference_with_lcm_lora.md/0
{ "file_path": "diffusers/docs/source/en/using-diffusers/inference_with_lcm_lora.md", "repo_id": "diffusers", "token_count": 5693 }
183
from langchain_community.vectorstores.rocksetdb import Rockset __all__ = ["Rockset"]
langchain/libs/langchain/langchain/vectorstores/rocksetdb.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/rocksetdb.py", "repo_id": "langchain", "token_count": 28 }
608
# coding=utf-8 # Copyright 2022 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/esm/test_modeling_tf_esm.py/0
{ "file_path": "transformers/tests/models/esm/test_modeling_tf_esm.py", "repo_id": "transformers", "token_count": 5430 }
759
import { test } from "@jest/globals"; test("Test LLM", async () => { // Your test here });
langchainjs/libs/create-langchain-integration/template/src/tests/llms.test.ts/0
{ "file_path": "langchainjs/libs/create-langchain-integration/template/src/tests/llms.test.ts", "repo_id": "langchainjs", "token_count": 34 }
986
"""Test PAL chain.""" from langchain_community.llms import OpenAI from langchain_experimental.pal_chain.base import PALChain def test_math_prompt() -> None: """Test math prompt.""" llm = OpenAI(temperature=0, max_tokens=512) pal_chain = PALChain.from_math_prompt(llm, timeout=None) question = ( ...
langchain/libs/experimental/tests/integration_tests/chains/test_pal.py/0
{ "file_path": "langchain/libs/experimental/tests/integration_tests/chains/test_pal.py", "repo_id": "langchain", "token_count": 403 }
440
"""PyTorch ResNet This started as a copy of https://github.com/pytorch/vision 'resnet.py' (BSD-3-Clause) with additional dropout and dynamic global avg/max pool. ResNeXt, SE-ResNeXt, SENet, and MXNet Gluon stem/downsample variants, tiered stems added by Ross Wightman Copyright 2019, Ross Wightman """ import math fro...
pytorch-image-models/timm/models/resnet.py/0
{ "file_path": "pytorch-image-models/timm/models/resnet.py", "repo_id": "pytorch-image-models", "token_count": 44237 }
406
label: 'How-to' position: 0
langchainjs/docs/core_docs/docs/modules/callbacks/how_to/_category_.yml/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/callbacks/how_to/_category_.yml", "repo_id": "langchainjs", "token_count": 12 }
750
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/pkg/util/cache/stats.go/0
{ "file_path": "milvus/pkg/util/cache/stats.go", "repo_id": "milvus", "token_count": 1396 }
2,047
// 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/storage/payload.go/0
{ "file_path": "milvus/internal/storage/payload.go", "repo_id": "milvus", "token_count": 953 }
1,872
// 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/kv/etcd/embed_etcd_restart_test.go/0
{ "file_path": "milvus/internal/kv/etcd/embed_etcd_restart_test.go", "repo_id": "milvus", "token_count": 1057 }
1,721
name = "test-exports-cf" main = "src/index.ts" compatibility_date = "2024-01-10"
langchainjs/environment_tests/test-exports-cf/wrangler.toml/0
{ "file_path": "langchainjs/environment_tests/test-exports-cf/wrangler.toml", "repo_id": "langchainjs", "token_count": 35 }
748
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-genius/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-genius/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,302
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/llama_index/vector_stores/azureaisearch/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/llama_index/vector_stores/azureaisearch/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,471
from typing import Any, Optional, Sequence, Union from llama_index.legacy.bridge.pydantic import Field from llama_index.legacy.constants import DEFAULT_CONTEXT_WINDOW from llama_index.legacy.llms.generic_utils import ( async_stream_completion_response_to_chat_response, completion_response_to_chat_response, ...
llama_index/llama-index-legacy/llama_index/legacy/llms/openai_like.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/openai_like.py", "repo_id": "llama_index", "token_count": 2468 }
1,617
/// <reference types="vite/client" /> /// <reference types="vite-plugin-svgr/client" />
langserve/langserve/playground/src/vite-env.d.ts/0
{ "file_path": "langserve/langserve/playground/src/vite-env.d.ts", "repo_id": "langserve", "token_count": 28 }
1,048
from typing import Any, Dict, List, Optional import neo4j from llama_index.core.schema import BaseNode, MetadataMode from llama_index.core.vector_stores.types import ( VectorStore, VectorStoreQuery, VectorStoreQueryResult, ) from llama_index.core.vector_stores.utils import ( metadata_dict_to_node, ...
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-neo4jvector/llama_index/vector_stores/neo4jvector/base.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-neo4jvector/llama_index/vector_stores/neo4jvector/base.py", "repo_id": "llama_index", "token_count": 6477 }
1,611
import { LLM, type BaseLLMParams } from "@langchain/core/language_models/llms"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; /** * Type definition for AI21 penalty data. */ export type AI21PenaltyData = { scale: number; applyToWhitespaces: boolean; applyToPunctuations: boolean; applyTo...
langchainjs/libs/langchain-community/src/llms/ai21.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/llms/ai21.ts", "repo_id": "langchainjs", "token_count": 2039 }
944
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base"; import { BaseMessage, SystemMessage, getBufferString, } from "@langchain/core/messages"; import { BaseChatMemory, BaseChatMemoryInput, } from "@langchain/community/memory/chat_memory"; import { BasePromptTemplate } from "@...
langchainjs/langchain/src/memory/summary.ts/0
{ "file_path": "langchainjs/langchain/src/memory/summary.ts", "repo_id": "langchainjs", "token_count": 1683 }
971
import { GoogleVertexAIEmbeddings } from "@langchain/community/embeddings/googlevertexai"; export const run = async () => { const model = new GoogleVertexAIEmbeddings(); const res = await model.embedQuery( "What would be a good company name for a company that makes colorful socks?" ); console.log({ res });...
langchainjs/examples/src/models/embeddings/googlevertexai.ts/0
{ "file_path": "langchainjs/examples/src/models/embeddings/googlevertexai.ts", "repo_id": "langchainjs", "token_count": 97 }
900
#!/bin/bash # 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...
milvus/scripts/setenv.sh/0
{ "file_path": "milvus/scripts/setenv.sh", "repo_id": "milvus", "token_count": 1217 }
1,848
from typing import Optional from llama_index.legacy.storage.index_store.keyval_index_store import KVIndexStore from llama_index.legacy.storage.kvstore.firestore_kvstore import FirestoreKVStore class FirestoreIndexStore(KVIndexStore): """Firestore Index store. Args: firestore_kvstore (FirestoreKVStor...
llama_index/llama-index-legacy/llama_index/legacy/storage/index_store/firestore_indexstore.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/storage/index_store/firestore_indexstore.py", "repo_id": "llama_index", "token_count": 479 }
1,604
# Distillation for quantization on Textual Inversion models to personalize text2image [Textual inversion](https://arxiv.org/abs/2208.01618) is a method to personalize text2image models like stable diffusion on your own images._By using just 3-5 images new concepts can be taught to Stable Diffusion and the model person...
diffusers/examples/research_projects/intel_opts/textual_inversion_dfq/README.md/0
{ "file_path": "diffusers/examples/research_projects/intel_opts/textual_inversion_dfq/README.md", "repo_id": "diffusers", "token_count": 1443 }
212
# Hands on <CourseFloatingBanner classNames="absolute z-10 right-0 top-0" notebooks={[ {label: "Google Colab", value: "https://colab.research.google.com/github/huggingface/deep-rl-class/blob/main/notebooks/unit4/unit4.ipynb"} ]} askForHelpUrl="http://hf.co/join/discord" /> Now ...
deep-rl-class/units/en/unit4/hands-on.mdx/0
{ "file_path": "deep-rl-class/units/en/unit4/hands-on.mdx", "repo_id": "deep-rl-class", "token_count": 13495 }
167