text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from langchain_community.utilities.google_trends import GoogleTrendsAPIWrapper __all__ = ["GoogleTrendsAPIWrapper"]
langchain/libs/langchain/langchain/utilities/google_trends.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/google_trends.py", "repo_id": "langchain", "token_count": 36 }
572
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/big_models.md/0
{ "file_path": "transformers/docs/source/ko/big_models.md", "repo_id": "transformers", "token_count": 4434 }
525
import { ChatGooglePaLM } from "@langchain/community/chat_models/googlepalm"; import { AIMessage, HumanMessage, SystemMessage, } from "@langchain/core/messages"; export const run = async () => { const model = new ChatGooglePaLM({ apiKey: "<YOUR API KEY>", // or set it in environment variable as `GOOGLE_PAL...
langchainjs/examples/src/models/chat/integration_googlepalm.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/integration_googlepalm.ts", "repo_id": "langchainjs", "token_count": 356 }
800
# 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 applicabl...
trl/trl/trainer/sft_trainer.py/0
{ "file_path": "trl/trl/trainer/sft_trainer.py", "repo_id": "trl", "token_count": 11056 }
889
use super::ConversionError; use crate::{ chroma_proto, errors::{ChromaError, ErrorCodes}, }; use thiserror::Error; #[derive(Debug, PartialEq)] pub(crate) enum ScalarEncoding { FLOAT32, INT32, } #[derive(Error, Debug)] pub(crate) enum ScalarEncodingConversionError { #[error("Invalid encoding, valid...
chroma/rust/worker/src/types/scalar_encoding.rs/0
{ "file_path": "chroma/rust/worker/src/types/scalar_encoding.rs", "repo_id": "chroma", "token_count": 914 }
65
import { insecureHash } from "./utils/hash.js"; import type { Generation, ChatGeneration } from "./outputs.js"; import { type StoredGeneration, mapStoredMessageToChatMessage, } from "./messages/index.js"; /** * This cache key should be consistent across all versions of langchain. * It is currently NOT consistent...
langchainjs/langchain-core/src/caches.ts/0
{ "file_path": "langchainjs/langchain-core/src/caches.ts", "repo_id": "langchainjs", "token_count": 933 }
857
package funcutil import ( "fmt" "strings" "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "go.uber.org/zap" "google.golang.org/protobuf/reflect/protoreflect" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" "github.com/m...
milvus/pkg/util/funcutil/policy.go/0
{ "file_path": "milvus/pkg/util/funcutil/policy.go", "repo_id": "milvus", "token_count": 1404 }
1,933
"""LlamaPack class.""" from typing import Any, Dict, List from llama_index.core import ServiceContext, VectorStoreIndex, set_global_tokenizer from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.prompts import PromptTemplate from llama_index.core.schema import Document from llama_index.ll...
llama_index/llama-index-packs/llama-index-packs-zephyr-query-engine/llama_index/packs/zephyr_query_engine/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-zephyr-query-engine/llama_index/packs/zephyr_query_engine/base.py", "repo_id": "llama_index", "token_count": 1784 }
1,740
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M7 22V11M2 13V20C2 21.1046 2.89543 22 4 22H17.4262C18.907 22 20.1662 20.9197 20.3914 19.4562L21.4683 12.4562C21.7479 10.6389 20.3418 9 18.5032 9H15C14.4477 9 14 8.55228 14 8V4.46584C14 3.10399 12.896 2 11.5342...
langserve/langserve/playground/src/assets/ThumbsUpIcon.svg/0
{ "file_path": "langserve/langserve/playground/src/assets/ThumbsUpIcon.svg", "repo_id": "langserve", "token_count": 269 }
1,048
use super::ConversionError; use crate::{ chroma_proto, errors::{ChromaError, ErrorCodes}, }; use thiserror::Error; #[derive(Debug, PartialEq)] pub(crate) enum SegmentScope { VECTOR, METADATA, } #[derive(Error, Debug)] pub(crate) enum SegmentScopeConversionError { #[error("Invalid segment scope, va...
chroma/rust/worker/src/types/segment_scope.rs/0
{ "file_path": "chroma/rust/worker/src/types/segment_scope.rs", "repo_id": "chroma", "token_count": 932 }
61
# flake8: noqa TOOLKIT_TOOL_DESCRIPTION = """{description}. The tool must be invoked with a complete sentence starting with "{name}" and additional information on {required_params}.""" API_CONTROLLER_PROMPT = """You are turning user input into a json query for an API request tool. The final output to the tool should...
langchain/libs/partners/robocorp/langchain_robocorp/_prompts.py/0
{ "file_path": "langchain/libs/partners/robocorp/langchain_robocorp/_prompts.py", "repo_id": "langchain", "token_count": 186 }
698
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base"; import { type AWSSfnToolkitArgs, AWSSfnToolkit, } from "@langchain/community/agents/toolkits/aws_sfn"; import { renderTemplate } from "@langchain/core/prompts"; import { LLMChain } from "../../chains/llm_chain.js"; import { Zero...
langchainjs/langchain/src/agents/toolkits/aws_sfn.ts/0
{ "file_path": "langchainjs/langchain/src/agents/toolkits/aws_sfn.ts", "repo_id": "langchainjs", "token_count": 650 }
872
[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.mypy] disallow_untyped_defs = true exclude = ["_static", "build", "examples", "notebooks", "venv"] ignore_missi...
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-clickhouse/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-clickhouse/pyproject.toml", "repo_id": "llama_index", "token_count": 626 }
1,477
from __future__ import annotations import asyncio import collections import inspect import threading from abc import ABC, abstractmethod from concurrent.futures import FIRST_COMPLETED, wait from contextvars import copy_context from functools import wraps from itertools import groupby, tee from operator import itemgett...
langchain/libs/core/langchain_core/runnables/base.py/0
{ "file_path": "langchain/libs/core/langchain_core/runnables/base.py", "repo_id": "langchain", "token_count": 80220 }
396
<jupyter_start><jupyter_text>MosaicML[MosaicML](https://docs.mosaicml.com/en/latest/inference.html) offers a managed inference service. You can either use a variety of open-source models, or deploy your own.This example goes over how to use LangChain to interact with MosaicML Inference for text completion.<jupyter_code...
langchain/docs/docs/integrations/llms/mosaicml.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/mosaicml.ipynb", "repo_id": "langchain", "token_count": 338 }
128
<jupyter_start><jupyter_code>! pip install langchain_community tiktoken langchain-openai langchainhub chromadb langchain langgraph<jupyter_output><empty_output><jupyter_text>LangGraph Retrieval AgentWe can implement [Retrieval Agents](https://python.langchain.com/docs/use_cases/question_answering/conversational_retriev...
langgraph/examples/rag/langgraph_agentic_rag.ipynb/0
{ "file_path": "langgraph/examples/rag/langgraph_agentic_rag.ipynb", "repo_id": "langgraph", "token_count": 3679 }
1,035
// 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/msgdispatcher/mock_test.go/0
{ "file_path": "milvus/pkg/mq/msgdispatcher/mock_test.go", "repo_id": "milvus", "token_count": 2656 }
1,954
import { Document } from "@langchain/core/documents"; import { BaseDocumentLoader } from "../base.js"; /** * See https://docs.sort.xyz/docs/api-keys to get your free Sort API key. * See https://docs.sort.xyz for more information on the available queries. * See https://docs.sort.xyz/reference for more information ab...
langchainjs/langchain/src/document_loaders/web/sort_xyz_blockchain.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/web/sort_xyz_blockchain.ts", "repo_id": "langchainjs", "token_count": 1925 }
886
import { type ClientOptions } from "openai"; import { type BaseChatModelParams } from "@langchain/core/language_models/chat_models"; import { ChatOpenAI } from "../chat_models.js"; import { AzureOpenAIInput, LegacyOpenAIInput, OpenAIChatInput, } from "../types.js"; export class AzureChatOpenAI extends ChatOpenAI...
langchainjs/libs/langchain-openai/src/azure/chat_models.ts/0
{ "file_path": "langchainjs/libs/langchain-openai/src/azure/chat_models.ts", "repo_id": "langchainjs", "token_count": 849 }
1,063
# coding=utf-8 # Copyright 2022 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/deta/convert_deta_resnet_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/deta/convert_deta_resnet_to_pytorch.py", "repo_id": "transformers", "token_count": 7808 }
593
# Metric Card for ROC AUC ## Metric Description This metric computes the area under the curve (AUC) for the Receiver Operating Characteristic Curve (ROC). The return values represent how well the model used is predicting the correct classes, based on the input data. A score of `0.5` means that the model is predicting...
datasets/metrics/roc_auc/README.md/0
{ "file_path": "datasets/metrics/roc_auc/README.md", "repo_id": "datasets", "token_count": 3273 }
143
"""Main entrypoint into package.""" from importlib import metadata try: __version__ = metadata.version(__package__) except metadata.PackageNotFoundError: # Case where package metadata is not available. __version__ = ""
langchain/libs/partners/together/langchain_together/version.py/0
{ "file_path": "langchain/libs/partners/together/langchain_together/version.py", "repo_id": "langchain", "token_count": 66 }
681
"""A chain for comparing the output of two models using embeddings.""" from enum import Enum from typing import Any, Dict, List, Optional import numpy as np from langchain_community.embeddings.openai import OpenAIEmbeddings from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import Field, ...
langchain/libs/langchain/langchain/evaluation/embedding_distance/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/evaluation/embedding_distance/base.py", "repo_id": "langchain", "token_count": 6777 }
511
[ { "server": "idc-sh003", "suite_params": [ { "suite": "2_insert_search.yaml", "image_type": "cpu" } ] } ]
milvus/tests/benchmark/milvus_benchmark/scheduler/search.json/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/scheduler/search.json", "repo_id": "milvus", "token_count": 136 }
1,965
# TODO: implement tests for delete
langchain/libs/community/tests/integration_tests/vectorstores/qdrant/test_delete.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/qdrant/test_delete.py", "repo_id": "langchain", "token_count": 9 }
357
"""Base callback handler that can be used to handle callbacks in langchain.""" from __future__ import annotations from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, TypeVar, Union from uuid import UUID from tenacity import RetryCallState if TYPE_CHECKING: from langchain_core.agents import Age...
langchain/libs/core/langchain_core/callbacks/base.py/0
{ "file_path": "langchain/libs/core/langchain_core/callbacks/base.py", "repo_id": "langchain", "token_count": 8308 }
387
// 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/src/storage/PayloadStream.cpp/0
{ "file_path": "milvus/internal/core/src/storage/PayloadStream.cpp", "repo_id": "milvus", "token_count": 1103 }
1,893
<jupyter_start><jupyter_text>Label Studio>[Label Studio](https://labelstud.io/guide/get_started) is an open-source data labeling platform that provides LangChain with flexibility when it comes to labeling data for fine-tuning large language models (LLMs). It also enables the preparation of custom training data and the ...
langchain/docs/docs/integrations/callbacks/labelstudio.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/callbacks/labelstudio.ipynb", "repo_id": "langchain", "token_count": 1738 }
93
"""Amadeus tools.""" from langchain_community.tools.amadeus.closest_airport import AmadeusClosestAirport from langchain_community.tools.amadeus.flight_search import AmadeusFlightSearch __all__ = [ "AmadeusClosestAirport", "AmadeusFlightSearch", ]
langchain/libs/community/langchain_community/tools/amadeus/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/amadeus/__init__.py", "repo_id": "langchain", "token_count": 93 }
301
/* * 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...
milvus/pkg/util/expr/expr_test.go/0
{ "file_path": "milvus/pkg/util/expr/expr_test.go", "repo_id": "milvus", "token_count": 587 }
2,104
[package] name = "grpc-metadata" version = "0.1.0" edition = "2021" [dependencies] opentelemetry = "^0.20" tonic = "^0.10" tracing = "^0.1" tracing-opentelemetry = "^0.21"
text-generation-inference/router/grpc-metadata/Cargo.toml/0
{ "file_path": "text-generation-inference/router/grpc-metadata/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 83 }
404
- name: datacoord docker_container: name: datacoord image: "{{image}}" command: ["milvus", "run", "datacoord"] env: ETCD_ENDPOINTS: "{{ETCD_ENDPOINTS}}" MINIO_ADDRESS: "{{MINIO_ADDRESS}}" PULSAR_ADDRESS: "{{PULSAR_ADDRESS}}" DATA_COORD_ADDRESS: "{{DATA_COORD_ADDRESS}}" M...
milvus/deployments/docker/cluster-distributed-deployment/roles/deploy-datacoord/tasks/main.yml/0
{ "file_path": "milvus/deployments/docker/cluster-distributed-deployment/roles/deploy-datacoord/tasks/main.yml", "repo_id": "milvus", "token_count": 205 }
1,728
"""NebulaGraph graph store index.""" import logging import os from string import Template from typing import Any, Dict, List, Optional from llama_index.core.graph_stores.types import GraphStore from nebula3.common import ttypes from nebula3.Config import SessionPoolConfig from nebula3.Exception import IOErrorExceptio...
llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-nebula/llama_index/graph_stores/nebula/base.py/0
{ "file_path": "llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-nebula/llama_index/graph_stores/nebula/base.py", "repo_id": "llama_index", "token_count": 12859 }
1,292
const file2base64 = (file: File): Promise<string> => { return new Promise<string>((resolve, reject) => { const reader = new FileReader(); reader.readAsDataURL(file); reader.onload = () => { const dataUrl = reader.result as string; const base64 = dataUrl.split(",")[1]; resolve(base64); }; reader.oner...
chat-ui/src/lib/utils/file2base64.ts/0
{ "file_path": "chat-ui/src/lib/utils/file2base64.ts", "repo_id": "chat-ui", "token_count": 142 }
95
""" Gather-Excite Attention Block Paper: `Gather-Excite: Exploiting Feature Context in CNNs` - https://arxiv.org/abs/1810.12348 Official code here, but it's only partial impl in Caffe: https://github.com/hujie-frank/GENet I've tried to support all of the extent both w/ and w/o params. I don't believe I've seen anoth...
pytorch-image-models/timm/layers/gather_excite.py/0
{ "file_path": "pytorch-image-models/timm/layers/gather_excite.py", "repo_id": "pytorch-image-models", "token_count": 1956 }
364
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "retrievers/supabase", }); export * from "@langchain/community/retrievers/supabase";
langchainjs/langchain/src/retrievers/supabase.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/supabase.ts", "repo_id": "langchainjs", "token_count": 74 }
906
import { ChatOpenAI } from "@langchain/openai"; import { ChatPromptTemplate, MessagesPlaceholder, } from "@langchain/core/prompts"; import { RunnableConfig, RunnableWithMessageHistory, } from "@langchain/core/runnables"; import { ChatMessageHistory } from "@langchain/community/stores/message/in_memory"; // Ins...
langchainjs/examples/src/guides/expression_language/runnable_history.ts/0
{ "file_path": "langchainjs/examples/src/guides/expression_language/runnable_history.ts", "repo_id": "langchainjs", "token_count": 793 }
779
from llama_index.core.readers.base import BaseReader from llama_index.readers.feedly_rss import FeedlyRssReader def test_class(): names_of_base_classes = [b.__name__ for b in FeedlyRssReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-feedly-rss/tests/test_readers_feedly_rss.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-feedly-rss/tests/test_readers_feedly_rss.py", "repo_id": "llama_index", "token_count": 94 }
1,290
apiVersion: chaos-mesh.org/v1alpha1 kind: PodChaos metadata: name: test-querycoord-pod-failure namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: app.kubernetes.io/instance: milvus-chaos component: querycoord mode: fixed value: "1" action: pod-fail...
milvus/tests/python_client/chaos/chaos_objects/pod_failure/chaos_querycoord_pod_failure.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/pod_failure/chaos_querycoord_pod_failure.yaml", "repo_id": "milvus", "token_count": 141 }
2,169
from langchain_community.document_loaders.spreedly import ( SpreedlyLoader, ) __all__ = ["SpreedlyLoader"]
langchain/libs/langchain/langchain/document_loaders/spreedly.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/spreedly.py", "repo_id": "langchain", "token_count": 40 }
525
python_tests()
llama_index/llama-index-integrations/indices/llama-index-indices-managed-vectara/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-vectara/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,213
python_sources()
llama_index/llama-index-core/llama_index/core/indices/query/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/query/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,181
<jupyter_start><jupyter_text>Hugging FaceThis notebook shows how to get started using `Hugging Face` LLM's as chat models.In particular, we will:1. Utilize the [HuggingFaceTextGenInference](https://github.com/langchain-ai/langchain/blob/master/libs/langchain/langchain/llms/huggingface_text_gen_inference.py), [HuggingFa...
langchain/docs/docs/integrations/chat/huggingface.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/chat/huggingface.ipynb", "repo_id": "langchain", "token_count": 2887 }
100
import type { TextGenerationStreamOutput } from "@huggingface/inference"; import type OpenAI from "openai"; import type { Stream } from "openai/streaming"; /** * Transform a stream of OpenAI.Completions.Completion into a stream of TextGenerationStreamOutput */ export async function* openAICompletionToTextGenerationS...
chat-ui/src/lib/server/endpoints/openai/openAICompletionToTextGenerationStream.ts/0
{ "file_path": "chat-ui/src/lib/server/endpoints/openai/openAICompletionToTextGenerationStream.ts", "repo_id": "chat-ui", "token_count": 310 }
106
"""**Callback handlers** allow listening to events in LangChain. **Class hierarchy:** .. code-block:: BaseCallbackHandler --> <name>CallbackHandler # Example: AimCallbackHandler """ from langchain_community.callbacks.aim_callback import AimCallbackHandler from langchain_community.callbacks.argilla_callback imp...
langchain/libs/community/langchain_community/callbacks/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/callbacks/__init__.py", "repo_id": "langchain", "token_count": 768 }
229
# Optimizing inference perf_infer_gpu_many: perf_infer_gpu_one
transformers/docs/source/en/_redirects.yml/0
{ "file_path": "transformers/docs/source/en/_redirects.yml", "repo_id": "transformers", "token_count": 25 }
494
from .base_tokenizer import BaseTokenizer from .bert_wordpiece import BertWordPieceTokenizer from .byte_level_bpe import ByteLevelBPETokenizer from .char_level_bpe import CharBPETokenizer from .sentencepiece_bpe import SentencePieceBPETokenizer from .sentencepiece_unigram import SentencePieceUnigramTokenizer
tokenizers/bindings/python/py_src/tokenizers/implementations/__init__.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/__init__.py", "repo_id": "tokenizers", "token_count": 94 }
446
import json from typing import Any, Callable, List from langchain_core.tracers.base import BaseTracer from langchain_core.tracers.schemas import Run from langchain_core.utils.input import get_bolded_text, get_colored_text def try_json_stringify(obj: Any, fallback: str) -> str: """ Try to stringify an object ...
langchain/libs/core/langchain_core/tracers/stdout.py/0
{ "file_path": "langchain/libs/core/langchain_core/tracers/stdout.py", "repo_id": "langchain", "token_count": 2952 }
432
# 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/deta/__init__.py/0
{ "file_path": "transformers/src/transformers/models/deta/__init__.py", "repo_id": "transformers", "token_count": 822 }
622
--- sidebar_position: 0 --- # Custom agent This notebook goes through how to create your own custom agent. In this example, we will use OpenAI Function Calling to create this agent. **This is generally the most reliable way to create agents.** We will first create it WITHOUT memory, but we will then show how to add...
langchainjs/docs/core_docs/docs/modules/agents/how_to/custom_agent.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/agents/how_to/custom_agent.mdx", "repo_id": "langchainjs", "token_count": 2306 }
734
import { initializeAgentExecutorWithOptions } from "langchain/agents"; import { OpenAI } from "@langchain/openai"; import { Calculator } from "langchain/tools/calculator"; import { SerpAPI } from "@langchain/community/tools/serpapi"; const model = new OpenAI({ temperature: 0 }); const tools = [ new SerpAPI(process.e...
langchainjs/examples/src/agents/agent_callbacks.ts/0
{ "file_path": "langchainjs/examples/src/agents/agent_callbacks.ts", "repo_id": "langchainjs", "token_count": 1050 }
765
# Chat Engine ## Concept Chat engine is a high-level interface for having a conversation with your data (multiple back-and-forth instead of a single question & answer). Think ChatGPT, but augmented with your knowledge base. Conceptually, it is a **stateful** analogy of a [Query Engine](../query_engine/root.md). By k...
llama_index/docs/module_guides/deploying/chat_engines/root.md/0
{ "file_path": "llama_index/docs/module_guides/deploying/chat_engines/root.md", "repo_id": "llama_index", "token_count": 340 }
1,118
# CerebriumAI This page covers how to use the CerebriumAI ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific CerebriumAI wrappers. ## Installation and Setup - Install with `pip install cerebrium` - Get an CerebriumAI api key and set it as an environment va...
langchain/docs/docs/integrations/providers/cerebriumai.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/cerebriumai.mdx", "repo_id": "langchain", "token_count": 147 }
131
--- hide_table_of_contents: true --- # College Confidential This example goes over how to load data from the college confidential website, using Cheerio. One document will be created for each page. ## Setup ```bash npm2yarn npm install cheerio ``` ## Usage ```typescript import { CollegeConfidentialLoader } from "...
langchainjs/docs/core_docs/docs/integrations/document_loaders/web_loaders/college_confidential.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/document_loaders/web_loaders/college_confidential.mdx", "repo_id": "langchainjs", "token_count": 157 }
703
from overrides import EnforceOverrides, override from typing import List, Optional, Sequence from chromadb.config import System from chromadb.proto.convert import ( from_proto_vector_embedding_record, from_proto_vector_query_result, to_proto_vector, ) from chromadb.segment import VectorReader from chromadb....
chroma/chromadb/segment/impl/vector/grpc_segment.py/0
{ "file_path": "chroma/chromadb/segment/impl/vector/grpc_segment.py", "repo_id": "chroma", "token_count": 1473 }
19
# 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/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py/0
{ "file_path": "transformers/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py", "repo_id": "transformers", "token_count": 89454 }
740
"""Test parsing logic.""" import mimetypes from langchain.document_loaders import Blob from app.parsing import MIMETYPE_BASED_PARSER, SUPPORTED_MIMETYPES from tests.unit_tests.fixtures import get_sample_paths def test_list_of_supported_mimetypes() -> None: """This list should generally grow! Protecting against ...
opengpts/backend/tests/unit_tests/agent_executor/test_parsing.py/0
{ "file_path": "opengpts/backend/tests/unit_tests/agent_executor/test_parsing.py", "repo_id": "opengpts", "token_count": 599 }
1,987
from llama_index.llms.sagemaker_endpoint.base import SageMakerLLM __all__ = ["SageMakerLLM"]
llama_index/llama-index-integrations/llms/llama-index-llms-sagemaker-endpoint/llama_index/llms/sagemaker_endpoint/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-sagemaker-endpoint/llama_index/llms/sagemaker_endpoint/__init__.py", "repo_id": "llama_index", "token_count": 36 }
1,247
# Inception v4 **Inception-v4** is a convolutional neural network architecture that builds on previous iterations of the Inception family by simplifying the architecture and using more inception modules than [Inception-v3](https://paperswithcode.com/method/inception-v3). ## How do I use this model on an image? To load...
pytorch-image-models/docs/models/inception-v4.md/0
{ "file_path": "pytorch-image-models/docs/models/inception-v4.md", "repo_id": "pytorch-image-models", "token_count": 1622 }
369
# coding=utf-8 # Copyright 2022 {{cookiecutter.authors}}. 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 re...
transformers/templates/adding_a_missing_tokenization_test/cookiecutter-template-{{cookiecutter.modelname}}/test_tokenization_{{cookiecutter.lowercase_modelname}}.py/0
{ "file_path": "transformers/templates/adding_a_missing_tokenization_test/cookiecutter-template-{{cookiecutter.modelname}}/test_tokenization_{{cookiecutter.lowercase_modelname}}.py", "repo_id": "transformers", "token_count": 1016 }
738
// 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/mock/grpc_querycoord_client.go/0
{ "file_path": "milvus/internal/util/mock/grpc_querycoord_client.go", "repo_id": "milvus", "token_count": 2312 }
1,801
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/proxy/channels_mgr_test.go/0
{ "file_path": "milvus/internal/proxy/channels_mgr_test.go", "repo_id": "milvus", "token_count": 5273 }
1,735
from llama_index.readers.wordpress.base import WordpressReader __all__ = ["WordpressReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-wordpress/llama_index/readers/wordpress/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-wordpress/llama_index/readers/wordpress/__init__.py", "repo_id": "llama_index", "token_count": 28 }
1,451
python_sources() python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/indices/keyword_table/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/keyword_table/BUILD", "repo_id": "llama_index", "token_count": 32 }
1,797
# 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/tests/others/test_dependencies.py/0
{ "file_path": "diffusers/tests/others/test_dependencies.py", "repo_id": "diffusers", "token_count": 775 }
248
"""Test logic on base chain class.""" from typing import Any, Dict, List, Optional import pytest from langchain_core.memory import BaseMemory from langchain.callbacks.manager import CallbackManagerForChainRun from langchain.chains.base import Chain from langchain.schema import RUN_KEY from tests.unit_tests.callbacks....
langchain/libs/langchain/tests/unit_tests/chains/test_base.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/chains/test_base.py", "repo_id": "langchain", "token_count": 2033 }
650
import os import torch from accelerate import Accelerator from datasets import load_dataset from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, default_data_collator, get_linear_schedule_with_warmup from peft import LoraConfig, TaskType, get_pef...
peft/examples/conditional_generation/peft_lora_seq2seq_accelerate_fsdp.py/0
{ "file_path": "peft/examples/conditional_generation/peft_lora_seq2seq_accelerate_fsdp.py", "repo_id": "peft", "token_count": 2543 }
337
from langchain_community.vectorstores.alibabacloud_opensearch import ( AlibabaCloudOpenSearch, AlibabaCloudOpenSearchSettings, ) __all__ = [ "AlibabaCloudOpenSearchSettings", "AlibabaCloudOpenSearch", ]
langchain/libs/langchain/langchain/vectorstores/alibabacloud_opensearch.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/alibabacloud_opensearch.py", "repo_id": "langchain", "token_count": 74 }
624
<jupyter_start><jupyter_text>OpenAI metadata taggerIt can often be useful to tag ingested documents with structured metadata, such as the title, tone, or length of a document, to allow for a more targeted similarity search later. However, for large numbers of documents, performing this labelling process manually can be...
langchain/docs/docs/integrations/document_transformers/openai_metadata_tagger.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_transformers/openai_metadata_tagger.ipynb", "repo_id": "langchain", "token_count": 1617 }
114
# coding=utf-8 # Copyright 2021 Microsoft Research and the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
transformers/src/transformers/models/beit/modeling_flax_beit.py/0
{ "file_path": "transformers/src/transformers/models/beit/modeling_flax_beit.py", "repo_id": "transformers", "token_count": 15754 }
572
<jupyter_start><jupyter_text>Yuan2.0[Yuan2.0](https://github.com/IEIT-Yuan/Yuan-2.0) is a new generation Fundamental Large Language Model developed by IEIT System. We have published all three models, Yuan 2.0-102B, Yuan 2.0-51B, and Yuan 2.0-2B. And we provide relevant scripts for pretraining, fine-tuning, and inferenc...
langchain/docs/docs/integrations/llms/yuan2.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/yuan2.ipynb", "repo_id": "langchain", "token_count": 560 }
134
from llama_index.readers.docugami.base import DocugamiReader __all__ = ["DocugamiReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-docugami/llama_index/readers/docugami/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-docugami/llama_index/readers/docugami/__init__.py", "repo_id": "llama_index", "token_count": 32 }
1,427
import logging import platform import warnings from typing import Any, List, Optional, Type, Union from langchain_core.callbacks import ( CallbackManagerForToolRun, ) from langchain_core.pydantic_v1 import BaseModel, Field, root_validator from langchain_core.tools import BaseTool logger = logging.getLogger(__name...
langchain/libs/community/langchain_community/tools/shell/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/shell/tool.py", "repo_id": "langchain", "token_count": 1242 }
308
""" coding=utf-8 Copyright 2018, Antonio Mendoza Hao Tan, Mohit Bansal, Huggingface team :) Adapted From Facebook Inc, Detectron2 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://w...
transformers/examples/research_projects/visual_bert/utils.py/0
{ "file_path": "transformers/examples/research_projects/visual_bert/utils.py", "repo_id": "transformers", "token_count": 8356 }
577
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/pipelines/test_pipelines_fill_mask.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_fill_mask.py", "repo_id": "transformers", "token_count": 9728 }
784
# Stable Diffusion text-to-image fine-tuning The `train_text_to_image.py` script shows how to fine-tune stable diffusion model on your own dataset. ___Note___: ___This script is experimental. The script fine-tunes the whole model and often times the model overfits and runs into issues like catastrophic forgetting. I...
diffusers/examples/research_projects/onnxruntime/text_to_image/README.md/0
{ "file_path": "diffusers/examples/research_projects/onnxruntime/text_to_image/README.md", "repo_id": "diffusers", "token_count": 847 }
222
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University 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://ww...
transformers/src/transformers/models/xlm_roberta/tokenization_xlm_roberta.py/0
{ "file_path": "transformers/src/transformers/models/xlm_roberta/tokenization_xlm_roberta.py", "repo_id": "transformers", "token_count": 6160 }
721
""" Scheduler Factory Hacked together by / Copyright 2021 Ross Wightman """ from typing import List, Optional, Union from torch.optim import Optimizer from .cosine_lr import CosineLRScheduler from .multistep_lr import MultiStepLRScheduler from .plateau_lr import PlateauLRScheduler from .poly_lr import PolyLRScheduler...
pytorch-image-models/timm/scheduler/scheduler_factory.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/scheduler_factory.py", "repo_id": "pytorch-image-models", "token_count": 3467 }
383
<jupyter_start><jupyter_text>Vanna AI LlamaPackVanna AI is an open-source RAG framework for SQL generation. It works in two steps:1. Train a RAG model on your data2. Ask questions (use reference corpus to generate SQL queries that can run on your db).Check out the [Github project](https://github.com/vanna-ai/vanna) and...
llama_index/llama-index-packs/llama-index-packs-vanna/examples/vanna.ipynb/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-vanna/examples/vanna.ipynb", "repo_id": "llama_index", "token_count": 440 }
1,694
Transform Query Engine ======================= .. automodule:: llama_index.core.query_engine.transform_query_engine :members: :inherited-members:
llama_index/docs/api_reference/query/query_engines/transform_query_engine.rst/0
{ "file_path": "llama_index/docs/api_reference/query/query_engines/transform_query_engine.rst", "repo_id": "llama_index", "token_count": 47 }
1,034
"""Test WatsonxLLM API wrapper. You'll need to set WATSONX_APIKEY and WATSONX_PROJECT_ID environment variables. """ import os from langchain_core.outputs import LLMResult from langchain_ibm import WatsonxLLM PROJECT_ID = os.environ.get("WATSONX_PROJECT_ID", "") def test_watsonxllm_invoke() -> None: watsonxll...
langchain/libs/partners/ibm/tests/integration_tests/test_llms.py/0
{ "file_path": "langchain/libs/partners/ibm/tests/integration_tests/test_llms.py", "repo_id": "langchain", "token_count": 1046 }
630
// Code generated by mockery v2.32.4. DO NOT EDIT. package syncmgr import ( context "context" conc "github.com/milvus-io/milvus/pkg/util/conc" mock "github.com/stretchr/testify/mock" msgpb "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" ) // MockSyncManager is an autogenerated mock type for the SyncManage...
milvus/internal/datanode/syncmgr/mock_sync_manager.go/0
{ "file_path": "milvus/internal/datanode/syncmgr/mock_sync_manager.go", "repo_id": "milvus", "token_count": 2276 }
1,791
# (Automatic) Curriculum Learning for RL While most of the RL methods seen in this course work well in practice, there are some cases where using them alone fails. This can happen, for instance, when: - the task to learn is hard and requires an **incremental acquisition of skills** (for instance when one wants to mak...
deep-rl-class/units/en/unitbonus3/curriculum-learning.mdx/0
{ "file_path": "deep-rl-class/units/en/unitbonus3/curriculum-learning.mdx", "repo_id": "deep-rl-class", "token_count": 1058 }
173
from typing import List from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.core.node_parser.text.semantic_splitter import ( SemanticSplitterNodeParser, ) from llama_index.core.schema import Document class MockEmbedding(BaseEmbedding): @classmethod def class_name(cls) -> str:...
llama_index/llama-index-core/tests/node_parser/test_semantic_splitter.py/0
{ "file_path": "llama_index/llama-index-core/tests/node_parser/test_semantic_splitter.py", "repo_id": "llama_index", "token_count": 1822 }
1,195
from langchain_community.llms.modal import Modal __all__ = ["Modal"]
langchain/libs/langchain/langchain/llms/modal.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/modal.py", "repo_id": "langchain", "token_count": 25 }
563
from langchain_core.documents import Document from langchain_community.docstore.arbitrary_fn import DocstoreFn def test_document_found() -> None: # we use a dict here for simiplicity, but this could be any function # including a remote lookup dummy_dict = {"foo": Document(page_content="bar")} docstor...
langchain/libs/community/tests/unit_tests/docstore/test_arbitrary_fn.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/docstore/test_arbitrary_fn.py", "repo_id": "langchain", "token_count": 154 }
401
# 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/xglm/test_modeling_xglm.py/0
{ "file_path": "transformers/tests/models/xglm/test_modeling_xglm.py", "repo_id": "transformers", "token_count": 9446 }
758
# LlamaIndex Llms Integration: Konko
llama_index/llama-index-integrations/llms/llama-index-llms-konko/README.md/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-konko/README.md", "repo_id": "llama_index", "token_count": 11 }
1,298
import type { LayoutServerLoad } from "./$types"; import { collections } from "$lib/server/database"; import type { Conversation } from "$lib/types/Conversation"; import { UrlDependency } from "$lib/types/UrlDependency"; import { defaultModel, models, oldModels, validateModel } from "$lib/server/models"; import { authC...
chat-ui/src/routes/+layout.server.ts/0
{ "file_path": "chat-ui/src/routes/+layout.server.ts", "repo_id": "chat-ui", "token_count": 2036 }
108
.PHONY: all clean docs_build docs_clean docs_linkcheck api_docs_build api_docs_clean api_docs_linkcheck format lint test tests test_watch integration_tests docker_tests help extended_tests # Default target executed when no arguments are given to make. all: help ###################### # TESTING AND COVERAGE ##########...
langchain/libs/langchain/Makefile/0
{ "file_path": "langchain/libs/langchain/Makefile", "repo_id": "langchain", "token_count": 1615 }
431
<jupyter_start><jupyter_text>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 OLA...
langchain/docs/docs/integrations/vectorstores/starrocks.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/starrocks.ipynb", "repo_id": "langchain", "token_count": 1375 }
195
//! # Template Processing //! //! Provides a way to specify templates in order to add the special tokens to each //! input sequence as relevant. //! //! ## Example //! //! Let's take `BERT` tokenizer as an example. It uses two special tokens, used to //! delimitate each sequence. `[CLS]` is always used at the beginning...
tokenizers/tokenizers/src/processors/template.rs/0
{ "file_path": "tokenizers/tokenizers/src/processors/template.rs", "repo_id": "tokenizers", "token_count": 21195 }
440
import { writable } from "svelte/store"; export const isAborted = writable<boolean>(false);
chat-ui/src/lib/stores/isAborted.ts/0
{ "file_path": "chat-ui/src/lib/stores/isAborted.ts", "repo_id": "chat-ui", "token_count": 30 }
99
# Xorbits Inference (Xinference) This page demonstrates how to use [Xinference](https://github.com/xorbitsai/inference) with LangChain. `Xinference` is a powerful and versatile library designed to serve LLMs, speech recognition models, and multimodal models, even on your laptop. With Xorbits Inference, you can effo...
langchain/docs/docs/integrations/providers/xinference.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/xinference.mdx", "repo_id": "langchain", "token_count": 772 }
165
from __future__ import annotations import logging from typing import Any, Callable, Dict, List, Optional from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models.llms import LLM from langchain_core.load.serializable import Serializab...
langchain/libs/community/langchain_community/llms/cohere.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/cohere.py", "repo_id": "langchain", "token_count": 3252 }
276
--- sidebar_position: 2 sidebar_label: Puppeteer hide_table_of_contents: true sidebar_class_name: node-only --- # Webpages, with Puppeteer :::tip Compatibility Only available on Node.js. ::: This example goes over how to load data from webpages using Puppeteer. One document will be created for each webpage. Puppete...
langchainjs/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.mdx", "repo_id": "langchainjs", "token_count": 841 }
736
from llama_index.core.node_parser.text.code import CodeSplitter from llama_index.core.node_parser.text.langchain import LangchainNodeParser from llama_index.core.node_parser.text.semantic_splitter import ( SemanticSplitterNodeParser, ) from llama_index.core.node_parser.text.sentence import SentenceSplitter from lla...
llama_index/llama-index-core/llama_index/core/node_parser/text/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/node_parser/text/__init__.py", "repo_id": "llama_index", "token_count": 225 }
1,202
# Deprecated Pipelines This folder contains pipelines that have very low usage as measured by model downloads, issues and PRs. While you can still use the pipelines just as before, we will stop testing the pipelines and will not accept any changes to existing files.
diffusers/src/diffusers/pipelines/deprecated/README.md/0
{ "file_path": "diffusers/src/diffusers/pipelines/deprecated/README.md", "repo_id": "diffusers", "token_count": 54 }
254
// 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/querycoordv2/dist/dist_controller.go/0
{ "file_path": "milvus/internal/querycoordv2/dist/dist_controller.go", "repo_id": "milvus", "token_count": 1104 }
1,828
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-database/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-database/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,477