text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
<jupyter_start><jupyter_text>LangSmith Chat DatasetsThis notebook demonstrates an easy way to load a LangSmith chat dataset fine-tune a model on that data.The process is simple and comprises 3 steps.1. Create the chat dataset.2. Use the LangSmithDatasetChatLoader to load examples.3. Fine-tune your model.Then you can us...
langchain/docs/docs/integrations/chat_loaders/langsmith_dataset.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/chat_loaders/langsmith_dataset.ipynb", "repo_id": "langchain", "token_count": 1274 }
94
"""Util that calls Google Scholar Search.""" from typing import Dict, Optional from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator from langchain_core.utils import get_from_dict_or_env class GoogleScholarAPIWrapper(BaseModel): """Wrapper for Google Scholar API You can create serpapi key ...
langchain/libs/community/langchain_community/utilities/google_scholar.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/google_scholar.py", "repo_id": "langchain", "token_count": 2420 }
327
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/pkg/mq/msgstream/unmarshal_test.go/0
{ "file_path": "milvus/pkg/mq/msgstream/unmarshal_test.go", "repo_id": "milvus", "token_count": 839 }
1,821
<jupyter_start><jupyter_text>RAGatouille Retriever Llama Pack RAGatouille is a [cool library](https://github.com/bclavie/RAGatouille) that lets you use e.g. ColBERT and other SOTA retrieval models in your RAG pipeline. You can use it to either run inference on ColBERT, or use it to train/fine-tune models.This LlamaPack...
llama_index/llama-index-packs/llama-index-packs-ragatouille-retriever/examples/ragatouille_retriever.ipynb/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-ragatouille-retriever/examples/ragatouille_retriever.ipynb", "repo_id": "llama_index", "token_count": 1097 }
1,722
import torch import torch.distributed from pathlib import Path from typing import Optional, Type from opentelemetry import trace from transformers import AutoTokenizer, PretrainedConfig, PreTrainedTokenizerBase from huggingface_hub import hf_hub_download import json from text_generation_server.models import CausalLM ...
text-generation-inference/server/text_generation_server/models/mpt.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/mpt.py", "repo_id": "text-generation-inference", "token_count": 1440 }
444
# 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/utils/outputs.py/0
{ "file_path": "diffusers/src/diffusers/utils/outputs.py", "repo_id": "diffusers", "token_count": 1817 }
282
from typing import Any, Dict, List, Optional, Sequence, cast from llama_index.legacy.core.base_selector import ( BaseSelector, SelectorResult, SingleSelection, ) from llama_index.legacy.llm_predictor.base import LLMPredictorType from llama_index.legacy.output_parsers.base import StructuredOutput from llama...
llama_index/llama-index-legacy/llama_index/legacy/selectors/llm_selectors.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/selectors/llm_selectors.py", "repo_id": "llama_index", "token_count": 3218 }
1,772
package dao import ( "database/sql" "go.uber.org/zap" "gorm.io/gorm" "github.com/chroma/chroma-coordinator/internal/metastore/db/dbmodel" "github.com/pingcap/log" ) type collectionDb struct { db *gorm.DB } var _ dbmodel.ICollectionDb = &collectionDb{} func (s *collectionDb) DeleteAll() error { return s.db....
chroma/go/coordinator/internal/metastore/db/dao/collection.go/0
{ "file_path": "chroma/go/coordinator/internal/metastore/db/dao/collection.go", "repo_id": "chroma", "token_count": 1657 }
45
# Composition This notebook goes over how to compose multiple prompts together. This can be useful when you want to reuse parts of prompts. This can be done with a PipelinePrompt. A PipelinePrompt consists of two main parts: - Final prompt: This is the final prompt that is returned - Pipeline prompts: This is a list ...
langchainjs/docs/core_docs/docs/modules/model_io/prompts/pipeline.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/prompts/pipeline.mdx", "repo_id": "langchainjs", "token_count": 159 }
740
from __future__ import annotations import os import tempfile from typing import TYPE_CHECKING, List, Optional, Union from langchain_community.document_loaders.unstructured import UnstructuredBaseLoader if TYPE_CHECKING: import botocore class S3FileLoader(UnstructuredBaseLoader): """Load from `Amazon AWS S3...
langchain/libs/community/langchain_community/document_loaders/s3_file.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/s3_file.py", "repo_id": "langchain", "token_count": 2220 }
249
from typing import Any, Dict, List, Optional, Tuple, Union class NeptuneQueryException(Exception): """Exception for the Neptune queries.""" def __init__(self, exception: Union[str, Dict]): if isinstance(exception, dict): self.message = exception["message"] if "message" in exception else "...
langchain/libs/community/langchain_community/graphs/neptune_graph.py/0
{ "file_path": "langchain/libs/community/langchain_community/graphs/neptune_graph.py", "repo_id": "langchain", "token_count": 4539 }
263
""" Visformer Paper: Visformer: The Vision-friendly Transformer - https://arxiv.org/abs/2104.12533 From original at https://github.com/danczs/Visformer Modifications and additions for timm hacked together by / Copyright 2021, Ross Wightman """ import torch import torch.nn as nn from timm.data import IMAGENET_DEFAU...
pytorch-image-models/timm/models/visformer.py/0
{ "file_path": "pytorch-image-models/timm/models/visformer.py", "repo_id": "pytorch-image-models", "token_count": 10132 }
359
## 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 ...
transformers/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/to_replace_{{cookiecutter.lowercase_modelname}}.py/0
{ "file_path": "transformers/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/to_replace_{{cookiecutter.lowercase_modelname}}.py", "repo_id": "transformers", "token_count": 7744 }
740
import threading import pytest import json from time import sleep from minio import Minio from pymilvus import connections from chaos.checker import (CollectionCreateChecker, InsertChecker, FlushChecker, SearchChecker, ...
milvus/tests/python_client/chaos/test_load_with_checker.py/0
{ "file_path": "milvus/tests/python_client/chaos/test_load_with_checker.py", "repo_id": "milvus", "token_count": 2545 }
1,964
import { MemoryVectorStore } from "langchain/vectorstores/memory"; import { SemanticSimilarityExampleSelector } from "@langchain/core/example_selectors"; import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { FewShotPromptTemplate, PromptTemplate } from "@langchain/core/prompts"; import { createSqlQ...
langchainjs/examples/src/use_cases/sql/prompting/dynamic_few_shot.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/sql/prompting/dynamic_few_shot.ts", "repo_id": "langchainjs", "token_count": 1017 }
856
"""Utilities to get information about the runtime environment.""" from langsmith.env._git import get_git_info from langsmith.env._runtime_env import ( get_docker_compose_command, get_docker_compose_version, get_docker_environment, get_docker_version, get_langchain_env_var_metadata, get_langchain...
langsmith-sdk/python/langsmith/env/__init__.py/0
{ "file_path": "langsmith-sdk/python/langsmith/env/__init__.py", "repo_id": "langsmith-sdk", "token_count": 334 }
1,149
from llama_index.finetuning.rerankers import CohereRerankerFinetuneEngine from llama_index.finetuning.types import BaseCohereRerankerFinetuningEngine def test_classes(): names_of_base_classes = [b.__name__ for b in CohereRerankerFinetuneEngine.__mro__] assert BaseCohereRerankerFinetuningEngine.__name__ in nam...
llama_index/llama-index-finetuning/tests/rerankers/test_rerankers_classes.py/0
{ "file_path": "llama_index/llama-index-finetuning/tests/rerankers/test_rerankers_classes.py", "repo_id": "llama_index", "token_count": 121 }
1,338
# from https://github.com/metallb/metallb/tree/v0.9.3/manifests namespace.yaml and metallb.yaml apiVersion: v1 kind: Namespace metadata: name: metallb-system labels: app: metallb --- apiVersion: policy/v1beta1 kind: PodSecurityPolicy metadata: labels: app: metallb name: controller namespace: metallb-s...
milvus/build/config/metallb.yaml/0
{ "file_path": "milvus/build/config/metallb.yaml", "repo_id": "milvus", "token_count": 3775 }
1,886
<!--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/api/pipelines/stable_diffusion/image_variation.md/0
{ "file_path": "diffusers/docs/source/en/api/pipelines/stable_diffusion/image_variation.md", "repo_id": "diffusers", "token_count": 494 }
175
<jupyter_start><jupyter_text>Human-in-the-loopThere are certain tools that we don't trust a model to execute on its own. One thing we can do in such situations is require human approval before the tool is invoked. SetupWe'll need to install the following packages:<jupyter_code>%pip install --upgrade --quiet langchain ...
langchain/docs/docs/use_cases/tool_use/human_in_the_loop.ipynb/0
{ "file_path": "langchain/docs/docs/use_cases/tool_use/human_in_the_loop.ipynb", "repo_id": "langchain", "token_count": 1068 }
213
from typing import Any from llama_index.core.output_parsers.base import StructuredOutput from llama_index.core.output_parsers.utils import parse_json_markdown from llama_index.core.question_gen.types import SubQuestion from llama_index.core.types import BaseOutputParser class SubQuestionOutputParser(BaseOutputParser...
llama_index/llama-index-core/llama_index/core/question_gen/output_parser.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/question_gen/output_parser.py", "repo_id": "llama_index", "token_count": 362 }
1,172
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 50278, "logprob": null, "text": "<|prompter|>" }, { "id": 1276, "logprob": -8.03125, "text...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_neox_sharded/test_flash_neox_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_neox_sharded/test_flash_neox_load.json", "repo_id": "text-generation-inference", "token_count": 9176 }
385
python_sources()
llama_index/llama-index-packs/llama-index-packs-multi-document-agents/llama_index/packs/multi_document_agents/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-multi-document-agents/llama_index/packs/multi_document_agents/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,678
# 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/audio_spectrogram_transformer/test_modeling_audio_spectrogram_transformer.py/0
{ "file_path": "transformers/tests/models/audio_spectrogram_transformer/test_modeling_audio_spectrogram_transformer.py", "repo_id": "transformers", "token_count": 3948 }
766
export const AGENT_INSTRUCTIONS = `You are a helpful assistant. Help the user answer any questions. You have access to the following tools: {tools} In order to use a tool, you can use <tool></tool> and <tool_input></tool_input> tags. You will then get back a response in the form <observation></observation> For examp...
langchainjs/langchain/src/agents/xml/prompt.ts/0
{ "file_path": "langchainjs/langchain/src/agents/xml/prompt.ts", "repo_id": "langchainjs", "token_count": 212 }
921
from typing import Any, Dict, List, Optional import requests from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseModel, Extra, Field, SecretStr DEFAULT_MODEL_NAME = "sentence-transformers/all-mpnet-base-v2" DEFAULT_INSTRUCT_MODEL = "hkunlp/instructor-large" DEFAULT_BGE_MODEL = ...
langchain/libs/community/langchain_community/embeddings/huggingface.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/huggingface.py", "repo_id": "langchain", "token_count": 5130 }
276
# coding=utf-8 # Copyright 2022 Microsoft, clefourrier and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licens...
transformers/src/transformers/models/graphormer/configuration_graphormer.py/0
{ "file_path": "transformers/src/transformers/models/graphormer/configuration_graphormer.py", "repo_id": "transformers", "token_count": 4211 }
695
"""Loads rich text files.""" from typing import Any, List from langchain_community.document_loaders.unstructured import ( UnstructuredFileLoader, satisfies_min_unstructured_version, ) class UnstructuredRTFLoader(UnstructuredFileLoader): """Load `RTF` files using `Unstructured`. You can run the loade...
langchain/libs/community/langchain_community/document_loaders/rtf.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/rtf.py", "repo_id": "langchain", "token_count": 793 }
259
<!--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...
datasets/docs/source/quickstart.mdx/0
{ "file_path": "datasets/docs/source/quickstart.mdx", "repo_id": "datasets", "token_count": 6014 }
114
import { USearch } from "@langchain/community/vectorstores/usearch"; import { OpenAIEmbeddings } from "@langchain/openai"; const vectorStore = await USearch.fromTexts( ["Hello world", "Bye bye", "hello nice world"], [{ id: 2 }, { id: 1 }, { id: 3 }], new OpenAIEmbeddings() ); const resultOne = await vectorStore...
langchainjs/examples/src/indexes/vector_stores/usearch.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/usearch.ts", "repo_id": "langchainjs", "token_count": 125 }
824
## init from llama_index.tools.azure_cv.base import ( CV_URL_TMPL, AzureCVToolSpec, ) __all__ = ["AzureCVToolSpec", "CV_URL_TMPL"]
llama_index/llama-index-integrations/tools/llama-index-tools-azure-cv/llama_index/tools/azure_cv/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-azure-cv/llama_index/tools/azure_cv/__init__.py", "repo_id": "llama_index", "token_count": 63 }
1,431
from llama_index.readers.zulip.base import ZulipReader __all__ = ["ZulipReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-zulip/llama_index/readers/zulip/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-zulip/llama_index/readers/zulip/__init__.py", "repo_id": "llama_index", "token_count": 32 }
1,454
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ /** * Creating a sidebar enables you to: - create an ordered group of docs - render a sidebar for each doc of t...
langchainjs/docs/core_docs/sidebars.js/0
{ "file_path": "langchainjs/docs/core_docs/sidebars.js", "repo_id": "langchainjs", "token_count": 4799 }
827
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
trl/examples/research_projects/tools/calculator.py/0
{ "file_path": "trl/examples/research_projects/tools/calculator.py", "repo_id": "trl", "token_count": 1433 }
787
# Basic Strategies There are many easy things to try, when you need to quickly squeeze out extra performance and optimize your RAG pipeline. ## Prompt Engineering If you're encountering failures related to the LLM, like hallucinations or poorly formatted outputs, then this should be one of the first things you try. ...
llama_index/docs/optimizing/basic_strategies/basic_strategies.md/0
{ "file_path": "llama_index/docs/optimizing/basic_strategies/basic_strategies.md", "repo_id": "llama_index", "token_count": 1830 }
1,151
from rag_matching_engine.chain import chain __all__ = ["chain"]
langchain/templates/rag-matching-engine/rag_matching_engine/__init__.py/0
{ "file_path": "langchain/templates/rag-matching-engine/rag_matching_engine/__init__.py", "repo_id": "langchain", "token_count": 21 }
719
import { ChatOpenAI } from "@langchain/openai"; const model = new ChatOpenAI({}); const promptAsString = "Human: Tell me a short joke about ice cream"; const response = await model.invoke(promptAsString); console.log(response); /** AIMessage { content: 'Sure, here you go: Why did the ice cream go to school? Because...
langchainjs/examples/src/guides/expression_language/get_started/chat_model.ts/0
{ "file_path": "langchainjs/examples/src/guides/expression_language/get_started/chat_model.ts", "repo_id": "langchainjs", "token_count": 139 }
866
from llama_index.core.node_parser.file.html import HTMLNodeParser from llama_index.core.node_parser.file.json import JSONNodeParser from llama_index.core.node_parser.file.markdown import MarkdownNodeParser from llama_index.core.node_parser.file.simple_file import SimpleFileNodeParser __all__ = [ "SimpleFileNodePar...
llama_index/llama-index-core/llama_index/core/node_parser/file/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/node_parser/file/__init__.py", "repo_id": "llama_index", "token_count": 132 }
1,190
# CHANGELOG ## [0.1.2] - 2024-2-15 - Remove incorrect one; resort back to lazy load of clip/torch
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-clip/CHANGELOG.md/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-clip/CHANGELOG.md", "repo_id": "llama_index", "token_count": 39 }
1,223
#!/bin/bash # Exit immediately for non zero status set -e ns_name=$1 instance_name=$2 log_dir=${3:-"k8s_logs"} # export goroutine of all milvus pods array=($(kubectl get pod -n ${ns_name} -l "app.kubernetes.io/instance=${instance_name}, app.kubernetes.io/name=milvus"| awk 'NR == 1 {next} {print $1}')) echo ${arra...
milvus/tests/scripts/export_pprof_goroutine.sh/0
{ "file_path": "milvus/tests/scripts/export_pprof_goroutine.sh", "repo_id": "milvus", "token_count": 300 }
1,914
"use client"; import { ToastContainer, toast } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; import { useRef, ReactElement, useState } from "react"; import type { FormEvent } from "react"; import { ChatMessageBubble } from "@/components/ChatMessageBubble"; import { ChatWindowMessage } from '...
langsmith-cookbook/feedback-examples/nextjs/components/ChatWindow.tsx/0
{ "file_path": "langsmith-cookbook/feedback-examples/nextjs/components/ChatWindow.tsx", "repo_id": "langsmith-cookbook", "token_count": 2348 }
1,136
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/program/predefined/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/program/predefined/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,628
# coding=utf-8 # Copyright 2018 Salesforce and HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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 # # h...
transformers/src/transformers/models/ctrl/modeling_ctrl.py/0
{ "file_path": "transformers/src/transformers/models/ctrl/modeling_ctrl.py", "repo_id": "transformers", "token_count": 15197 }
625
# LlamaIndex Readers Integration: Notion
llama_index/llama-index-integrations/readers/llama-index-readers-notion/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-notion/README.md", "repo_id": "llama_index", "token_count": 10 }
1,346
<jupyter_start><jupyter_text>Bedrock (Knowledge Bases)> [Knowledge bases for Amazon Bedrock](https://aws.amazon.com/bedrock/knowledge-bases/) is an Amazon Web Services (AWS) offering which lets you quickly build RAG applications by using your private data to customize FM response.> Implementing `RAG` requires organizat...
langchain/docs/docs/integrations/retrievers/bedrock.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/bedrock.ipynb", "repo_id": "langchain", "token_count": 627 }
159
.. _Ref-Node: Node ================= .. automodapi:: llama_index.core.schema :no-inheritance-diagram:
llama_index/docs/api_reference/node.rst/0
{ "file_path": "llama_index/docs/api_reference/node.rst", "repo_id": "llama_index", "token_count": 42 }
1,159
# Defining and Customizing Documents ## Defining Documents Documents can either be created automatically via data loaders, or constructed manually. By default, all of our [data loaders](/module_guides/loading/connector/root.md) (including those offered on LlamaHub) return `Document` objects through the `load_data` f...
llama_index/docs/module_guides/loading/documents_and_nodes/usage_documents.md/0
{ "file_path": "llama_index/docs/module_guides/loading/documents_and_nodes/usage_documents.md", "repo_id": "llama_index", "token_count": 1949 }
1,101
import { expect, test } from "@jest/globals"; import { GoogleVertexAI } from "../googlevertexai/index.js"; describe("Vertex AI", () => { test("Test Google Vertex", async () => { const model = new GoogleVertexAI({ maxOutputTokens: 50 }); const res = await model.call("1 + 1 = "); console.log({ res }); })...
langchainjs/libs/langchain-community/src/llms/tests/googlevertexai.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/llms/tests/googlevertexai.int.test.ts", "repo_id": "langchainjs", "token_count": 887 }
1,003
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-predibase/llama_index/llms/predibase/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-predibase/llama_index/llms/predibase/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,371
--- sidebar_position: 1 --- # Agents LangChain offers a number of tools and functions that allow you to create SQL Agents which can provide a more flexible way of interacting with SQL databases. The main advantages of using SQL Agents are: - It can answer questions based on the databases schema as well as on the dat...
langchainjs/docs/core_docs/docs/use_cases/sql/agents.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/use_cases/sql/agents.mdx", "repo_id": "langchainjs", "token_count": 1528 }
769
import { z } from "zod"; import { ChatPromptTemplate } from "@langchain/core/prompts"; import { ChatOpenAI } from "@langchain/openai"; import { expect, test } from "@jest/globals"; import { JsonOutputFunctionsParser } from "../../../output_parsers/openai_functions.js"; import { createOpenAIFnRunnable, createStructu...
langchainjs/langchain/src/chains/openai_functions/tests/create_runnable_chains.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/chains/openai_functions/tests/create_runnable_chains.int.test.ts", "repo_id": "langchainjs", "token_count": 1742 }
881
package proxy import ( "context" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" "github.com/milvus-io/milvus/internal/types" "github.com/milvus-io/milvus/pkg/mq/msgstream" "github.com/milvus-io/milvus/pkg/util/commonpbutil" "github.com/milvus-io/mi...
milvus/internal/proxy/task_database.go/0
{ "file_path": "milvus/internal/proxy/task_database.go", "repo_id": "milvus", "token_count": 1827 }
1,822
<jupyter_start><jupyter_text>Postgres Vector StoreIn this notebook we are going to show how to use [Postgresql](https://www.postgresql.org) and [pgvector](https://github.com/pgvector/pgvector) to perform vector searches in LlamaIndex If you're opening this Notebook on colab, you will probably need to install LlamaInd...
llama_index/docs/examples/vector_stores/postgres.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/postgres.ipynb", "repo_id": "llama_index", "token_count": 2231 }
1,088
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-postgres/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-postgres/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,601
package indexparamcheck import ( "fmt" "strconv" ) // raftIVFPQChecker checks if a RAFT_IVF_PQ index can be built. type raftIVFPQChecker struct { ivfBaseChecker } // CheckTrain checks if ivf-pq index can be built with the specific index parameters. func (c *raftIVFPQChecker) CheckTrain(params map[string]string) e...
milvus/pkg/util/indexparamcheck/raft_ivf_pq_checker.go/0
{ "file_path": "milvus/pkg/util/indexparamcheck/raft_ivf_pq_checker.go", "repo_id": "milvus", "token_count": 618 }
1,832
# Movement Pruning: Adaptive Sparsity by Fine-Tuning Author: @VictorSanh *Magnitude pruning is a widely used strategy for reducing model size in pure supervised learning; however, it is less effective in the transfer learning regime that has become standard for state-of-the-art natural language processing application...
transformers/examples/research_projects/movement-pruning/README.md/0
{ "file_path": "transformers/examples/research_projects/movement-pruning/README.md", "repo_id": "transformers", "token_count": 4033 }
537
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datanode/allocator/allocator.go/0
{ "file_path": "milvus/internal/datanode/allocator/allocator.go", "repo_id": "milvus", "token_count": 759 }
1,833
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export4.dtd"> <en-export export-date="20230611T011239Z" application="Evernote" version="10.56.9"> <note> <title>Summer Training Program</title> <created>20221227T015948Z</created> <source>...
langchain/libs/community/tests/unit_tests/document_loaders/sample_documents/sample_notebook_2.enex/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/sample_documents/sample_notebook_2.enex", "repo_id": "langchain", "token_count": 327 }
406
<jupyter_start><jupyter_text>Google Cloud Firestore> [`Cloud Firestore`](https://cloud.google.com/firestore) is a NoSQL document database built for automatic scaling, high performance, and ease of application development.This notebook goes over how to use Firestore to store chat message history. Setting up To run this...
langchain/docs/docs/integrations/memory/firestore_chat_message_history.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/memory/firestore_chat_message_history.ipynb", "repo_id": "langchain", "token_count": 474 }
124
# docstyle-ignore INSTALL_CONTENT = """ # Installation de Transformers ! pip install transformers datasets # Pour installer à partir du code source au lieu de la dernière version, commentez la commande ci-dessus et décommentez la suivante. # ! pip install git+https://github.com/huggingface/transformers.git """ noteboo...
transformers/docs/source/fr/_config.py/0
{ "file_path": "transformers/docs/source/fr/_config.py", "repo_id": "transformers", "token_count": 173 }
481
from __future__ import annotations from uuid import UUID from langchain_core.pydantic_v1 import BaseModel class RunInfo(BaseModel): """Class that contains metadata for a single execution of a Chain or model.""" run_id: UUID """A unique identifier for the model or chain run."""
langchain/libs/core/langchain_core/outputs/run_info.py/0
{ "file_path": "langchain/libs/core/langchain_core/outputs/run_info.py", "repo_id": "langchain", "token_count": 87 }
393
import { IMSDBLoader } from "langchain/document_loaders/web/imsdb"; export const run = async () => { const loader = new IMSDBLoader( "https://imsdb.com/scripts/BlacKkKlansman.html" ); const docs = await loader.load(); console.log({ docs }); };
langchainjs/examples/src/document_loaders/imsdb.ts/0
{ "file_path": "langchainjs/examples/src/document_loaders/imsdb.ts", "repo_id": "langchainjs", "token_count": 92 }
854
import unittest from typing import List, Type import pytest from langchain_core.messages import ( AIMessage, AIMessageChunk, ChatMessage, ChatMessageChunk, FunctionMessage, FunctionMessageChunk, HumanMessage, HumanMessageChunk, SystemMessage, ToolMessage, convert_to_message...
langchain/libs/core/tests/unit_tests/test_messages.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/test_messages.py", "repo_id": "langchain", "token_count": 9131 }
409
from langchain_community.tools.sql_database.tool import ( BaseSQLDatabaseTool, InfoSQLDatabaseTool, ListSQLDatabaseTool, QuerySQLCheckerTool, QuerySQLDataBaseTool, ) __all__ = [ "BaseSQLDatabaseTool", "QuerySQLDataBaseTool", "InfoSQLDatabaseTool", "ListSQLDatabaseTool", "QuerySQ...
langchain/libs/langchain/langchain/tools/sql_database/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/sql_database/tool.py", "repo_id": "langchain", "token_count": 130 }
561
# 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/checkpointing.py/0
{ "file_path": "accelerate/src/accelerate/checkpointing.py", "repo_id": "accelerate", "token_count": 4647 }
9
# deprecated, please use the `filelock` package instead from filelock import ( # noqa: F401 # imported for backward compatibility TODO: remove in 3.0.0 BaseFileLock, SoftFileLock, Timeout, UnixFileLock, WindowsFileLock, ) from ._filelock import FileLock # noqa: F401 # imported for backward compa...
datasets/src/datasets/utils/filelock.py/0
{ "file_path": "datasets/src/datasets/utils/filelock.py", "repo_id": "datasets", "token_count": 115 }
152
# Document Stores Document stores contain ingested document chunks, which we call `Node` objects. See the [API Reference](/api_reference/storage/docstore.rst) for more details. ### Simple Document Store By default, the `SimpleDocumentStore` stores `Node` objects in-memory. They can be persisted to (and loaded from)...
llama_index/docs/module_guides/storing/docstores.md/0
{ "file_path": "llama_index/docs/module_guides/storing/docstores.md", "repo_id": "llama_index", "token_count": 1287 }
1,099
Query Transform =============== .. automodule:: llama_index.core.indices.query.query_transform :members: :inherited-members: :exclude-members:
llama_index/docs/api_reference/query/query_transform.rst/0
{ "file_path": "llama_index/docs/api_reference/query/query_transform.rst", "repo_id": "llama_index", "token_count": 53 }
1,162
"""Graph Database Cypher Reader.""" from typing import Dict, List, Optional import yaml from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class GraphDBCypherReader(BaseReader): """Graph database Cypher reader. Combines all Cypher query results into the Docume...
llama_index/llama-index-integrations/readers/llama-index-readers-graphdb-cypher/llama_index/readers/graphdb_cypher/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-graphdb-cypher/llama_index/readers/graphdb_cypher/base.py", "repo_id": "llama_index", "token_count": 721 }
1,504
# 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/conditional_detr/test_modeling_conditional_detr.py/0
{ "file_path": "transformers/tests/models/conditional_detr/test_modeling_conditional_detr.py", "repo_id": "transformers", "token_count": 10917 }
754
from llama_index.llms.rungpt.base import RunGptLLM __all__ = ["RunGptLLM"]
llama_index/llama-index-integrations/llms/llama-index-llms-rungpt/llama_index/llms/rungpt/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-rungpt/llama_index/llms/rungpt/__init__.py", "repo_id": "llama_index", "token_count": 34 }
1,331
# coding=utf-8 # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
transformers/tests/models/gptj/test_modeling_gptj.py/0
{ "file_path": "transformers/tests/models/gptj/test_modeling_gptj.py", "repo_id": "transformers", "token_count": 12590 }
764
from langchain_community.agent_toolkits.json.base import create_json_agent __all__ = ["create_json_agent"]
langchain/libs/langchain/langchain/agents/agent_toolkits/json/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/json/base.py", "repo_id": "langchain", "token_count": 35 }
465
342790CE3BD09229C9C14810E2AB86D28A4700BF
milvus/configs/cert/ca.srl/0
{ "file_path": "milvus/configs/cert/ca.srl", "repo_id": "milvus", "token_count": 24 }
1,727
# 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/albert/__init__.py/0
{ "file_path": "transformers/src/transformers/models/albert/__init__.py", "repo_id": "transformers", "token_count": 2259 }
603
"""Retriever tool.""" from typing import TYPE_CHECKING, Any, Optional from llama_index.legacy.core.base_retriever import BaseRetriever if TYPE_CHECKING: from llama_index.legacy.langchain_helpers.agents.tools import LlamaIndexTool from llama_index.legacy.schema import MetadataMode from llama_index.legacy.tools.ty...
llama_index/llama-index-legacy/llama_index/legacy/tools/retriever_tool.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/tools/retriever_tool.py", "repo_id": "llama_index", "token_count": 1581 }
1,607
# Prompts ## Concept Prompting is the fundamental input that gives LLMs their expressive power. LlamaIndex uses prompts to build the index, do insertion, perform traversal during querying, and to synthesize the final answer. LlamaIndex uses a set of [default prompt templates](https://github.com/jerryjliu/llama_index...
llama_index/docs/module_guides/models/prompts.md/0
{ "file_path": "llama_index/docs/module_guides/models/prompts.md", "repo_id": "llama_index", "token_count": 687 }
1,096
import os from functools import partial from glob import glob import faiss from datasets import Features, Sequence, Value, concatenate_datasets, load_dataset, load_from_disk from transformers import DPRContextEncoder, DPRContextEncoderTokenizerFast def split_text(text, n=100, character=" "): """Split the text e...
transformers/examples/research_projects/rag-end2end-retriever/kb_encode_utils.py/0
{ "file_path": "transformers/examples/research_projects/rag-end2end-retriever/kb_encode_utils.py", "repo_id": "transformers", "token_count": 1231 }
571
[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 = ["ApifyActor", "ApifyDataset"] contains_example = false import_path = "llama_index.readers....
llama_index/llama-index-integrations/readers/llama-index-readers-apify/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-apify/pyproject.toml", "repo_id": "llama_index", "token_count": 685 }
1,377
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/idefics/test_modeling_idefics.py/0
{ "file_path": "transformers/tests/models/idefics/test_modeling_idefics.py", "repo_id": "transformers", "token_count": 12287 }
731
import argparse import runhouse as rh import torch from nlp_example import training_function from accelerate.utils import PrepareForLaunch, patch_environment def launch_train(*args): num_processes = torch.cuda.device_count() print(f"Device count: {num_processes}") with patch_environment( world_s...
accelerate/examples/multigpu_remote_launcher.py/0
{ "file_path": "accelerate/examples/multigpu_remote_launcher.py", "repo_id": "accelerate", "token_count": 869 }
7
"""bitbucket reader.""" import base64 import os from typing import List, Optional import requests from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class BitbucketReader(BaseReader): """Bitbucket reader. Reads the content of files in Bitbucket repositories. ...
llama_index/llama-index-integrations/readers/llama-index-readers-bitbucket/llama_index/readers/bitbucket/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-bitbucket/llama_index/readers/bitbucket/base.py", "repo_id": "llama_index", "token_count": 2452 }
1,299
"""Response schema. Maintain this file for backwards compat. """ from llama_index.legacy.core.response.schema import ( RESPONSE_TYPE, PydanticResponse, Response, StreamingResponse, ) __all__ = ["Response", "PydanticResponse", "StreamingResponse", "RESPONSE_TYPE"]
llama_index/llama-index-legacy/llama_index/legacy/response/schema.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/response/schema.py", "repo_id": "llama_index", "token_count": 99 }
1,768
from langchain_community.document_loaders.open_city_data import OpenCityDataLoader __all__ = ["OpenCityDataLoader"]
langchain/libs/langchain/langchain/document_loaders/open_city_data.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/open_city_data.py", "repo_id": "langchain", "token_count": 34 }
486
from langchain_core.tracers.base import BaseTracer, TracerException __all__ = ["TracerException", "BaseTracer"]
langchain/libs/langchain/langchain/schema/callbacks/tracers/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/callbacks/tracers/base.py", "repo_id": "langchain", "token_count": 35 }
542
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/util/importutil/binlog_parser.go/0
{ "file_path": "milvus/internal/util/importutil/binlog_parser.go", "repo_id": "milvus", "token_count": 4077 }
1,936
import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager"; import { LLM, type BaseLLMParams } from "@langchain/core/language_models/llms"; import { type BaseLanguageModelCallOptions } from "@langchain/core/language_models/base"; // Uncomment if implementing streaming // import { // GenerationChun...
langchainjs/libs/create-langchain-integration/template/src/llms.ts/0
{ "file_path": "langchainjs/libs/create-langchain-integration/template/src/llms.ts", "repo_id": "langchainjs", "token_count": 791 }
929
# 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/tests/test_cli.py/0
{ "file_path": "accelerate/tests/test_cli.py", "repo_id": "accelerate", "token_count": 6337 }
22
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.database import DatabaseToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in DatabaseToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-database/tests/test_tools_database.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-database/tests/test_tools_database.py", "repo_id": "llama_index", "token_count": 91 }
1,481
import { AsyncLocalStorage } from "async_hooks"; import { RunTree, RunTreeConfig, isRunTree } from "./run_trees.js"; import { KVMap } from "./schemas.js"; const asyncLocalStorage = new AsyncLocalStorage<RunTree>(); export type RunTreeLike = RunTree; type WrapArgReturnPair<Pair> = Pair extends [ // eslint-disable-...
langsmith-sdk/js/src/traceable.ts/0
{ "file_path": "langsmith-sdk/js/src/traceable.ts", "repo_id": "langsmith-sdk", "token_count": 2719 }
1,147
// 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/core/unittest/test_data_codec.cpp/0
{ "file_path": "milvus/internal/core/unittest/test_data_codec.cpp", "repo_id": "milvus", "token_count": 8524 }
1,781
# Distributed inference examples with PiPPy This repo contains a variety of tutorials for using the [PiPPy](https://github.com/PyTorch/PiPPy) pipeline parallelism library with accelerate. You will find examples covering: 1. How to trace the model using `accelerate.prepare_pippy` 2. How to specify inputs based on what...
accelerate/examples/inference/README.md/0
{ "file_path": "accelerate/examples/inference/README.md", "repo_id": "accelerate", "token_count": 646 }
6
import unittest from typing import Any from unittest.mock import MagicMock, patch from langchain_community.graphs import HugeGraph class TestHugeGraph(unittest.TestCase): def setUp(self) -> None: self.username = "test_user" self.password = "test_password" self.address = "test_address" ...
langchain/libs/community/tests/integration_tests/graphs/test_hugegraph.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/graphs/test_hugegraph.py", "repo_id": "langchain", "token_count": 726 }
366
from __future__ import annotations import logging from functools import cached_property from typing import Any, AsyncIterator, Dict, Iterator, List, Optional from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models.llms import BaseLL...
langchain/libs/community/langchain_community/llms/gigachat.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/gigachat.py", "repo_id": "langchain", "token_count": 3889 }
268
use super::WordPiece; use crate::models::bpe::{BpeTrainer, BpeTrainerBuilder, BPE}; use crate::tokenizer::{AddedToken, Result, Trainer}; use serde::{Deserialize, Serialize}; use std::collections::HashSet; /// A `WordPieceTrainerBuilder` can be used to create a `WordPieceTrainer` with a custom /// configuration. pub st...
tokenizers/tokenizers/src/models/wordpiece/trainer.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/wordpiece/trainer.rs", "repo_id": "tokenizers", "token_count": 2499 }
454
<jupyter_start><jupyter_text>CachingLangChain provides an optional caching layer for LLMs. This is useful for two reasons:It can save you money by reducing the number of API calls you make to the LLM provider, if you're often requesting the same completion multiple times.It can speed up your application by reducing the...
langchain/docs/docs/modules/model_io/llms/llm_caching.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/llms/llm_caching.ipynb", "repo_id": "langchain", "token_count": 460 }
205
# coding=utf-8 # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
transformers/src/transformers/utils/fx.py/0
{ "file_path": "transformers/src/transformers/utils/fx.py", "repo_id": "transformers", "token_count": 22754 }
708
import { BufferMemory } from "langchain/memory"; import { UpstashRedisChatMessageHistory } from "@langchain/community/stores/message/upstash_redis"; import { ChatOpenAI } from "@langchain/openai"; import { ConversationChain } from "langchain/chains"; const memory = new BufferMemory({ chatHistory: new UpstashRedisCha...
langchainjs/examples/src/memory/upstash_redis.ts/0
{ "file_path": "langchainjs/examples/src/memory/upstash_redis.ts", "repo_id": "langchainjs", "token_count": 401 }
795
from langchain_community.callbacks.argilla_callback import ArgillaCallbackHandler __all__ = ["ArgillaCallbackHandler"]
langchain/libs/langchain/langchain/callbacks/argilla_callback.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/argilla_callback.py", "repo_id": "langchain", "token_count": 31 }
492
[ { "question": "Why is the transformer architecture expressive in the forward pass?", "answer": "The transformer architecture is expressive because it uses a general message passing scheme where nodes get to look at each other, decide what's interesting and then update each other." }, { "question": "...
auto-evaluator/nextjs/public/testData/testDataset.json/0
{ "file_path": "auto-evaluator/nextjs/public/testData/testDataset.json", "repo_id": "auto-evaluator", "token_count": 447 }
3