text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from langchain_community.tools.ifttt import IFTTTWebhook __all__ = ["IFTTTWebhook"]
langchain/libs/langchain/langchain/tools/ifttt.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/ifttt.py", "repo_id": "langchain", "token_count": 31 }
559
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querynodev2/segments/segment_loader.go/0
{ "file_path": "milvus/internal/querynodev2/segments/segment_loader.go", "repo_id": "milvus", "token_count": 18142 }
1,856
from langchain_community.chat_models import ChatOpenAI from langchain_core.load import load from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langchain_core.pydantic_v1 import BaseModel from langchain_core.runnables import RunnablePassthrough from prop...
langchain/templates/propositional-retrieval/propositional_retrieval/chain.py/0
{ "file_path": "langchain/templates/propositional-retrieval/propositional_retrieval/chain.py", "repo_id": "langchain", "token_count": 739 }
656
"""Agent for working with pandas objects.""" import warnings from typing import Any, Dict, List, Literal, Optional, Sequence, Union from langchain.agents import AgentType, create_openai_tools_agent, create_react_agent from langchain.agents.agent import ( AgentExecutor, BaseMultiActionAgent, BaseSingleActio...
langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/pandas/base.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/pandas/base.py", "repo_id": "langchain", "token_count": 4662 }
435
# Conversation buffer window memory `ConversationBufferWindowMemory` keeps a list of the interactions of the conversation over time. It only uses the last K interactions. This can be useful for keeping a sliding window of the most recent interactions, so the buffer does not get too large Let's first explore the basic...
langchainjs/docs/core_docs/docs/modules/memory/types/buffer_window.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/memory/types/buffer_window.mdx", "repo_id": "langchainjs", "token_count": 362 }
814
--- sidebar_position: 4 --- # LLMs Large Language Models (LLMs) are a core component of LangChain. LangChain does not serve its own LLMs, but rather provides a standard interface for interacting with many different LLMs. To be specific, this interface is one that takes as input a string and returns a string. There ...
langchain/docs/docs/modules/model_io/llms/index.mdx/0
{ "file_path": "langchain/docs/docs/modules/model_io/llms/index.mdx", "repo_id": "langchain", "token_count": 317 }
206
# Starter Tutorial (Local Models) ```{tip} Make sure you've followed the [custom installation](installation.md) steps first. ``` This is our famous "5 lines of code" starter example with local LLM and embedding models. We will use `BAAI/bge-m3` as our embedding model and `Mistral-7B` served through `Ollama` as our LL...
llama_index/docs/getting_started/starter_example_local.md/0
{ "file_path": "llama_index/docs/getting_started/starter_example_local.md", "repo_id": "llama_index", "token_count": 904 }
1,089
python_sources()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-bedrock/llama_index/embeddings/bedrock/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-bedrock/llama_index/embeddings/bedrock/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,354
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/deepfloyd_if/test_if_superresolution.py/0
{ "file_path": "diffusers/tests/pipelines/deepfloyd_if/test_if_superresolution.py", "repo_id": "diffusers", "token_count": 1925 }
270
python_tests( interpreter_constraints=["==3.9.*", "==3.10.*"], )
llama_index/llama-index-integrations/readers/llama-index-readers-pandas-ai/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-pandas-ai/tests/BUILD", "repo_id": "llama_index", "token_count": 29 }
1,412
<jupyter_start><jupyter_text>Finetune EmbeddingsIn this notebook, we show users how to finetune their own embedding models.We go through three main sections:1. Preparing the data (our `generate_qa_embedding_pairs` function makes this easy)2. Finetuning the model (using our `SentenceTransformersFinetuneEngine`)3. Evalua...
llama_index/docs/examples/finetuning/embeddings/finetune_embedding.ipynb/0
{ "file_path": "llama_index/docs/examples/finetuning/embeddings/finetune_embedding.ipynb", "repo_id": "llama_index", "token_count": 3214 }
1,119
python_sources()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-google/llama_index/embeddings/google/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-google/llama_index/embeddings/google/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,230
from csv_agent.agent import agent_executor __all__ = ["agent_executor"]
langchain/templates/csv-agent/csv_agent/__init__.py/0
{ "file_path": "langchain/templates/csv-agent/csv_agent/__init__.py", "repo_id": "langchain", "token_count": 25 }
670
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/tools/llama-index-tools-tavily-research/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-tavily-research/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,498
# StarRocks >[StarRocks](https://www.starrocks.io/) is a High-Performance Analytical Database. `StarRocks` is a next-gen sub-second MPP database for full analytics scenarios, including multi-dimensional analytics, real-time analytics and ad-hoc query. >Usually `StarRocks` is categorized into OLAP, and it has showed e...
langchain/docs/docs/integrations/providers/starrocks.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/starrocks.mdx", "repo_id": "langchain", "token_count": 210 }
153
<jupyter_start><jupyter_text>ClientDemo of a client interacting with a configurable retriever (see server code) You can interact with this via API directly<jupyter_code>import requests inputs = {"input": "cat"} response = requests.post("http://localhost:8000/invoke", json=inputs) response.json()<jupyter_output><empty...
langserve/examples/configurable_retrieval/client.ipynb/0
{ "file_path": "langserve/examples/configurable_retrieval/client.ipynb", "repo_id": "langserve", "token_count": 290 }
1,042
import logging import os from typing import Any, Dict, Iterator, List, Mapping, Optional, Union from ibm_watsonx_ai.foundation_models import ModelInference # type: ignore from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.llms import BaseLLM from langchain_core.outputs i...
langchain/libs/partners/ibm/langchain_ibm/llms.py/0
{ "file_path": "langchain/libs/partners/ibm/langchain_ibm/llms.py", "repo_id": "langchain", "token_count": 6781 }
647
import * as uuid from "uuid"; import type { ChainValues } from "../utils/types.js"; import type { BaseMessage } from "../messages/index.js"; import type { AgentAction, AgentFinish } from "../agents.js"; import type { ChatGenerationChunk, GenerationChunk, LLMResult, } from "../outputs.js"; import { Serializable,...
langchainjs/langchain-core/src/callbacks/base.ts/0
{ "file_path": "langchainjs/langchain-core/src/callbacks/base.ts", "repo_id": "langchainjs", "token_count": 3435 }
830
from __future__ import annotations from typing import ( TYPE_CHECKING, List, Optional, ) if TYPE_CHECKING: import rdflib prefixes = { "owl": """PREFIX owl: <http://www.w3.org/2002/07/owl#>\n""", "rdf": """PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n""", "rdfs": """PREFIX rd...
langchain/libs/community/langchain_community/graphs/rdf_graph.py/0
{ "file_path": "langchain/libs/community/langchain_community/graphs/rdf_graph.py", "repo_id": "langchain", "token_count": 4789 }
282
from langchain_core.runnables.passthrough import ( RunnableAssign, RunnablePassthrough, aidentity, identity, ) __all__ = ["aidentity", "identity", "RunnablePassthrough", "RunnableAssign"]
langchain/libs/langchain/langchain/schema/runnable/passthrough.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/runnable/passthrough.py", "repo_id": "langchain", "token_count": 85 }
578
python_tests( interpreter_constraints=["==3.9.*", "==3.10.*"], )
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-google/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-google/tests/BUILD", "repo_id": "llama_index", "token_count": 29 }
1,259
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-zep/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-zep/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,480
# flake8: noqa """Test Llama.cpp wrapper.""" import os from typing import Generator from urllib.request import urlretrieve import pytest from langchain_community.llms import LlamaCpp from tests.unit_tests.callbacks.fake_callback_handler import FakeCallbackHandler def get_model() -> str: """Download model. f ...
langchain/libs/community/tests/integration_tests/llms/test_llamacpp.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_llamacpp.py", "repo_id": "langchain", "token_count": 1272 }
357
""" This tool allows agents to interact with the atlassian-python-api library and operate on a Jira instance. For more information on the atlassian-python-api library, see https://atlassian-python-api.readthedocs.io/jira.html To use this tool, you must first set as environment variables: JIRA_API_TOKEN JIRA_US...
langchain/libs/community/langchain_community/tools/jira/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/jira/tool.py", "repo_id": "langchain", "token_count": 461 }
303
<script lang="ts"> import { marked } from "marked"; import markedKatex from "marked-katex-extension"; import type { Message } from "$lib/types/Message"; import { afterUpdate, createEventDispatcher, tick } from "svelte"; import { deepestChild } from "$lib/utils/deepestChild"; import { page } from "$app/stores"; ...
chat-ui/src/lib/components/chat/ChatMessage.svelte/0
{ "file_path": "chat-ui/src/lib/components/chat/ChatMessage.svelte", "repo_id": "chat-ui", "token_count": 6624 }
88
# Copyright 2020 The HuggingFace 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 applicable law or agreed to...
datasets/src/datasets/formatting/tf_formatter.py/0
{ "file_path": "datasets/src/datasets/formatting/tf_formatter.py", "repo_id": "datasets", "token_count": 1885 }
131
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_torch_multi_gpu, ) logging.b...
transformers/examples/research_projects/rag/_test_finetune_rag.py/0
{ "file_path": "transformers/examples/research_projects/rag/_test_finetune_rag.py", "repo_id": "transformers", "token_count": 1994 }
572
#!/usr/bin/env 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...
milvus/scripts/install_deps_embd.sh/0
{ "file_path": "milvus/scripts/install_deps_embd.sh", "repo_id": "milvus", "token_count": 2017 }
1,858
# Xception **Xception** is a convolutional neural network architecture that relies solely on [depthwise separable convolution layers](https://paperswithcode.com/method/depthwise-separable-convolution). The weights from this model were ported from [Tensorflow/Models](https://github.com/tensorflow/models). {% include ...
pytorch-image-models/docs/models/.templates/models/xception.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/xception.md", "repo_id": "pytorch-image-models", "token_count": 1874 }
321
from langchain_community.tools.playwright.current_page import CurrentWebPageTool __all__ = ["CurrentWebPageTool"]
langchain/libs/langchain/langchain/tools/playwright/current_page.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/playwright/current_page.py", "repo_id": "langchain", "token_count": 32 }
595
<jupyter_start><jupyter_text>BeamCalls the Beam API wrapper to deploy and make subsequent calls to an instance of the gpt2 LLM in a cloud deployment. Requires installation of the Beam library and registration of Beam Client ID and Client Secret. By calling the wrapper an instance of the model is created and run, with r...
langchain/docs/docs/integrations/llms/beam.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/beam.ipynb", "repo_id": "langchain", "token_count": 709 }
116
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "vectorstores/lancedb", }); export * from "@langchain/community/vectorstores/lancedb";
langchainjs/langchain/src/vectorstores/lancedb.ts/0
{ "file_path": "langchainjs/langchain/src/vectorstores/lancedb.ts", "repo_id": "langchainjs", "token_count": 74 }
936
"""Test functionality related to ngram overlap based selector.""" import pytest from langchain_core.prompts import PromptTemplate from langchain.prompts.example_selector.ngram_overlap import ( NGramOverlapExampleSelector, ngram_overlap_score, ) EXAMPLES = [ {"input": "See Spot run.", "output": "foo1"}, ...
langchain/libs/langchain/tests/integration_tests/prompts/test_ngram_overlap_example_selector.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/prompts/test_ngram_overlap_example_selector.py", "repo_id": "langchain", "token_count": 962 }
617
python_sources()
llama_index/llama-index-core/llama_index/core/node_parser/relational/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/node_parser/relational/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,191
import { test, expect } from "@jest/globals"; import { AgentAction, AgentFinish } from "@langchain/core/agents"; import { ChatConversationalAgentOutputParser } from "../chat_convo/outputParser.js"; test("Can parse JSON with text in front of it", async () => { const testCases = [ { input: `Based on the info...
langchainjs/langchain/src/agents/tests/chat_convo_output_parser.test.ts/0
{ "file_path": "langchainjs/langchain/src/agents/tests/chat_convo_output_parser.test.ts", "repo_id": "langchainjs", "token_count": 2793 }
870
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/unittest/test_local_chunk_manager.cpp/0
{ "file_path": "milvus/internal/core/unittest/test_local_chunk_manager.cpp", "repo_id": "milvus", "token_count": 3471 }
1,903
# Fake LLM LangChain provides a fake LLM chat model for testing purposes. This allows you to mock out calls to the LLM and and simulate what would happen if the LLM responded in a certain way. ## Usage import CodeBlock from "@theme/CodeBlock"; import FakeListChatExample from "@examples/models/chat/integration_fake.t...
langchainjs/docs/core_docs/docs/integrations/chat/fake.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/chat/fake.mdx", "repo_id": "langchainjs", "token_count": 107 }
722
import { ChatPromptTemplate, HumanMessagePromptTemplate, PromptTemplate, SystemMessagePromptTemplate, } from "@langchain/core/prompts"; export const run = async () => { const template = "What is a good name for a company that makes {product}?"; const promptA = new PromptTemplate({ template, inputVariables:...
langchainjs/examples/src/prompts/prompt_value.ts/0
{ "file_path": "langchainjs/examples/src/prompts/prompt_value.ts", "repo_id": "langchainjs", "token_count": 738 }
844
""" **Utility functions** for LangChain. """
langchain/libs/community/langchain_community/utils/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/utils/__init__.py", "repo_id": "langchain", "token_count": 14 }
321
<jupyter_start><jupyter_text>vLLM[vLLM](https://vllm.readthedocs.io/en/latest/index.html) is a fast and easy-to-use library for LLM inference and serving, offering:* State-of-the-art serving throughput * Efficient management of attention key and value memory with PagedAttention* Continuous batching of incoming requests...
langchain/docs/docs/integrations/llms/vllm.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/vllm.ipynb", "repo_id": "langchain", "token_count": 1140 }
120
# coding=utf-8 # Copyright 2023 The Pop2Piano 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 # # Unl...
transformers/src/transformers/models/pop2piano/tokenization_pop2piano.py/0
{ "file_path": "transformers/src/transformers/models/pop2piano/tokenization_pop2piano.py", "repo_id": "transformers", "token_count": 14434 }
657
python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/indices/managed/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/managed/BUILD", "repo_id": "llama_index", "token_count": 25 }
1,552
[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 = ["SalesforceToolSpec"] contains_example = false import_path = "llama_index.tools.salesforce...
llama_index/llama-index-integrations/tools/llama-index-tools-salesforce/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-salesforce/pyproject.toml", "repo_id": "llama_index", "token_count": 669 }
1,580
// 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/eventlog/global.go/0
{ "file_path": "milvus/pkg/eventlog/global.go", "repo_id": "milvus", "token_count": 833 }
2,087
from typing import TYPE_CHECKING from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 TreeSitterSegmenter, ) if TYPE_CHECKING: from tree_sitter import Language CHUNK_QUERY = """ [ (function_declaration) @function (class_declaration) @cla...
langchain/libs/community/langchain_community/document_loaders/parsers/language/typescript.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/parsers/language/typescript.py", "repo_id": "langchain", "token_count": 313 }
246
// 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/typeutil/float_util.go/0
{ "file_path": "milvus/pkg/util/typeutil/float_util.go", "repo_id": "milvus", "token_count": 424 }
1,925
# 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/glpn/test_modeling_glpn.py/0
{ "file_path": "transformers/tests/models/glpn/test_modeling_glpn.py", "repo_id": "transformers", "token_count": 6153 }
726
"""Tool for the Google search API.""" 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.utilities.google_places_api import GooglePlacesAPIWrapper ...
langchain/libs/community/langchain_community/tools/google_places/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/google_places/tool.py", "repo_id": "langchain", "token_count": 394 }
305
# CSP-ResNet **CSPResNet** is a convolutional neural network where we apply the Cross Stage Partial Network (CSPNet) approach to [ResNet](https://paperswithcode.com/method/resnet). The CSPNet partitions the feature map of the base layer into two parts and then merges them through a cross-stage hierarchy. The use of a ...
pytorch-image-models/docs/models/.templates/models/csp-resnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/csp-resnet.md", "repo_id": "pytorch-image-models", "token_count": 897 }
345
import path from "node:path"; import fs from "node:fs/promises"; import { BaseCache, getCacheKey, serializeGeneration, deserializeStoredGeneration, } from "@langchain/core/caches"; import { Generation } from "@langchain/core/outputs"; /** * A cache that uses the local filesystem as the backing store. * This...
langchainjs/langchain/src/cache/file_system.ts/0
{ "file_path": "langchainjs/langchain/src/cache/file_system.ts", "repo_id": "langchainjs", "token_count": 809 }
857
from langchain_community.vectorstores.dashvector import DashVector __all__ = ["DashVector"]
langchain/libs/langchain/langchain/vectorstores/dashvector.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/dashvector.py", "repo_id": "langchain", "token_count": 25 }
574
# In Memory Store This example demonstrates how to setup chat history storage using the `InMemoryStore` KV store integration. ## Usage The `InMemoryStore` allows for a generic type to be assigned to the values in the store. We'll assign type `BaseMessage` as the type of our values, keeping with the theme of a chat h...
langchainjs/docs/core_docs/docs/integrations/stores/in_memory.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/stores/in_memory.mdx", "repo_id": "langchainjs", "token_count": 129 }
722
<jupyter_start><jupyter_text>ThirdAI NeuralDB>[NeuralDB](https://www.thirdai.com/neuraldb-enterprise/) is a CPU-friendly and fine-tunable vector store developed by [ThirdAI](https://www.thirdai.com/). InitializationThere are three initialization methods:- From Scratch: Basic model- From Bazaar: Download a pretrained ba...
langchain/docs/docs/integrations/vectorstores/thirdai_neuraldb.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/thirdai_neuraldb.ipynb", "repo_id": "langchain", "token_count": 1365 }
186
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/deprecated/transfo_xl/convert_transfo_xl_original_tf_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/deprecated/transfo_xl/convert_transfo_xl_original_tf_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 1991 }
591
import type { EmbeddingsInterface } from "@langchain/core/embeddings"; import type { DocumentInterface } from "@langchain/core/documents"; import { cosineSimilarity } from "@langchain/core/utils/math"; import { BaseDocumentCompressor } from "./index.js"; /** * Interface for the parameters of the `EmbeddingsFilter` cl...
langchainjs/langchain/src/retrievers/document_compressors/embeddings_filter.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/document_compressors/embeddings_filter.ts", "repo_id": "langchainjs", "token_count": 1006 }
980
# flake8: noqa """Test rwkv wrapper.""" import os from urllib.request import urlretrieve from langchain_community.llms import RWKV import warnings import pytest def _download_model() -> str: """Download model. From https://huggingface.co/BlinkDL/rwkv-4-pile-169m/resolve/main/RWKV-4-Pile-169M-20220807-8023.pt...
langchain/libs/community/tests/integration_tests/llms/test_rwkv.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_rwkv.py", "repo_id": "langchain", "token_count": 486 }
341
FROM nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04 LABEL maintainer="Hugging Face" LABEL repository="transformers" RUN apt update && \ apt install -y bash \ build-essential \ git \ curl \ ca-certificates \ python3 \ ...
transformers/docker/transformers-gpu/Dockerfile/0
{ "file_path": "transformers/docker/transformers-gpu/Dockerfile", "repo_id": "transformers", "token_count": 397 }
461
babel.config.js jest.config.js .eslintrc.js
langchainjs/.prettierignore/0
{ "file_path": "langchainjs/.prettierignore", "repo_id": "langchainjs", "token_count": 22 }
689
# coding=utf-8 # Copyright 2021 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/tapas/test_modeling_tf_tapas.py/0
{ "file_path": "transformers/tests/models/tapas/test_modeling_tf_tapas.py", "repo_id": "transformers", "token_count": 21105 }
845
import logging import os from pathlib import Path from time import sleep from typing import Callable, List, Optional, Union import numpy as np import tensorflow as tf from huggingface_hub import Repository, create_repo from packaging.version import parse from . import IntervalStrategy, PreTrainedTokenizerBase from .m...
transformers/src/transformers/keras_callbacks.py/0
{ "file_path": "transformers/src/transformers/keras_callbacks.py", "repo_id": "transformers", "token_count": 8732 }
563
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-steamship/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-steamship/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,530
"""Test Confident.""" def test_confident_deepeval() -> None: """Test valid call to Beam.""" from deepeval.metrics.answer_relevancy import AnswerRelevancy from langchain_community.callbacks.confident_callback import DeepEvalCallbackHandler from langchain_community.llms import OpenAI answer_releva...
langchain/libs/community/tests/integration_tests/llms/test_confident.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_confident.py", "repo_id": "langchain", "token_count": 328 }
355
// 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/distributed/proxy/service.go/0
{ "file_path": "milvus/internal/distributed/proxy/service.go", "repo_id": "milvus", "token_count": 16250 }
1,987
from datetime import datetime from typing import Dict, Tuple, Union from langchain.chains.query_constructor.ir import ( Comparator, Comparison, Operation, Operator, StructuredQuery, Visitor, ) class WeaviateTranslator(Visitor): """Translate `Weaviate` internal query language elements to v...
langchain/libs/langchain/langchain/retrievers/self_query/weaviate.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/self_query/weaviate.py", "repo_id": "langchain", "token_count": 1192 }
539
from langchain_community.embeddings import FakeEmbeddings from langchain_community.retrievers.knn import KNNRetriever class TestKNNRetriever: def test_from_texts(self) -> None: input_texts = ["I have a pen.", "Do you have a pen?", "I have a bag."] knn_retriever = KNNRetriever.from_texts( ...
langchain/libs/community/tests/unit_tests/retrievers/test_knn.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/retrievers/test_knn.py", "repo_id": "langchain", "token_count": 184 }
411
/* eslint-disable no-process-env */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { beforeEach, describe, expect, test } from "@jest/globals"; import { ChromaClient } from "chromadb"; import { faker } from "@faker-js/faker"; import * as uuid from "uuid"; import { Document } from "@langchain/core/...
langchainjs/libs/langchain-community/src/vectorstores/tests/chroma.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/chroma.int.test.ts", "repo_id": "langchainjs", "token_count": 1692 }
969
<!--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 to...
transformers/docs/source/en/peft.md/0
{ "file_path": "transformers/docs/source/en/peft.md", "repo_id": "transformers", "token_count": 2640 }
525
<jupyter_start><jupyter_text>Github Issue Analysis Setup To use the github repo issue loader, you need to set your github token in the environment. See [here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) for how to get a github token. See [llama...
llama_index/docs/examples/usecases/github_issue_analysis.ipynb/0
{ "file_path": "llama_index/docs/examples/usecases/github_issue_analysis.ipynb", "repo_id": "llama_index", "token_count": 1392 }
1,087
import os from langchain.retrievers.multi_query import MultiQueryRetriever from langchain_community.chat_models import ChatOpenAI from langchain_community.vectorstores import Vectara from langchain_core.output_parsers import StrOutputParser from langchain_core.pydantic_v1 import BaseModel from langchain_core.runnables...
langchain/templates/rag-vectara-multiquery/rag_vectara_multiquery/chain.py/0
{ "file_path": "langchain/templates/rag-vectara-multiquery/rag_vectara_multiquery/chain.py", "repo_id": "langchain", "token_count": 761 }
750
import { GenerativeModel, GoogleGenerativeAI as GenerativeAI, } from "@google/generative-ai"; import type { SafetySetting } from "@google/generative-ai"; import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager"; import { BaseMessage } from "@langchain/core/messages"; import { ChatGenerationChunk...
langchainjs/libs/langchain-google-genai/src/chat_models.ts/0
{ "file_path": "langchainjs/libs/langchain-google-genai/src/chat_models.ts", "repo_id": "langchainjs", "token_count": 3573 }
1,100
from langchain.pydantic_v1 import BaseModel from langchain_core.runnables import RunnablePassthrough from sql_research_assistant.search.web import chain as search_chain from sql_research_assistant.writer import chain as writer_chain chain_notypes = ( RunnablePassthrough().assign(research_summary=search_chain) | w...
langchain/templates/sql-research-assistant/sql_research_assistant/chain.py/0
{ "file_path": "langchain/templates/sql-research-assistant/sql_research_assistant/chain.py", "repo_id": "langchain", "token_count": 197 }
757
import { test } from "@jest/globals"; import { SortXYZBlockchainLoader } from "../web/sort_xyz_blockchain.js"; const SORT_XYZ_DEMO_API_KEY = "dd46a0ae-5a1a-4c6f-8328-46618c4a73d4"; const contractAddress = "0x887F3909C14DAbd9e9510128cA6cBb448E932d7f".toLowerCase(); test.skip("Test Blockchain NFT Metadata Loader", as...
langchainjs/langchain/src/document_loaders/tests/sort_xyz_blockchain.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/sort_xyz_blockchain.int.test.ts", "repo_id": "langchainjs", "token_count": 518 }
869
#!/bin/bash export CUDA_VISIBLE_DEVICES=0 PATH_TO_DATA=/h/xinji/projects/GLUE MODEL_TYPE=bert # bert or roberta MODEL_SIZE=base # base or large DATASET=MRPC # SST-2, MRPC, RTE, QNLI, QQP, or MNLI MODEL_NAME=${MODEL_TYPE}-${MODEL_SIZE} EPOCHS=10 if [ $MODEL_TYPE = 'bert' ] then EPOCHS=3 MODEL_NAME=${MODEL_NAME...
transformers/examples/research_projects/deebert/train_deebert.sh/0
{ "file_path": "transformers/examples/research_projects/deebert/train_deebert.sh", "repo_id": "transformers", "token_count": 417 }
573
from langchain_community.vectorstores.cassandra import CVST, Cassandra __all__ = ["CVST", "Cassandra"]
langchain/libs/langchain/langchain/vectorstores/cassandra.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/cassandra.py", "repo_id": "langchain", "token_count": 32 }
601
import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def tokenize(example): output = {} output["input_ids"] = tokenizer(example["content"], truncation=False)["input_ids"] output["ratio...
transformers/examples/research_projects/codeparrot/scripts/pretokenizing.py/0
{ "file_path": "transformers/examples/research_projects/codeparrot/scripts/pretokenizing.py", "repo_id": "transformers", "token_count": 527 }
557
"""Experiment with different models.""" from __future__ import annotations from typing import List, Optional, Sequence from langchain_core.language_models.llms import BaseLLM from langchain_core.prompts.prompt import PromptTemplate from langchain_core.utils.input import get_color_mapping, print_text from langchain....
langchain/libs/langchain/langchain/model_laboratory.py/0
{ "file_path": "langchain/libs/langchain/langchain/model_laboratory.py", "repo_id": "langchain", "token_count": 1433 }
532
<!--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/ja/model_doc/deberta.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/deberta.md", "repo_id": "transformers", "token_count": 3598 }
543
<!--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/en/model_doc/upernet.md/0
{ "file_path": "transformers/docs/source/en/model_doc/upernet.md", "repo_id": "transformers", "token_count": 1188 }
467
python_tests()
llama_index/llama-index-integrations/output_parsers/llama-index-output-parsers-guardrails/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/output_parsers/llama-index-output-parsers-guardrails/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,258
# Using Graph Stores ## `Neo4jGraphStore` `Neo4j` is supported as a graph store integration. You can persist, visualize, and query graphs using LlamaIndex and Neo4j. Furthermore, existing Neo4j graphs are directly supported using `text2cypher` and the `KnowledgeGraphQueryEngine`. If you've never used Neo4j before, y...
llama_index/docs/community/integrations/graph_stores.md/0
{ "file_path": "llama_index/docs/community/integrations/graph_stores.md", "repo_id": "llama_index", "token_count": 612 }
1,085
version: '3.5' services: etcd: image: quay.io/coreos/etcd:v3.5.5 environment: - ETCD_AUTO_COMPACTION_MODE=revision - ETCD_AUTO_COMPACTION_RETENTION=1000 - ETCD_QUOTA_BACKEND_BYTES=4294967296 - ETCD_SNAPSHOT_COUNT=50000 volumes: - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/e...
milvus/deployments/docker/dev/docker-compose.yml/0
{ "file_path": "milvus/deployments/docker/dev/docker-compose.yml", "repo_id": "milvus", "token_count": 1699 }
1,848
import { IEmbeddingFunction } from "./IEmbeddingFunction"; interface CohereAIAPI { createEmbedding: (params: { model: string; input: string[]; }) => Promise<number[][]>; } class CohereAISDK56 implements CohereAIAPI { private cohereClient: any; private apiKey: string; constructor(configuration: { ap...
chroma/clients/js/src/embeddings/CohereEmbeddingFunction.ts/0
{ "file_path": "chroma/clients/js/src/embeddings/CohereEmbeddingFunction.ts", "repo_id": "chroma", "token_count": 1214 }
34
import { MyScaleStore } from "@langchain/community/vectorstores/myscale"; import { OpenAIEmbeddings } from "@langchain/openai"; const vectorStore = await MyScaleStore.fromTexts( ["Hello world", "Bye bye", "hello nice world"], [ { id: 2, name: "2" }, { id: 1, name: "1" }, { id: 3, name: "3" }, ], ne...
langchainjs/examples/src/indexes/vector_stores/myscale_fromTexts.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/myscale_fromTexts.ts", "repo_id": "langchainjs", "token_count": 324 }
786
# Embeddings ##### FAQ 1. [How to use a custom/local embedding model?](#1-how-to-use-a-customlocal-embedding-model) 2. [How to use a local hugging face embedding model?](#2-how-to-use-a-local-hugging-face-embedding-model) 3. [How to use embedding model to generate embeddings for text?](#3-how-to-use-embedding-model-t...
llama_index/docs/community/faq/embeddings.md/0
{ "file_path": "llama_index/docs/community/faq/embeddings.md", "repo_id": "llama_index", "token_count": 456 }
1,087
# LlamaIndex Embeddings Integration: Azure Openai
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-azure-openai/README.md/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-azure-openai/README.md", "repo_id": "llama_index", "token_count": 13 }
1,267
<!--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/de/model_sharing.md/0
{ "file_path": "transformers/docs/source/de/model_sharing.md", "repo_id": "transformers", "token_count": 4283 }
447
# 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/models/clipseg/__init__.py/0
{ "file_path": "transformers/src/transformers/models/clipseg/__init__.py", "repo_id": "transformers", "token_count": 864 }
613
python_sources()
llama_index/llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-redis/llama_index/storage/chat_store/redis/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-redis/llama_index/storage/chat_store/redis/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,401
import base64 import email from enum import Enum from typing import Any, Dict, List, Optional, Type from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import BaseModel, Field from langchain_community.tools.gmail.base import GmailBaseTool from langchain_community.tools.gmail...
langchain/libs/community/langchain_community/tools/gmail/search.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/gmail/search.py", "repo_id": "langchain", "token_count": 2262 }
299
<!--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/en/model_doc/clipseg.md/0
{ "file_path": "transformers/docs/source/en/model_doc/clipseg.md", "repo_id": "transformers", "token_count": 1221 }
471
<jupyter_start><jupyter_text>Optimized Embedding Model using Optimum-IntelLlamaIndex has support for loading quantized embedding models for Intel, using the [Optimum-Intel library](https://huggingface.co/docs/optimum/main/en/intel/index). Optimized models are smaller and faster, with minimal accuracy loss, see the [doc...
llama_index/docs/examples/embeddings/optimum_intel.ipynb/0
{ "file_path": "llama_index/docs/examples/embeddings/optimum_intel.ipynb", "repo_id": "llama_index", "token_count": 419 }
1,059
import { ChatOpenAI } from "@langchain/openai"; const chatModel = new ChatOpenAI({ modelName: "gpt-4", callbacks: [ { handleLLMEnd(output) { console.log(JSON.stringify(output, null, 2)); }, }, ], }); await chatModel.invoke("Tell me a joke."); /* { "generations": [ [ ...
langchainjs/examples/src/models/chat/token_usage_tracking.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/token_usage_tracking.ts", "repo_id": "langchainjs", "token_count": 562 }
827
import importlib import json import os from typing import Any, Dict, List, Optional from langchain_core._api import beta from langchain_core.load.mapping import ( _OG_SERIALIZABLE_MAPPING, OLD_CORE_NAMESPACES_MAPPING, SERIALIZABLE_MAPPING, ) from langchain_core.load.serializable import Serializable DEFAUL...
langchain/libs/core/langchain_core/load/load.py/0
{ "file_path": "langchain/libs/core/langchain_core/load/load.py", "repo_id": "langchain", "token_count": 2530 }
413
// A scheduler recieves embedding records for a given batch of documents // and schedules them to be ingested to the segment manager use crate::{ system::{Component, ComponentContext, Handler, Receiver}, types::EmbeddingRecord, }; use async_trait::async_trait; use rand::prelude::SliceRandom; use rand::Rng; use...
chroma/rust/worker/src/ingest/scheduler.rs/0
{ "file_path": "chroma/rust/worker/src/ingest/scheduler.rs", "repo_id": "chroma", "token_count": 4057 }
56
<jupyter_start><jupyter_text>Chroma>[Chroma](https://docs.trychroma.com/getting-started) is a AI-native open-source vector database focused on developer productivity and happiness. Chroma is licensed under Apache 2.0.Install Chroma with:```shpip install chromadb```Chroma runs in various modes. See below for examples of...
langchain/docs/docs/integrations/vectorstores/chroma.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/chroma.ipynb", "repo_id": "langchain", "token_count": 3454 }
180
from langchain_community.vectorstores.tair import Tair __all__ = ["Tair"]
langchain/libs/langchain/langchain/vectorstores/tair.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/tair.py", "repo_id": "langchain", "token_count": 25 }
609
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/models/t5_film_transformer.py/0
{ "file_path": "diffusers/src/diffusers/models/t5_film_transformer.py", "repo_id": "diffusers", "token_count": 1343 }
229
import "@tensorflow/tfjs-backend-cpu"; import { TensorFlowEmbeddings } from "@langchain/community/embeddings/tensorflow"; import { MemoryVectorStore } from "langchain/vectorstores/memory"; import { Document } from "@langchain/core/documents"; const embeddings = new TensorFlowEmbeddings(); const store = new MemoryVecto...
langchainjs/examples/src/models/embeddings/tensorflow.ts/0
{ "file_path": "langchainjs/examples/src/models/embeddings/tensorflow.ts", "repo_id": "langchainjs", "token_count": 163 }
901
from __future__ import annotations from llama_index.core.storage.index_store.keyval_index_store import KVIndexStore from llama_index.storage.kvstore.dynamodb import DynamoDBKVStore class DynamoDBIndexStore(KVIndexStore): def __init__(self, dynamodb_kvstore: DynamoDBKVStore, namespace: str | None = None): ...
llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-dynamodb/llama_index/storage/index_store/dynamodb/base.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-dynamodb/llama_index/storage/index_store/dynamodb/base.py", "repo_id": "llama_index", "token_count": 303 }
1,552
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICEN...
transformers/src/transformers/optimization.py/0
{ "file_path": "transformers/src/transformers/optimization.py", "repo_id": "transformers", "token_count": 13951 }
705