text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/unittest/test_exec.cpp/0
{ "file_path": "milvus/internal/core/unittest/test_exec.cpp", "repo_id": "milvus", "token_count": 7095 }
1,755
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-exa/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-exa/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,566
# FBNet **FBNet** is a type of convolutional neural architectures discovered through [DNAS](https://paperswithcode.com/method/dnas) neural architecture search. It utilises a basic type of image model block inspired by [MobileNetv2](https://paperswithcode.com/method/mobilenetv2) that utilises depthwise convolutions and...
pytorch-image-models/hfdocs/source/models/fbnet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/fbnet.mdx", "repo_id": "pytorch-image-models", "token_count": 1705 }
377
ann_accuracy: collections: - server: cache_config.cpu_cache_capacity: 16 engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: false gpu_resource_config.cache_capacity: 4 gpu_resource_config.search_resources:...
milvus/tests/benchmark/milvus_benchmark/suites/pq.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/pq.yaml", "repo_id": "milvus", "token_count": 404 }
1,955
"""HuggingFace sentence_transformer embedding models.""" from langchain_community.embeddings.huggingface import HuggingFaceEmbeddings SentenceTransformerEmbeddings = HuggingFaceEmbeddings
langchain/libs/community/langchain_community/embeddings/sentence_transformer.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/sentence_transformer.py", "repo_id": "langchain", "token_count": 52 }
279
# 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/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py/0
{ "file_path": "transformers/src/transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py", "repo_id": "transformers", "token_count": 4205 }
569
from __future__ import annotations from typing import List, Optional from langchain import hub from langchain.callbacks.tracers.evaluation import EvaluatorCallbackHandler from langchain.callbacks.tracers.schemas import Run from langchain.output_parsers.openai_functions import JsonOutputFunctionsParser from langchain....
langchain/templates/chat-bot-feedback/chat_bot_feedback/chain.py/0
{ "file_path": "langchain/templates/chat-bot-feedback/chat_bot_feedback/chain.py", "repo_id": "langchain", "token_count": 2224 }
639
"""Init file."""
llama_index/llama-index-integrations/readers/llama-index-readers-opendal/llama_index/readers/opendal/azblob/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-opendal/llama_index/readers/opendal/azblob/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,409
//load the candle Whisper decoder wasm module import init, { Decoder } from "./build/m.js"; async function fetchArrayBuffer(url) { const cacheName = "whisper-candle-cache"; const cache = await caches.open(cacheName); const cachedResponse = await cache.match(url); if (cachedResponse) { const data = await ca...
candle/candle-wasm-examples/whisper/whisperWorker.js/0
{ "file_path": "candle/candle-wasm-examples/whisper/whisperWorker.js", "repo_id": "candle", "token_count": 1215 }
85
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use candle_transformers::models::distilbert::{Config, DistilBertModel, DTYPE}; use anyhow::{Error as E, Result}; use candle::{Device, Tensor}; use candle_nn::VarBuilder; use clap::Parser; use hf_hub::{api::...
candle/candle-examples/examples/distilbert/main.rs/0
{ "file_path": "candle/candle-examples/examples/distilbert/main.rs", "repo_id": "candle", "token_count": 1939 }
43
<jupyter_start><jupyter_text>GigaChatThis notebook shows how to use LangChain with [GigaChat](https://developers.sber.ru/portal/products/gigachat).To use you need to install ```gigachat``` python package.<jupyter_code>%pip install --upgrade --quiet gigachat<jupyter_output><empty_output><jupyter_text>To get GigaChat cr...
langchain/docs/docs/integrations/chat/gigachat.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/chat/gigachat.ipynb", "repo_id": "langchain", "token_count": 349 }
93
label: "How-to" position: 2
langchainjs/docs/core_docs/docs/modules/agents/tools/how_to/_category_.yml/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/agents/tools/how_to/_category_.yml", "repo_id": "langchainjs", "token_count": 12 }
781
from llama_index.core.command_line.new_package.templates.pyproject import pyproject_str from llama_index.core.command_line.new_package.templates.readme import readme_str from llama_index.core.command_line.new_package.templates.init import ( init_str, init_with_prefix_str, ) __all__ = ["pyproject_str", "readme_...
llama_index/llama-index-core/llama_index/core/command_line/new_package/templates/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/command_line/new_package/templates/__init__.py", "repo_id": "llama_index", "token_count": 131 }
1,140
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-rungpt/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-rungpt/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,246
# backward compatibility from llama_index.core.text_splitter import *
llama_index/llama-index-core/llama_index/core/langchain_helpers/text_splitter.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/langchain_helpers/text_splitter.py", "repo_id": "llama_index", "token_count": 19 }
1,129
<code_scheme name="milvus" version="173"> <Objective-C> <option name="INDENT_NAMESPACE_MEMBERS" value="0" /> <option name="INDENT_VISIBILITY_KEYWORDS" value="1" /> <option name="KEEP_STRUCTURES_IN_ONE_LINE" value="true" /> <option name="KEEP_CASE_EXPRESSIONS_IN_ONE_LINE" value="true" /> <option na...
milvus/internal/core/build-support/code_style_clion.xml/0
{ "file_path": "milvus/internal/core/build-support/code_style_clion.xml", "repo_id": "milvus", "token_count": 898 }
1,775
## Amused training Amused can be finetuned on simple datasets relatively cheaply and quickly. Using 8bit optimizers, lora, and gradient accumulation, amused can be finetuned with as little as 5.5 GB. Here are a set of examples for finetuning amused on some relatively simple datasets. These training recipies are aggres...
diffusers/examples/amused/README.md/0
{ "file_path": "diffusers/examples/amused/README.md", "repo_id": "diffusers", "token_count": 5921 }
206
import json from langchain_core.language_models.base import LanguageModelLike from langchain_core.messages import AIMessage, HumanMessage, SystemMessage from langchain_core.prompts import PromptTemplate from langchain_core.retrievers import BaseRetriever from langchain_core.runnables import chain from langgraph.checkp...
opengpts/backend/app/retrieval.py/0
{ "file_path": "opengpts/backend/app/retrieval.py", "repo_id": "opengpts", "token_count": 1708 }
2,199
"""Test Graph Database Chain.""" import os from langchain_community.graphs import Neo4jGraph from langchain_community.llms.openai import OpenAI from langchain.chains.graph_qa.cypher import GraphCypherQAChain from langchain.chains.loading import load_chain def test_connect_neo4j() -> None: """Test that Neo4j dat...
langchain/libs/langchain/tests/integration_tests/chains/test_graph_database.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/chains/test_graph_database.py", "repo_id": "langchain", "token_count": 4150 }
614
from typing import List from langchain_core.callbacks import CallbackManagerForRetrieverRun from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever from langchain_community.utilities.outline import OutlineAPIWrapper class OutlineRetriever(BaseRetriever, OutlineAPIWrapper): ...
langchain/libs/community/langchain_community/retrievers/outline.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/outline.py", "repo_id": "langchain", "token_count": 208 }
287
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/tests/test_mixed.py/0
{ "file_path": "peft/tests/test_mixed.py", "repo_id": "peft", "token_count": 17543 }
325
# LlamaIndex Kvstore Integration: S3 Kvstore
llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/README.md/0
{ "file_path": "llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/README.md", "repo_id": "llama_index", "token_count": 15 }
1,427
--- hide_table_of_contents: true --- # Extending LangChain.js Extending LangChain's base abstractions, whether you're planning to contribute back to the open-source repo or build a bespoke internal integration, is encouraged. Check out these guides for building your own custom classes for the following modules: - [...
langchainjs/docs/core_docs/docs/guides/extending_langchain.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/guides/extending_langchain.mdx", "repo_id": "langchainjs", "token_count": 294 }
751
package main import ( "fmt" "os" "github.com/milvus-io/milvus/pkg/log" ) const ( generateCsv = "gen-csv" generateYaml = "gen-yaml" showYaml = "show-yaml" ) func main() { args := os.Args if len(args) < 2 { log.Error("len of args should large than 2") os.Exit(-1) } switch args[1] { case generateC...
milvus/cmd/tools/config/main.go/0
{ "file_path": "milvus/cmd/tools/config/main.go", "repo_id": "milvus", "token_count": 277 }
1,839
{ "openapi": "3.0.3", "info": { "title": "Text Generation Inference", "description": "Text Generation Webserver", "contact": { "name": "Olivier Dehaene" }, "license": { "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0" }, "version": "1.4.0" },...
text-generation-inference/docs/openapi.json/0
{ "file_path": "text-generation-inference/docs/openapi.json", "repo_id": "text-generation-inference", "token_count": 20966 }
380
[tool.ruff] line-length = 119 target-version = "py38" [tool.ruff.lint] ignore-init-module-imports = true extend-select = [ "B009", # static getattr "B010", # static setattr "E", # PEP8 errors "F", # PEP8 formatting "I", # Import sorting "W", # PEP8 warnings "UP", # Pyupgrade ] ignore = [ ...
accelerate/pyproject.toml/0
{ "file_path": "accelerate/pyproject.toml", "repo_id": "accelerate", "token_count": 323 }
7
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-everlyai/llama_index/llms/everlyai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-everlyai/llama_index/llms/everlyai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,350
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-chroma/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-chroma/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,551
import os from typing import Any, Dict, List from llama_index.core import ServiceContext, VectorStoreIndex from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.schema import Document from llama_index.embeddings.voyageai import VoyageEmbedding from llama_index.llms.openai import OpenAI cla...
llama_index/llama-index-packs/llama-index-packs-voyage-query-engine/llama_index/packs/voyage_query_engine/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-voyage-query-engine/llama_index/packs/voyage_query_engine/base.py", "repo_id": "llama_index", "token_count": 461 }
1,687
python_tests( name="tests", )
llama_index/llama-index-core/tests/question_gen/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/question_gen/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,230
<script lang="ts"> import CarbonCaretLeft from "~icons/carbon/caret-left"; import CarbonCaretRight from "~icons/carbon/caret-right"; export let href: string; export let direction: "next" | "previous"; export let isDisabled = false; </script> <a class="flex items-center rounded-lg px-2.5 py-1 hover:bg-gray-50 da...
chat-ui/src/lib/components/PaginationArrow.svelte/0
{ "file_path": "chat-ui/src/lib/components/PaginationArrow.svelte", "repo_id": "chat-ui", "token_count": 226 }
95
from langchain_community.tools.google_cloud.texttospeech import ( GoogleCloudTextToSpeechTool, ) __all__ = [ "GoogleCloudTextToSpeechTool", ]
langchain/libs/langchain/langchain/tools/google_cloud/texttospeech.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/google_cloud/texttospeech.py", "repo_id": "langchain", "token_count": 56 }
552
import re from langchain_core.agents import AgentAction, AgentFinish from .agent_scratchpad import _format_docs def extract_between_tags(tag: str, string: str, strip: bool = True) -> str: ext_list = re.findall(f"<{tag}\s?>(.+?)</{tag}\s?>", string, re.DOTALL) if strip: ext_list = [e.strip() for e in...
langchain/templates/anthropic-iterative-search/anthropic_iterative_search/output_parser.py/0
{ "file_path": "langchain/templates/anthropic-iterative-search/anthropic_iterative_search/output_parser.py", "repo_id": "langchain", "token_count": 509 }
666
import { PromptTemplate } from "@langchain/core/prompts"; import { LLMChain, LLMChainInput } from "../../chains/llm_chain.js"; /** Chain to prioritize tasks. */ export class TaskPrioritizationChain extends LLMChain { static lc_name() { return "TaskPrioritizationChain"; } /** * Static method to create a n...
langchainjs/langchain/src/experimental/babyagi/task_prioritization.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/babyagi/task_prioritization.ts", "repo_id": "langchainjs", "token_count": 447 }
922
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/it/serialization.md/0
{ "file_path": "transformers/docs/source/it/serialization.md", "repo_id": "transformers", "token_count": 10268 }
485
<jupyter_start><jupyter_text>Anyscale EmbeddingsThis guide shows you how to use Anyscale Embeddings through [Anyscale Endpoints](https://docs.endpoints.anyscale.com/). If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-embeddings-anyscale !pi...
llama_index/docs/examples/embeddings/Anyscale.ipynb/0
{ "file_path": "llama_index/docs/examples/embeddings/Anyscale.ipynb", "repo_id": "llama_index", "token_count": 240 }
1,113
import { MomentoVectorIndex } from "@langchain/community/vectorstores/momento_vector_index"; // For browser/edge, adjust this to import from "@gomomento/sdk-web"; import { PreviewVectorIndexClient, VectorIndexConfigurations, CredentialProvider, } from "@gomomento/sdk"; import { OpenAIEmbeddings } from "@langchain...
langchainjs/examples/src/indexes/vector_stores/momento_vector_index/fromDocs.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/momento_vector_index/fromDocs.ts", "repo_id": "langchainjs", "token_count": 429 }
849
<!--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/models/autoencoder_tiny.md/0
{ "file_path": "diffusers/docs/source/en/api/models/autoencoder_tiny.md", "repo_id": "diffusers", "token_count": 670 }
181
// Code generated by mockery v2.32.4. DO NOT EDIT. package proxy import ( context "context" internalpb "github.com/milvus-io/milvus/internal/proto/internalpb" mock "github.com/stretchr/testify/mock" ) // MockLBPolicy is an autogenerated mock type for the LBPolicy type type MockLBPolicy struct { mock.Mock } typ...
milvus/internal/proxy/mock_lb_policy.go/0
{ "file_path": "milvus/internal/proxy/mock_lb_policy.go", "repo_id": "milvus", "token_count": 2556 }
1,962
# Add parent directory to python path to access lightning_base.py export PYTHONPATH="../":"${PYTHONPATH}" python finetune.py \ --data_dir=$CNN_DIR \ --learning_rate=3e-5 \ --train_batch_size=$BS \ --eval_batch_size=$BS \ --output_dir=$OUTPUT_DIR \ --max_source_length=512 \ --max_target_length=56 \ --val_check_interval...
transformers/examples/research_projects/seq2seq-distillation/finetune_t5.sh/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/finetune_t5.sh", "repo_id": "transformers", "token_count": 148 }
576
%if 0%{!?version:1} %global version 2.0.2 %endif %if 0%{!?release:1} %global release 1%{?dist} %endif Name: milvus Version: %{version} Release: %{release} Summary: Milvus V2 RPM License: Apache License 2.0 Requires(preun): libstdc++ libgomp tbb-devel # tbb-devel actual...
milvus/build/rpm/milvus.spec/0
{ "file_path": "milvus/build/rpm/milvus.spec", "repo_id": "milvus", "token_count": 1427 }
1,889
# Sample script to finetune RAG using Ray for distributed retrieval. # Add parent directory to python path to access lightning_base.py export PYTHONPATH="../":"${PYTHONPATH}" #creates the custom knowlegebase python use_own_knowledge_dataset.py \ --csv_path /DIR/SQUAD-KB/squad-kb.csv \ --output_dir /DIR/SQUA...
transformers/examples/research_projects/rag-end2end-retriever/finetune_rag_ray_end2end.sh/0
{ "file_path": "transformers/examples/research_projects/rag-end2end-retriever/finetune_rag_ray_end2end.sh", "repo_id": "transformers", "token_count": 876 }
570
from langchain_community.document_loaders.stripe import StripeLoader def test_stripe_loader() -> None: """Test Stripe file loader.""" stripe_loader = StripeLoader("charges") documents = stripe_loader.load() assert len(documents) == 1
langchain/libs/community/tests/integration_tests/document_loaders/test_stripe.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_stripe.py", "repo_id": "langchain", "token_count": 81 }
352
from __future__ import annotations import itertools from typing import TYPE_CHECKING, Any, Iterable, List, Optional, Tuple from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.vectorstores import VectorStore if TYPE_CHECKING: from tigrisdb import Tigr...
langchain/libs/community/langchain_community/vectorstores/tigris.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/tigris.py", "repo_id": "langchain", "token_count": 2259 }
313
<jupyter_start><jupyter_text>Select by lengthThis example selector selects which examples to use based on length. This is useful when you are worried about constructing a prompt that will go over the length of the context window. For longer inputs, it will select fewer examples to include, while for shorter inputs it w...
langchain/docs/docs/modules/model_io/prompts/example_selector_types/length_based.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/prompts/example_selector_types/length_based.ipynb", "repo_id": "langchain", "token_count": 817 }
209
[tool.poetry] name = "rag-mongo" version = "0.1.0" description = "RAG on MongDB" authors = [ "Lance Martin <lance@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "<2" tiktoken = ">=0.5.1" pymongo = ">=4.5.0" [tool.poetry.group.dev.dependencies...
langchain/templates/rag-mongo/pyproject.toml/0
{ "file_path": "langchain/templates/rag-mongo/pyproject.toml", "repo_id": "langchain", "token_count": 287 }
721
package main import ( "encoding/csv" "fmt" "os" "reflect" "strings" "github.com/samber/lo" "go.uber.org/zap" "golang.org/x/exp/slices" "github.com/milvus-io/milvus/pkg/log" "github.com/milvus-io/milvus/pkg/util/paramtable" "github.com/milvus-io/milvus/pkg/util/typeutil" ) type DocContent struct { key ...
milvus/cmd/tools/config/generate.go/0
{ "file_path": "milvus/cmd/tools/config/generate.go", "repo_id": "milvus", "token_count": 3408 }
1,894
"""Test Anyscale API wrapper.""" from langchain_community.llms.aviary import Aviary def test_aviary_call() -> None: """Test valid call to Anyscale.""" llm = Aviary() output = llm("Say bar:") print(f"llm answer:\n{output}") # noqa: T201 assert isinstance(output, str)
langchain/libs/community/tests/integration_tests/llms/test_aviary.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_aviary.py", "repo_id": "langchain", "token_count": 112 }
335
# Template This is a template folder for you to start afresh in. Step 1: Fill out `get_chain` in `chain.py`. Step 2: Fill out all the constants in `constants.py`.
langchain-aiplugin/template/README.md/0
{ "file_path": "langchain-aiplugin/template/README.md", "repo_id": "langchain-aiplugin", "token_count": 53 }
64
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. @prefix rep: <http://www.openrdf.org/config/repository#>. @prefix sr: <http://www.openrdf.org/config/repository/sail#>. @prefix sail: <http://www.openrdf.org/config/sail#>. @prefix graphdb: <http://www.ontotext.com/config/graphdb#>. [] a rep:Repository ; rep:r...
langchain/libs/community/tests/integration_tests/graphs/docker-compose-ontotext-graphdb/config.ttl/0
{ "file_path": "langchain/libs/community/tests/integration_tests/graphs/docker-compose-ontotext-graphdb/config.ttl", "repo_id": "langchain", "token_count": 863 }
351
// 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/binlog_io.go/0
{ "file_path": "milvus/internal/datanode/binlog_io.go", "repo_id": "milvus", "token_count": 4249 }
1,771
from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.embeddings.huggingface import ( HuggingFaceEmbedding, HuggingFaceInferenceAPIEmbedding, ) def test_huggingfaceembedding_class(): names_of_base_classes = [b.__name__ for b in HuggingFaceEmbedding.__mro__] assert BaseEmbedd...
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/tests/test_embeddings_huggingface.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/tests/test_embeddings_huggingface.py", "repo_id": "llama_index", "token_count": 219 }
1,188
--- sidebar_position: 0 --- # Introduction **LangChain** is a framework for developing applications powered by language models. It enables applications that: - **Are context-aware**: connect a language model to sources of context (prompt instructions, few shot examples, content to ground its response in, etc.) - **Re...
langchain/docs/docs/get_started/introduction.mdx/0
{ "file_path": "langchain/docs/docs/get_started/introduction.mdx", "repo_id": "langchain", "token_count": 1269 }
89
"""Answer inserter.""" from abc import abstractmethod from typing import Any, Dict, List, Optional from llama_index.core.llms.llm import LLM from llama_index.core.prompts.base import BasePromptTemplate, PromptTemplate from llama_index.core.prompts.mixin import ( PromptDictType, PromptMixin, PromptMixinTyp...
llama_index/llama-index-core/llama_index/core/query_engine/flare/answer_inserter.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/query_engine/flare/answer_inserter.py", "repo_id": "llama_index", "token_count": 2418 }
1,239
export async function sha256(input: string): Promise<string> { const utf8 = new TextEncoder().encode(input); const hashBuffer = await crypto.subtle.digest("SHA-256", utf8); const hashArray = Array.from(new Uint8Array(hashBuffer)); const hashHex = hashArray.map((bytes) => bytes.toString(16).padStart(2, "0")).join(""...
chat-ui/src/lib/utils/sha256.ts/0
{ "file_path": "chat-ui/src/lib/utils/sha256.ts", "repo_id": "chat-ui", "token_count": 119 }
98
from typing import Callable, Dict from eval import contains_expected_response from llama_index.tools.function_tool import FunctionTool from task import Task def add(a: int, b: int) -> int: """Add two integers and returns the result integer.""" return a + b def multiply(a: int, b: int) -> int: """Multip...
llama_index/benchmarks/agent/math_tasks.py/0
{ "file_path": "llama_index/benchmarks/agent/math_tasks.py", "repo_id": "llama_index", "token_count": 362 }
1,154
- sections: - local: index title: 🧨 Diffusers - local: quicktour title: Tour rápido - local: installation title: Instalação title: Primeiros passos
diffusers/docs/source/pt/_toctree.yml/0
{ "file_path": "diffusers/docs/source/pt/_toctree.yml", "repo_id": "diffusers", "token_count": 77 }
201
from langchain_community.embeddings.modelscope_hub import ModelScopeEmbeddings __all__ = ["ModelScopeEmbeddings"]
langchain/libs/langchain/langchain/embeddings/modelscope_hub.py/0
{ "file_path": "langchain/libs/langchain/langchain/embeddings/modelscope_hub.py", "repo_id": "langchain", "token_count": 34 }
526
export { type ToolParams, ToolInputParsingException, StructuredTool, Tool, } from "@langchain/core/tools";
langchainjs/langchain/src/tools/base.ts/0
{ "file_path": "langchainjs/langchain/src/tools/base.ts", "repo_id": "langchainjs", "token_count": 40 }
955
# AnalyticDB This page covers how to use the AnalyticDB ecosystem within LangChain. ### VectorStore There exists a wrapper around AnalyticDB, allowing you to use it as a vectorstore, whether for semantic search or example selection. To import this vectorstore: ```python from langchain_community.vectorstores import ...
langchain/docs/docs/integrations/providers/analyticdb.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/analyticdb.mdx", "repo_id": "langchain", "token_count": 118 }
128
# Typesense > [Typesense](https://typesense.org) is an open-source, in-memory search engine, that you can either > [self-host](https://typesense.org/docs/guide/install-typesense#option-2-local-machine-self-hosting) or run > on [Typesense Cloud](https://cloud.typesense.org/). > `Typesense` focuses on performance by s...
langchain/docs/docs/integrations/providers/typesense.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/typesense.mdx", "repo_id": "langchain", "token_count": 217 }
152
# ECA-ResNet An **ECA ResNet** is a variant on a [ResNet](https://paperswithcode.com/method/resnet) that utilises an [Efficient Channel Attention module](https://paperswithcode.com/method/efficient-channel-attention). Efficient Channel Attention is an architectural unit based on [squeeze-and-excitation blocks](https:/...
pytorch-image-models/docs/models/.templates/models/ecaresnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/ecaresnet.md", "repo_id": "pytorch-image-models", "token_count": 2832 }
328
# Validation and Benchmark Results This folder contains validation and benchmark results for the models in this collection. Validation scores are currently only run for models with pretrained weights and ImageNet-1k heads, benchmark numbers are run for all. ## Datasets There are currently results for the ImageNet va...
pytorch-image-models/results/README.md/0
{ "file_path": "pytorch-image-models/results/README.md", "repo_id": "pytorch-image-models", "token_count": 1173 }
367
from typing import Any, Callable, Dict, Optional, Sequence from llama_index.core.base.llms.types import ( ChatMessage, ChatResponse, ChatResponseGen, CompletionResponse, CompletionResponseGen, LLMMetadata, ) from llama_index.core.bridge.pydantic import Field, PrivateAttr from llama_index.core.c...
llama_index/llama-index-integrations/llms/llama-index-llms-llama-api/llama_index/llms/llama_api/base.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-llama-api/llama_index/llms/llama_api/base.py", "repo_id": "llama_index", "token_count": 1841 }
1,284
--- sidebar_label: Ollama Functions --- # Ollama Functions LangChain offers an experimental wrapper around open source models run locally via [Ollama](https://github.com/jmorganca/ollama) that gives it the same API as OpenAI Functions. Note that more powerful and capable models will perform better with complex schem...
langchainjs/docs/core_docs/docs/integrations/chat/ollama_functions.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/chat/ollama_functions.mdx", "repo_id": "langchainjs", "token_count": 562 }
775
package allocator import "github.com/milvus-io/milvus/pkg/util/typeutil" type Allocator interface { AllocID() (typeutil.UniqueID, error) }
milvus/cmd/tools/migration/allocator/allocator.go/0
{ "file_path": "milvus/cmd/tools/migration/allocator/allocator.go", "repo_id": "milvus", "token_count": 54 }
1,710
class MyClass { constructor(name) { this.name = name; } greet() { console.log(`Hello, ${this.name}!`); } } function main() { const name = prompt("Enter your name:"); const obj = new MyClass(name); obj.greet(); } main();
langchain/docs/docs/integrations/document_loaders/example_data/source_code/example.js/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/example_data/source_code/example.js", "repo_id": "langchain", "token_count": 96 }
101
# The advantages and disadvantages of policy-gradient methods At this point, you might ask, "but Deep Q-Learning is excellent! Why use policy-gradient methods?". To answer this question, let's study the **advantages and disadvantages of policy-gradient methods**. ## Advantages There are multiple advantages over valu...
deep-rl-class/units/en/unit4/advantages-disadvantages.mdx/0
{ "file_path": "deep-rl-class/units/en/unit4/advantages-disadvantages.mdx", "repo_id": "deep-rl-class", "token_count": 1184 }
179
from langchain_community.callbacks.context_callback import ( ContextCallbackHandler, ) __all__ = ["ContextCallbackHandler"]
langchain/libs/langchain/langchain/callbacks/context_callback.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/context_callback.py", "repo_id": "langchain", "token_count": 36 }
449
<jupyter_start><jupyter_text>Anthropic FunctionsThis notebook shows how to use an experimental wrapper around Anthropic that gives it the same API as OpenAI Functions.<jupyter_code>from langchain_experimental.llms.anthropic_functions import AnthropicFunctions<jupyter_output><empty_output><jupyter_text>Initialize ModelY...
langchain/docs/docs/integrations/chat/anthropic_functions.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/chat/anthropic_functions.ipynb", "repo_id": "langchain", "token_count": 860 }
99
import json from json import JSONDecodeError from typing import List, Union from langchain_core.agents import AgentAction, AgentActionMessageLog, AgentFinish from langchain_core.exceptions import OutputParserException from langchain_core.messages import ( AIMessage, BaseMessage, ) from langchain_core.outputs i...
langchain/libs/langchain/langchain/agents/output_parsers/openai_tools.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/output_parsers/openai_tools.py", "repo_id": "langchain", "token_count": 1329 }
470
import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever logger = logging.getLogger(__name__) class RagPyTorchDistributedRetriever(RagRetriever): """ A distributed retriever built on top of ...
transformers/examples/research_projects/rag/distributed_pytorch_retriever.py/0
{ "file_path": "transformers/examples/research_projects/rag/distributed_pytorch_retriever.py", "repo_id": "transformers", "token_count": 2561 }
542
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/tools/llama-index-tools-graphql/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-graphql/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,426
from llama_index.graph_stores.nebula.base import NebulaGraphStore __all__ = ["NebulaGraphStore"]
llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-nebula/llama_index/graph_stores/nebula/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-nebula/llama_index/graph_stores/nebula/__init__.py", "repo_id": "llama_index", "token_count": 33 }
1,333
import re from typing import Any, Dict, List, Tuple, Union from langchain_core.exceptions import OutputParserException from langchain_core.output_parsers.base import BaseOutputParser from langchain_core.pydantic_v1 import validator from langchain.output_parsers.format_instructions import ( PANDAS_DATAFRAME_FORMAT...
langchain/libs/langchain/langchain/output_parsers/pandas_dataframe.py/0
{ "file_path": "langchain/libs/langchain/langchain/output_parsers/pandas_dataframe.py", "repo_id": "langchain", "token_count": 3429 }
551
/* * 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/mq/msgstream/msg_for_index_test.go/0
{ "file_path": "milvus/pkg/mq/msgstream/msg_for_index_test.go", "repo_id": "milvus", "token_count": 1211 }
1,924
# rag-google-cloud-sensitive-data-protection This template is an application that utilizes Google Vertex AI Search, a machine learning powered search service, and PaLM 2 for Chat (chat-bison). The application uses a Retrieval chain to answer questions based on your documents. This template is an application that util...
langchain/templates/rag-google-cloud-sensitive-data-protection/README.md/0
{ "file_path": "langchain/templates/rag-google-cloud-sensitive-data-protection/README.md", "repo_id": "langchain", "token_count": 1011 }
656
## Adversarial evaluation of model performances Here is an example on evaluating a model using adversarial evaluation of natural language inference with the Heuristic Analysis for NLI Systems (HANS) dataset [McCoy et al., 2019](https://arxiv.org/abs/1902.01007). The example was gracefully provided by [Nafise Sadat Moo...
transformers/examples/research_projects/adversarial/README.md/0
{ "file_path": "transformers/examples/research_projects/adversarial/README.md", "repo_id": "transformers", "token_count": 518 }
593
<jupyter_start><jupyter_text>RAG FusionRe-implemented from [this GitHub repo](https://github.com/Raudaschl/rag-fusion), all credit to original author> RAG-Fusion, a search methodology that aims to bridge the gap between traditional search paradigms and the multifaceted dimensions of human queries. Inspired by the capab...
langchain/cookbook/rag_fusion.ipynb/0
{ "file_path": "langchain/cookbook/rag_fusion.ipynb", "repo_id": "langchain", "token_count": 1123 }
80
# Based on stable_diffusion_reference.py from typing import Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np import PIL.Image import torch from diffusers import StableDiffusionXLPipeline from diffusers.models.attention import BasicTransformerBlock from diffusers.models.unets.unet_2d_blocks import...
diffusers/examples/community/stable_diffusion_xl_reference.py/0
{ "file_path": "diffusers/examples/community/stable_diffusion_xl_reference.py", "repo_id": "diffusers", "token_count": 18975 }
209
// 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/collection_info_test.go/0
{ "file_path": "milvus/internal/util/importutil/collection_info_test.go", "repo_id": "milvus", "token_count": 1481 }
1,869
<jupyter_start><jupyter_text>Baichuan LLMBaichuan Inc. (https://www.baichuan-ai.com/) is a Chinese startup in the era of AGI, dedicated to addressing fundamental human needs: Efficiency, Health, and Happiness. PrerequisiteAn API key is required to access Baichuan LLM API. Visit https://platform.baichuan-ai.com/ to get...
langchain/docs/docs/integrations/llms/baichuan.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/baichuan.ipynb", "repo_id": "langchain", "token_count": 317 }
125
#!/usr/bin/env python # 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...
transformers/examples/legacy/seq2seq/save_len_file.py/0
{ "file_path": "transformers/examples/legacy/seq2seq/save_len_file.py", "repo_id": "transformers", "token_count": 869 }
558
# 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/gpt_neox_japanese/test_modeling_gpt_neox_japanese.py/0
{ "file_path": "transformers/tests/models/gpt_neox_japanese/test_modeling_gpt_neox_japanese.py", "repo_id": "transformers", "token_count": 4859 }
735
<jupyter_start><jupyter_code>from transformers import AutoModelForSeq2SeqLM from peft import get_peft_config, get_peft_model, get_peft_model_state_dict, LoraConfig, TaskType import torch from datasets import load_dataset import os os.environ["TOKENIZERS_PARALLELISM"] = "false" from transformers import AutoTokenizer fr...
peft/examples/conditional_generation/peft_lora_seq2seq.ipynb/0
{ "file_path": "peft/examples/conditional_generation/peft_lora_seq2seq.ipynb", "repo_id": "peft", "token_count": 2336 }
298
"""Input components.""" from typing import Any, Dict from llama_index.core.base.query_pipeline.query import ( InputKeys, OutputKeys, QueryComponent, ) class InputComponent(QueryComponent): """Input component.""" def _validate_component_inputs(self, input: Dict[str, Any]) -> Dict[str, Any]: ...
llama_index/llama-index-core/llama_index/core/query_pipeline/components/input.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/query_pipeline/components/input.py", "repo_id": "llama_index", "token_count": 601 }
1,198
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/llms/llama-index-llms-localai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-localai/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,359
<jupyter_start><jupyter_code># Setup OpenAI Agent import openai openai.api_key = "sk-your-key" from llama_index.agent import OpenAIAgent from llama_index.tools.bing_search.base import BingSearchToolSpec bing_tool = BingSearchToolSpec(api_key="your-key") agent = OpenAIAgent.from_tools( bing_tool.to_tool_list(), ...
llama_index/llama-index-integrations/tools/llama-index-tools-bing-search/examples/bing_search.ipynb/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-bing-search/examples/bing_search.ipynb", "repo_id": "llama_index", "token_count": 571 }
1,475
import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unordered, map_nested, temp_...
datasets/tests/test_py_utils.py/0
{ "file_path": "datasets/tests/test_py_utils.py", "repo_id": "datasets", "token_count": 4821 }
158
pub fn add(left: usize, right: usize) -> usize { left + right } #[cfg(test)] mod tests { use super::*; #[test] fn it_works() { let result = add(2, 2); assert_eq!(result, 4); } }
candle/candle-wasm-tests/src/lib.rs/0
{ "file_path": "candle/candle-wasm-tests/src/lib.rs", "repo_id": "candle", "token_count": 108 }
91
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/de/quicktour.md/0
{ "file_path": "transformers/docs/source/de/quicktour.md", "repo_id": "transformers", "token_count": 7322 }
476
# Get the checkpoint from # https://openaipublic.azureedge.net/main/whisper/models/d3dd57d32accea0b295c96e26691aa14d8822fac7d9d27d5dc00b4ca2826dd03/tiny.en.pt import torch from safetensors.torch import save_file data = torch.load("tiny.en.pt") weights = {} for k, v in data["model_state_dict"].items(): weights[k] ...
candle/candle-examples/examples/whisper/extract_weights.py/0
{ "file_path": "candle/candle-examples/examples/whisper/extract_weights.py", "repo_id": "candle", "token_count": 183 }
50
#!/usr/bin/env python # coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
transformers/examples/tensorflow/language-modeling/run_clm.py/0
{ "file_path": "transformers/examples/tensorflow/language-modeling/run_clm.py", "repo_id": "transformers", "token_count": 12297 }
542
from llama_index.legacy.core.llms.types import ( ChatMessage, ChatResponse, ChatResponseGen, MessageRole, ) from llama_index.legacy.types import TokenGen def response_gen_from_query_engine(response_gen: TokenGen) -> ChatResponseGen: response_str = "" for token in response_gen: response...
llama_index/llama-index-legacy/llama_index/legacy/chat_engine/utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/chat_engine/utils.py", "repo_id": "llama_index", "token_count": 190 }
1,553
--- hide_table_of_contents: true sidebar_position: 2 --- # XML Agent Some language models (like Anthropic's Claude) are particularly good at reasoning/writing XML. The below example shows how to use an agent that uses XML when prompting. ## Setup Install the Anthropic integration package, retrieve your key, and sto...
langchainjs/docs/core_docs/docs/modules/agents/agent_types/xml.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/agents/agent_types/xml.mdx", "repo_id": "langchainjs", "token_count": 991 }
747
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use anyhow::{Error as E, Result}; use clap::{Parser, ValueEnum}; use candle_transformers::models::mamba::{Config, Model, State}; use candle::{DType, Device, Tensor}; use candle_examples::token_output_stre...
candle/candle-examples/examples/mamba/main.rs/0
{ "file_path": "candle/candle-examples/examples/mamba/main.rs", "repo_id": "candle", "token_count": 4348 }
46
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/vision_encoder_decoder/modeling_vision_encoder_decoder.py/0
{ "file_path": "transformers/src/transformers/models/vision_encoder_decoder/modeling_vision_encoder_decoder.py", "repo_id": "transformers", "token_count": 14444 }
707
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/pkg/util/typeutil/string_util.go/0
{ "file_path": "milvus/pkg/util/typeutil/string_util.go", "repo_id": "milvus", "token_count": 604 }
2,125
"""Schemas for the LangSmith API.""" from __future__ import annotations import logging from datetime import datetime, timezone from typing import Dict, List, Optional, cast from uuid import UUID, uuid4 try: from pydantic.v1 import ( # type: ignore[import] Field, root_validator, validator...
langsmith-sdk/python/langsmith/run_trees.py/0
{ "file_path": "langsmith-sdk/python/langsmith/run_trees.py", "repo_id": "langsmith-sdk", "token_count": 3042 }
1,150
# self-query-qdrant This template performs [self-querying](https://python.langchain.com/docs/modules/data_connection/retrievers/self_query/) using Qdrant and OpenAI. By default, it uses an artificial dataset of 10 documents, but you can replace it with your own dataset. ## Environment Setup Set the `OPENAI_API_KEY...
langchain/templates/self-query-qdrant/README.md/0
{ "file_path": "langchain/templates/self-query-qdrant/README.md", "repo_id": "langchain", "token_count": 1521 }
688