text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
<jupyter_start><jupyter_text>Semantic Segmantion with Hugging Face's Transformers & Amazon SageMaker Transformer models are changing are changing the world of machine learning, starting with natural language processing, and now, with audio and computer vision. Hugging Face's mission is to democratize good machine learn...
notebooks/sagemaker/21_image_segmantation/sagemaker-notebook.ipynb/0
{ "file_path": "notebooks/sagemaker/21_image_segmantation/sagemaker-notebook.ipynb", "repo_id": "notebooks", "token_count": 2831 }
333
export const CREATE_TOOL_DESCRIPTION = `A tool for creating Google Calendar events and meetings. INPUT example: "action": "google_calendar_create", "action_input": "create a new meeting with John Doe tomorrow at 4pm" OUTPUT: Output is a confirmation of a created event. `; export const VIEW_TOOL_DESCRIPTION = `A tool...
langchainjs/libs/langchain-community/src/tools/google_calendar/descriptions.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/google_calendar/descriptions.ts", "repo_id": "langchainjs", "token_count": 213 }
986
from llama_index.graph_stores.kuzu.base import KuzuGraphStore __all__ = ["KuzuGraphStore"]
llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-kuzu/llama_index/graph_stores/kuzu/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-kuzu/llama_index/graph_stores/kuzu/__init__.py", "repo_id": "llama_index", "token_count": 35 }
1,265
# Structured Data Extraction LLMs are capable of ingesting large amounts of unstructured data and returning it in structured formats, and LlamaIndex is set up to make this easy. Using LlamaIndex, you can get an LLM to read natural language and identify semantically important details such as names, dates, addresses, a...
llama_index/docs/use_cases/extraction.md/0
{ "file_path": "llama_index/docs/use_cases/extraction.md", "repo_id": "llama_index", "token_count": 417 }
1,153
"""Test LLM utility functions.""" from langchain_community.llms.utils import enforce_stop_tokens def test_enforce_stop_tokens() -> None: """Test removing stop tokens when they occur.""" text = "foo bar baz" output = enforce_stop_tokens(text, ["moo", "baz"]) assert output == "foo bar " text = "foo ...
langchain/libs/community/tests/unit_tests/llms/test_utils.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/llms/test_utils.py", "repo_id": "langchain", "token_count": 284 }
400
"""ChatGPT Plugin.""" import os from typing import Any, List, Optional import requests from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document from requests.adapters import HTTPAdapter, Retry class ChatGPTRetrievalPluginReader(BaseReader): """ChatGPT Retrieval Plugin re...
llama_index/llama-index-integrations/readers/llama-index-readers-chatgpt-plugin/llama_index/readers/chatgpt_plugin/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-chatgpt-plugin/llama_index/readers/chatgpt_plugin/base.py", "repo_id": "llama_index", "token_count": 964 }
1,414
import type { Conversation } from "./Conversation"; export type SharedConversation = Pick< Conversation, | "model" | "embeddingModel" | "title" | "rootMessageId" | "messages" | "preprompt" | "assistantId" | "createdAt" | "updatedAt" > & { _id: string; hash: string; };
chat-ui/src/lib/types/SharedConversation.ts/0
{ "file_path": "chat-ui/src/lib/types/SharedConversation.ts", "repo_id": "chat-ui", "token_count": 114 }
106
import json import logging import time from typing import List import requests from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) class CubeSemanticLoader(BaseLoader): """Load `Cube semantic layer` metadata. A...
langchain/libs/community/langchain_community/document_loaders/cube_semantic.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/cube_semantic.py", "repo_id": "langchain", "token_count": 3165 }
247
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
transformers/src/transformers/quantizers/base.py/0
{ "file_path": "transformers/src/transformers/quantizers/base.py", "repo_id": "transformers", "token_count": 3234 }
765
import { test, expect } from "@jest/globals"; import { OpenAI, ChatOpenAI } from "@langchain/openai"; import { SystemMessage } from "@langchain/core/messages"; import { ConversationSummaryBufferMemory } from "../summary_buffer.js"; test("Test summary buffer memory", async () => { const memory = new ConversationSumma...
langchainjs/langchain/src/memory/tests/summary_buffer.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/memory/tests/summary_buffer.int.test.ts", "repo_id": "langchainjs", "token_count": 716 }
950
python_sources()
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-azure-openai/llama_index/multi_modal_llms/azure_openai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-azure-openai/llama_index/multi_modal_llms/azure_openai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,322
# coding=utf-8 # Copyright 2022 NAVER AI Labs and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
transformers/src/transformers/models/vilt/modeling_vilt.py/0
{ "file_path": "transformers/src/transformers/models/vilt/modeling_vilt.py", "repo_id": "transformers", "token_count": 27583 }
744
import { SageMakerEndpoint, SageMakerLLMContentHandler, } from "@langchain/community/llms/sagemaker_endpoint"; interface ResponseJsonInterface { generation: { content: string; }; } // Custom for whatever model you'll be using class LLama213BHandler implements SageMakerLLMContentHandler { contentType = "...
langchainjs/examples/src/models/llm/sagemaker_endpoint.ts/0
{ "file_path": "langchainjs/examples/src/models/llm/sagemaker_endpoint.ts", "repo_id": "langchainjs", "token_count": 649 }
876
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datacoord/segment_manager_test.go/0
{ "file_path": "milvus/internal/datacoord/segment_manager_test.go", "repo_id": "milvus", "token_count": 13056 }
1,696
import re from typing import Any, List, Sequence import pytest from llama_index.core.agent.react.base import ReActAgent from llama_index.core.agent.react.types import ObservationReasoningStep from llama_index.core.agent.types import Task from llama_index.core.base.llms.types import ( ChatMessage, ChatResponse,...
llama_index/llama-index-core/tests/agent/react/test_react_agent.py/0
{ "file_path": "llama_index/llama-index-core/tests/agent/react/test_react_agent.py", "repo_id": "llama_index", "token_count": 4490 }
1,214
package tasks import ( "context" "github.com/milvus-io/milvus/internal/proto/querypb" "github.com/milvus-io/milvus/internal/querynodev2/segments" "github.com/milvus-io/milvus/internal/util/streamrpc" ) var _ Task = &QueryStreamTask{} func NewQueryStreamTask(ctx context.Context, collection *segments.Collection,...
milvus/internal/querynodev2/tasks/query_stream_task.go/0
{ "file_path": "milvus/internal/querynodev2/tasks/query_stream_task.go", "repo_id": "milvus", "token_count": 783 }
1,858
"""Util that calls Google Scholar Search.""" from typing import Any, Dict, Optional, cast from langchain_core.pydantic_v1 import BaseModel, Extra, SecretStr, root_validator from langchain_core.utils import convert_to_secret_str, get_from_dict_or_env class GoogleJobsAPIWrapper(BaseModel): """Wrapper for SerpApi's...
langchain/libs/community/langchain_community/utilities/google_jobs.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/google_jobs.py", "repo_id": "langchain", "token_count": 1218 }
305
from llama_index.core.readers.base import BaseReader from llama_index.readers.agent_search import AgentSearchReader def test_class(): names_of_base_classes = [b.__name__ for b in AgentSearchReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-agent-search/tests/test_readers_agent_search.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-agent-search/tests/test_readers_agent_search.py", "repo_id": "llama_index", "token_count": 89 }
1,257
# This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp # Copyright 2020 The HuggingFace Team and the AllenNLP 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 o...
transformers/src/transformers/benchmark/benchmark_utils.py/0
{ "file_path": "transformers/src/transformers/benchmark/benchmark_utils.py", "repo_id": "transformers", "token_count": 16506 }
628
// Auto-generated by `scripts/create-entrypoints.js`. Do not edit manually. export const optionalImportEntrypoints: string[] = [];
langchainjs/langchain-core/src/load/import_constants.ts/0
{ "file_path": "langchainjs/langchain-core/src/load/import_constants.ts", "repo_id": "langchainjs", "token_count": 34 }
852
# 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/utils/test_hf_argparser.py/0
{ "file_path": "transformers/tests/utils/test_hf_argparser.py", "repo_id": "transformers", "token_count": 6348 }
762
import { test, expect } from "@jest/globals"; import { RecursiveCharacterTextSplitter } from "../text_splitter.js"; test("Python code splitter", async () => { const splitter = RecursiveCharacterTextSplitter.fromLanguage("python", { chunkSize: 16, chunkOverlap: 0, }); const code = `def hello_world(): pr...
langchainjs/langchain/src/tests/code_text_splitter.test.ts/0
{ "file_path": "langchainjs/langchain/src/tests/code_text_splitter.test.ts", "repo_id": "langchainjs", "token_count": 2732 }
970
# coding=utf-8 # Copyright 2020 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/generation/logits_process.py/0
{ "file_path": "transformers/src/transformers/generation/logits_process.py", "repo_id": "transformers", "token_count": 40347 }
622
import CodeBlock from "@theme/CodeBlock"; # Creating custom callback handlers You can also create your own handler by implementing the `BaseCallbackHandler` interface. This is useful if you want to do something more complex than just logging to the console, eg. send the events to a logging service. As an example here...
langchainjs/docs/core_docs/docs/modules/callbacks/how_to/create_handlers.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/callbacks/how_to/create_handlers.mdx", "repo_id": "langchainjs", "token_count": 208 }
726
"""Init params."""
llama_index/llama-index-legacy/tests/langchain_helpers/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/langchain_helpers/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,805
python_tests()
llama_index/llama-index-packs/llama-index-packs-trulens-eval-packs/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-trulens-eval-packs/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,693
import pytest from langchain_community.document_loaders import YoutubeLoader @pytest.mark.parametrize( "youtube_url, expected_video_id", [ ("http://www.youtube.com/watch?v=-wtIMTCHWuI", "-wtIMTCHWuI"), ("http://youtube.com/watch?v=-wtIMTCHWuI", "-wtIMTCHWuI"), ("http://m.youtube.com/w...
langchain/libs/community/tests/unit_tests/document_loaders/test_youtube.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_youtube.py", "repo_id": "langchain", "token_count": 680 }
412
from langchain_community.retrievers.kay import KayAiRetriever __all__ = ["KayAiRetriever"]
langchain/libs/langchain/langchain/retrievers/kay.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/kay.py", "repo_id": "langchain", "token_count": 33 }
558
# 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/generation/configuration_utils.py/0
{ "file_path": "transformers/src/transformers/generation/configuration_utils.py", "repo_id": "transformers", "token_count": 22088 }
554
import requests import json milvus_dev = "https://registry.hub.docker.com/v2/repositories/milvusdb/milvus/tags?ordering=last_updated" milvus = "https://registry.hub.docker.com/v2/repositories/milvusdb/milvus/tags?ordering=last_updated" def get_tag(url): payload = {} headers = {} response = requests.requ...
milvus/tests/python_client/deploy/scripts/get_tag.py/0
{ "file_path": "milvus/tests/python_client/deploy/scripts/get_tag.py", "repo_id": "milvus", "token_count": 393 }
1,969
from llama_index.core.tools.tool_spec.base import BaseToolSpec class SalesforceToolSpec(BaseToolSpec): """Salesforce tool spec. Gives the agent the ability to interact with Salesforce using simple_salesforce """ spec_functions = ["execute_sosl", "execute_soql"] def __init__(self, **kargs) -> N...
llama_index/llama-index-integrations/tools/llama-index-tools-salesforce/llama_index/tools/salesforce/base.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-salesforce/llama_index/tools/salesforce/base.py", "repo_id": "llama_index", "token_count": 718 }
1,436
# LangSmith Walkthrough LangChain makes it easy to prototype LLM applications and Agents. However, delivering LLM applications to production can be deceptively difficult. You will have to iterate on your prompts, chains, and other components to build a high-quality product. LangSmith makes it easy to debug, test, and...
langchainjs/docs/core_docs/docs/guides/langsmith_evaluation.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/guides/langsmith_evaluation.mdx", "repo_id": "langchainjs", "token_count": 3004 }
720
from enum import Enum from typing import Any, List, Optional, Union from llama_index.core.base.embeddings.base import ( BaseEmbedding, DEFAULT_EMBED_BATCH_SIZE, ) from llama_index.core.bridge.pydantic import Field, PrivateAttr from llama_index.core.callbacks import CallbackManager from llama_index.embeddings....
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-nomic/llama_index/embeddings/nomic/base.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-nomic/llama_index/embeddings/nomic/base.py", "repo_id": "llama_index", "token_count": 3506 }
1,281
[workspace] members = [ "candle-core", "candle-datasets", "candle-examples", "candle-book", "candle-nn", "candle-pyo3", "candle-transformers", "candle-wasm-examples/*", "candle-wasm-tests", ] exclude = [ "candle-flash-attn", "candle-kernels", "candle-metal-kernels", "cand...
candle/Cargo.toml/0
{ "file_path": "candle/Cargo.toml", "repo_id": "candle", "token_count": 1142 }
25
from syrupy import SnapshotAssertion from langchain_core.output_parsers.list import CommaSeparatedListOutputParser from langchain_core.output_parsers.string import StrOutputParser from langchain_core.output_parsers.xml import XMLOutputParser from langchain_core.prompts.prompt import PromptTemplate from langchain_core....
langchain/libs/core/tests/unit_tests/runnables/test_graph.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/runnables/test_graph.py", "repo_id": "langchain", "token_count": 807 }
408
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
accelerate/tests/test_tracking.py/0
{ "file_path": "accelerate/tests/test_tracking.py", "repo_id": "accelerate", "token_count": 10061 }
23
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl.py", "repo_id": "diffusers", "token_count": 22498 }
270
# Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level o...
accelerate/CODE_OF_CONDUCT.md/0
{ "file_path": "accelerate/CODE_OF_CONDUCT.md", "repo_id": "accelerate", "token_count": 1107 }
0
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
transformers/tests/test_cache_utils.py/0
{ "file_path": "transformers/tests/test_cache_utils.py", "repo_id": "transformers", "token_count": 8030 }
755
<script lang="ts"> export let classNames = ""; </script> <svg class={classNames} xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 20 20" > ><path fill-rule="evenodd" d="M1.5 10a8.5 8.5 0 1 0 17 0a...
chat-ui/src/lib/components/icons/IconInternet.svelte/0
{ "file_path": "chat-ui/src/lib/components/icons/IconInternet.svelte", "repo_id": "chat-ui", "token_count": 684 }
89
"""Google Drive files reader.""" import logging import os import tempfile from pathlib import Path from typing import Any, List, Optional from llama_index.core.readers import SimpleDirectoryReader from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document logger = logging.getLo...
llama_index/llama-index-integrations/readers/llama-index-readers-google/llama_index/readers/google/drive/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-google/llama_index/readers/google/drive/base.py", "repo_id": "llama_index", "token_count": 7275 }
1,307
use candle::{DType, Error, Result, Tensor}; use rand::{distributions::Distribution, SeedableRng}; pub struct LogitsProcessor { rng: rand::rngs::StdRng, temperature: Option<f64>, top_p: Option<f64>, } impl LogitsProcessor { pub fn new(seed: u64, temperature: Option<f64>, top_p: Option<f64>) -> Self { ...
candle/candle-transformers/src/generation/mod.rs/0
{ "file_path": "candle/candle-transformers/src/generation/mod.rs", "repo_id": "candle", "token_count": 1507 }
71
# Constitutional AI This repo includes the recipe for training the following models: * https://huggingface.co/HuggingFaceH4/mistral-7b-anthropic * https://huggingface.co/HuggingFaceH4/mistral-7b-grok ## Full training examples You will require 8 GPUs (80GB of VRAM) to train the full model. ```shell # Step 1 - SFT ...
alignment-handbook/recipes/constitutional-ai/README.md/0
{ "file_path": "alignment-handbook/recipes/constitutional-ai/README.md", "repo_id": "alignment-handbook", "token_count": 326 }
21
#ifndef NAMED_TYPE_HPP #define NAMED_TYPE_HPP #include "named_type_impl.hpp" #include "underlying_functionalities.hpp" #include "version.hpp" #endif
milvus/internal/core/thirdparty/NamedType/named_type.hpp/0
{ "file_path": "milvus/internal/core/thirdparty/NamedType/named_type.hpp", "repo_id": "milvus", "token_count": 64 }
1,670
"""Integration test for embedding-based redundant doc filtering.""" from langchain_community.document_transformers.embeddings_redundant_filter import ( EmbeddingsClusteringFilter, EmbeddingsRedundantFilter, _DocumentWithState, ) from langchain_community.embeddings import OpenAIEmbeddings from langchain_core...
langchain/libs/langchain/tests/integration_tests/test_document_transformers.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/test_document_transformers.py", "repo_id": "langchain", "token_count": 1108 }
585
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends SLOW_TO_FAST_CONVERTERS = None def convert_slow_tokenizer(*args, **kwargs): requires_backends(convert_slow_tokenizer, ["sentencepiece", "tokenizers"])
transformers/src/transformers/utils/dummy_sentencepiece_and_tokenizers_objects.py/0
{ "file_path": "transformers/src/transformers/utils/dummy_sentencepiece_and_tokenizers_objects.py", "repo_id": "transformers", "token_count": 94 }
695
# LlamaIndex Vector_Stores Integration: Milvus
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-milvus/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-milvus/README.md", "repo_id": "llama_index", "token_count": 14 }
1,562
search_stability: collections: - server: db_config.primary_path: /test/milvus/db_data_gpu_crud/sift_50m_1024_128_l2_sq8 cache_config.cpu_cache_capacity: 50 engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 100 gpu_resource_config.enable: true...
milvus/tests/benchmark/milvus_benchmark/suites/gpu_search_stability.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/gpu_search_stability.yaml", "repo_id": "milvus", "token_count": 366 }
1,954
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/tools/llama-index-tools-slack/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-slack/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,454
<script> $(document).ready(function() { /* Add a [>>>] button on the top-right corner of code samples to hide * the >>> and ... prompts and the output and thus make the code * copyable. */ var div = $('.highlight-python .highlight,' + '.highlight-python3 .highlight,' + ...
langchain/docs/api_reference/themes/scikit-learn-modern/javascript.html/0
{ "file_path": "langchain/docs/api_reference/themes/scikit-learn-modern/javascript.html", "repo_id": "langchain", "token_count": 1119 }
85
import { PromptTemplate, PipelinePromptTemplate, } from "@langchain/core/prompts"; const fullPrompt = PromptTemplate.fromTemplate(`{introduction} {example} {start}`); const introductionPrompt = PromptTemplate.fromTemplate( `You are impersonating {person}.` ); const examplePrompt = PromptTemplate.fromTempla...
langchainjs/examples/src/prompts/pipeline_prompt.ts/0
{ "file_path": "langchainjs/examples/src/prompts/pipeline_prompt.ts", "repo_id": "langchainjs", "token_count": 435 }
836
from typing import Any from langchain_core.messages import FunctionMessage, ToolMessage class LiberalFunctionMessage(FunctionMessage): content: Any class LiberalToolMessage(ToolMessage): content: Any
opengpts/backend/app/message_types.py/0
{ "file_path": "opengpts/backend/app/message_types.py", "repo_id": "opengpts", "token_count": 55 }
1,985
""" Bottleneck Self Attention (Bottleneck Transformers) Paper: `Bottleneck Transformers for Visual Recognition` - https://arxiv.org/abs/2101.11605 @misc{2101.11605, Author = {Aravind Srinivas and Tsung-Yi Lin and Niki Parmar and Jonathon Shlens and Pieter Abbeel and Ashish Vaswani}, Title = {Bottleneck Transformers f...
pytorch-image-models/timm/layers/bottleneck_attn.py/0
{ "file_path": "pytorch-image-models/timm/layers/bottleneck_attn.py", "repo_id": "pytorch-image-models", "token_count": 2907 }
386
from langchain_core.tracers.langchain_v1 import LangChainTracerV1, get_headers __all__ = ["get_headers", "LangChainTracerV1"]
langchain/libs/langchain/langchain/schema/callbacks/tracers/langchain_v1.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/callbacks/tracers/langchain_v1.py", "repo_id": "langchain", "token_count": 46 }
540
# coding=utf-8 # Copyright 2021 The Facebook AI Research Team Authors and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LIC...
transformers/src/transformers/models/mbart50/tokenization_mbart50_fast.py/0
{ "file_path": "transformers/src/transformers/models/mbart50/tokenization_mbart50_fast.py", "repo_id": "transformers", "token_count": 5245 }
631
#!/usr/bin/env bash python run_asr.py \ --output_dir="./wav2vec2-base-100h" \ --num_train_epochs="30" \ --per_device_train_batch_size="32" \ --per_device_eval_batch_size="32" \ --evaluation_strategy="steps" \ --save_total_limit="3" \ --save_steps="500" \ --eval_steps="100" \ --logging_steps="50" \ --learning_rate="5e-4...
transformers/examples/research_projects/wav2vec2/finetune_base_100.sh/0
{ "file_path": "transformers/examples/research_projects/wav2vec2/finetune_base_100.sh", "repo_id": "transformers", "token_count": 249 }
619
// Code generated by mockery v2.32.4. DO NOT EDIT. package datacoord import ( context "context" datapb "github.com/milvus-io/milvus/internal/proto/datapb" mock "github.com/stretchr/testify/mock" ) // MockSessionManager is an autogenerated mock type for the SessionManager type type MockSessionManager struct { mo...
milvus/internal/datacoord/mock_session_manager.go/0
{ "file_path": "milvus/internal/datacoord/mock_session_manager.go", "repo_id": "milvus", "token_count": 8290 }
1,768
"""Auto Merging Retriever.""" 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.node_parser import ( HierarchicalNodeParser, get_leaf_nodes, ) from llama_index.core.query_engine impo...
llama_index/llama-index-packs/llama-index-packs-auto-merging-retriever/llama_index/packs/auto_merging_retriever/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-auto-merging-retriever/llama_index/packs/auto_merging_retriever/base.py", "repo_id": "llama_index", "token_count": 971 }
1,660
# rag-semi-structured This template performs RAG on semi-structured data, such as a PDF with text and tables. See [this cookbook](https://github.com/langchain-ai/langchain/blob/master/cookbook/Semi_Structured_RAG.ipynb) as a reference. ## Environment Setup Set the `OPENAI_API_KEY` environment variable to access the...
langchain/templates/rag-semi-structured/README.md/0
{ "file_path": "langchain/templates/rag-semi-structured/README.md", "repo_id": "langchain", "token_count": 755 }
707
import { BaseRetriever, type BaseRetrieverInput, } from "@langchain/core/retrievers"; import { Document } from "@langchain/core/documents"; import { AsyncCaller, type AsyncCallerParams, } from "@langchain/core/utils/async_caller"; export interface ChaindeskRetrieverArgs extends AsyncCallerParams, BaseRet...
langchainjs/libs/langchain-community/src/retrievers/chaindesk.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/retrievers/chaindesk.ts", "repo_id": "langchainjs", "token_count": 949 }
997
from llama_index.multi_modal_llms.ollama.base import OllamaMultiModal __all__ = ["OllamaMultiModal"]
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-ollama/llama_index/multi_modal_llms/ollama/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-ollama/llama_index/multi_modal_llms/ollama/__init__.py", "repo_id": "llama_index", "token_count": 40 }
1,382
import math import torch from torch.optim.optimizer import Optimizer class AdaBelief(Optimizer): r"""Implements AdaBelief algorithm. Modified from Adam in PyTorch Arguments: params (iterable): iterable of parameters to optimize or dicts defining parameter groups lr (float, optiona...
pytorch-image-models/timm/optim/adabelief.py/0
{ "file_path": "pytorch-image-models/timm/optim/adabelief.py", "repo_id": "pytorch-image-models", "token_count": 5074 }
392
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is...
diffusers/src/diffusers/pipelines/t2i_adapter/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/t2i_adapter/__init__.py", "repo_id": "diffusers", "token_count": 602 }
266
python_sources()
llama_index/llama-index-packs/llama-index-packs-dense-x-retrieval/examples/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-dense-x-retrieval/examples/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,841
{ "useTabs": true, "trailingComma": "es5", "printWidth": 100, "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], "pluginSearchDirs": ["."], "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] }
chat-ui/.prettierrc/0
{ "file_path": "chat-ui/.prettierrc", "repo_id": "chat-ui", "token_count": 104 }
80
import monitor from "llmonitor"; import { LLMonitorOptions, ChatMessage, cJSON } from "llmonitor/types"; import { BaseRun, RunUpdate as BaseRunUpdate, KVMap } from "langsmith/schemas"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { BaseMessage } from "@langchain/core/messages"; import { C...
langchainjs/libs/langchain-community/src/callbacks/handlers/llmonitor.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/callbacks/handlers/llmonitor.ts", "repo_id": "langchainjs", "token_count": 3225 }
935
python_tests()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,186
import numpy as np x = np.arange(10) # Write a npy file. np.save("test.npy", x) # Write multiple values to a npz file. values = { "x": x, "x_plus_one": x + 1 } np.savez("test.npz", **values)
candle/candle-core/tests/npy.py/0
{ "file_path": "candle/candle-core/tests/npy.py", "repo_id": "candle", "token_count": 83 }
40
// 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/index/Utils.h/0
{ "file_path": "milvus/internal/core/src/index/Utils.h", "repo_id": "milvus", "token_count": 1207 }
1,755
<!--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/en/model_doc/gpt2.md/0
{ "file_path": "transformers/docs/source/en/model_doc/gpt2.md", "repo_id": "transformers", "token_count": 2619 }
455
kind: Schedule apiVersion: chaos-mesh.org/v1alpha1 metadata: name: test-proxy-pod-kill namespace: chaos-testing spec: schedule: '*/5 * * * * *' startingDeadlineSeconds: 60 concurrencyPolicy: Forbid historyLimit: 1 type: PodChaos podChaos: selector: namespaces: - chaos-testing lab...
milvus/tests/python_client/chaos/chaos_objects/pod_kill/chaos_proxy_pod_kill.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/pod_kill/chaos_proxy_pod_kill.yaml", "repo_id": "milvus", "token_count": 220 }
1,890
import argparse import os past_versions_testing = { "pytorch": { "1.13": { "torch": "1.13.1", "torchvision": "0.14.1", "torchaudio": "0.13.1", "python": 3.9, "cuda": "cu116", "install": ( "python3 -m pip install --no-c...
transformers/utils/past_ci_versions.py/0
{ "file_path": "transformers/utils/past_ci_versions.py", "repo_id": "transformers", "token_count": 2774 }
870
import re from collections import namedtuple from typing import Any, Dict, List, Optional, Tuple Schema = namedtuple("Schema", ["left_node", "relation", "right_node"]) # noqa: PYI024 class CypherQueryCorrector: """ Used to correct relationship direction in generated Cypher statements. This code is copie...
llama_index/llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/query_validator.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/query_validator.py", "repo_id": "llama_index", "token_count": 4935 }
1,625
from langchain_experimental.comprehend_moderation.amazon_comprehend_moderation import ( AmazonComprehendModerationChain, ) from langchain_experimental.comprehend_moderation.base_moderation import BaseModeration from langchain_experimental.comprehend_moderation.base_moderation_callbacks import ( BaseModerationCa...
langchain/libs/experimental/langchain_experimental/comprehend_moderation/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/comprehend_moderation/__init__.py", "repo_id": "langchain", "token_count": 377 }
457
"""Test the scoring chains.""" import re import pytest from langchain.evaluation.scoring.eval_chain import ( LabeledScoreStringEvalChain, ScoreStringEvalChain, ScoreStringResultOutputParser, ) from tests.unit_tests.llms.fake_llm import FakeLLM def test_PairwiseStringResultOutputParser_parse() -> None: ...
langchain/libs/langchain/tests/unit_tests/evaluation/scoring/test_eval_chain.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/evaluation/scoring/test_eval_chain.py", "repo_id": "langchain", "token_count": 922 }
597
<jupyter_start><jupyter_text>Rebuff>[Rebuff](https://docs.rebuff.ai/) is a self-hardening prompt injection detector.It is designed to protect AI applications from prompt injection (PI) attacks through a multi-stage defense.* [Homepage](https://rebuff.ai)* [Playground](https://playground.rebuff.ai)* [Docs](https://docs....
langchain/docs/docs/integrations/providers/rebuff.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/providers/rebuff.ipynb", "repo_id": "langchain", "token_count": 1111 }
146
import os from operator import itemgetter from typing import Dict, List, Optional, Sequence import weaviate from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from langchain_community.chat_models import ChatAnthropic, ChatFireworks from langchain_community.vectorstores import Weaviate from ...
chat-langchain/chain.py/0
{ "file_path": "chat-langchain/chain.py", "repo_id": "chat-langchain", "token_count": 2925 }
5
"""Callback Handler that prints to streamlit.""" from __future__ import annotations from enum import Enum from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional from langchain_core.agents import AgentAction, AgentFinish from langchain_core.callbacks import BaseCallbackHandler from langchain_core.out...
langchain/libs/community/langchain_community/callbacks/streamlit/streamlit_callback_handler.py/0
{ "file_path": "langchain/libs/community/langchain_community/callbacks/streamlit/streamlit_callback_handler.py", "repo_id": "langchain", "token_count": 6412 }
214
# 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/vilt/processing_vilt.py/0
{ "file_path": "transformers/src/transformers/models/vilt/processing_vilt.py", "repo_id": "transformers", "token_count": 2386 }
735
# 0. imports import os from dataclasses import dataclass, field from typing import Dict, Optional import torch from datasets import Dataset, load_dataset from peft import LoraConfig from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, TrainingArguments from trl import DPOTrainer # Define ...
trl/examples/research_projects/stack_llama_2/scripts/dpo_llama2.py/0
{ "file_path": "trl/examples/research_projects/stack_llama_2/scripts/dpo_llama2.py", "repo_id": "trl", "token_count": 3560 }
821
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/pkg/mq/msgstream/mq_kafka_msgstream_test.go/0
{ "file_path": "milvus/pkg/mq/msgstream/mq_kafka_msgstream_test.go", "repo_id": "milvus", "token_count": 6491 }
1,888
// 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/metacache/bloom_filter_set_test.go/0
{ "file_path": "milvus/internal/datanode/metacache/bloom_filter_set_test.go", "repo_id": "milvus", "token_count": 976 }
1,778
// 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/parquet_c.h/0
{ "file_path": "milvus/internal/core/src/storage/parquet_c.h", "repo_id": "milvus", "token_count": 1713 }
1,777
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/quantization.md/0
{ "file_path": "transformers/docs/source/en/quantization.md", "repo_id": "transformers", "token_count": 10970 }
511
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/pipelines/animatediff/pipeline_animatediff_video2video.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/animatediff/pipeline_animatediff_video2video.py", "repo_id": "diffusers", "token_count": 20209 }
217
# @langchain/openai This package contains the LangChain.js integrations for OpenAI through their SDK. ## Installation ```bash npm2yarn npm install @langchain/openai ``` This package, along with the main LangChain package, depends on [`@langchain/core`](https://npmjs.com/package/@langchain/core/). If you are using t...
langchainjs/libs/langchain-openai/README.md/0
{ "file_path": "langchainjs/libs/langchain-openai/README.md", "repo_id": "langchainjs", "token_count": 989 }
1,037
<jupyter_start><jupyter_text>Long-Context ReorderNo matter the architecture of your model, there is a substantial performance degradation when you include 10+ retrieved documents.In brief: When models must access relevant information in the middle of long contexts, they tend to ignore the provided documents.See: https:...
langchain/docs/docs/modules/data_connection/retrievers/long_context_reorder.ipynb/0
{ "file_path": "langchain/docs/docs/modules/data_connection/retrievers/long_context_reorder.ipynb", "repo_id": "langchain", "token_count": 827 }
201
""" DaViT: Dual Attention Vision Transformers As described in https://arxiv.org/abs/2204.03645 Input size invariant transformer architecture that combines channel and spacial attention in each block. The attention mechanisms used are linear in complexity. DaViT model defs and weights adapted from https://github.com/...
pytorch-image-models/timm/models/davit.py/0
{ "file_path": "pytorch-image-models/timm/models/davit.py", "repo_id": "pytorch-image-models", "token_count": 11881 }
352
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
peft/docs/source/package_reference/auto_class.md/0
{ "file_path": "peft/docs/source/package_reference/auto_class.md", "repo_id": "peft", "token_count": 470 }
323
from typing import Any, Dict, List, Literal, Mapping, Optional, Sequence, TypeVar, Union from llama_index.legacy.readers.base import BaseReader from llama_index.legacy.readers.schema.base import Document # define types ID = str IDs = List[ID] Vector = Union[Sequence[float], Sequence[int]] Embedding = Vector Embeddin...
llama_index/llama-index-legacy/llama_index/legacy/readers/bagel.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/bagel.py", "repo_id": "llama_index", "token_count": 2308 }
1,631
kind: StressChaos apiVersion: chaos-mesh.org/v1alpha1 metadata: name: test-indexnode-memory-stress namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: app.kubernetes.io/instance: pulsar-mem-stress-14-04-25 component: indexnode mode: one stressors: ...
milvus/tests/python_client/chaos/chaos_objects/mem_stress/chaos_indexnode_mem_stress.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/mem_stress/chaos_indexnode_mem_stress.yaml", "repo_id": "milvus", "token_count": 179 }
1,884
# Inspired by: https://github.com/haofanwang/ControlNet-for-Diffusers/ import inspect from typing import Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np import PIL.Image import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, Co...
diffusers/examples/community/stable_diffusion_controlnet_img2img.py/0
{ "file_path": "diffusers/examples/community/stable_diffusion_controlnet_img2img.py", "repo_id": "diffusers", "token_count": 20854 }
215
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-together/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-together/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,240
<jupyter_start><jupyter_text>How to export 🤗 Transformers Models to ONNX ? [ONNX](http://onnx.ai/) is open format for machine learning models. It allows to save your neural network's computation graph in a framework agnostic way, which might be particulary helpful when deploying deep learning models.Indeed, businesses...
notebooks/examples/onnx-export.ipynb/0
{ "file_path": "notebooks/examples/onnx-export.ipynb", "repo_id": "notebooks", "token_count": 6241 }
311
// 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/storage_c.cpp/0
{ "file_path": "milvus/internal/core/src/storage/storage_c.cpp", "repo_id": "milvus", "token_count": 1585 }
1,676
[tool.poetry] name = "langchain-google-vertexai" version = "0.0.5" description = "An integration package connecting GoogleVertexAI and LangChain" authors = [] readme = "README.md" repository = "https://github.com/langchain-ai/langchain" license = "MIT" [tool.poetry.urls] "Source Code" = "https://github.com/langchain-a...
langchain/libs/partners/google-vertexai/pyproject.toml/0
{ "file_path": "langchain/libs/partners/google-vertexai/pyproject.toml", "repo_id": "langchain", "token_count": 1221 }
624
# Making a Class-Conditioned Diffusion Model <CourseFloatingBanner unit={2} classNames="absolute z-10 right-0 top-0" notebooks={[ {label: "Making a Class-Conditioned Diffusion Model", value: "https://colab.research.google.com/github/huggingface/diffusion-models-class/blob/main/units/en/unit2/class_conditioned_...
diffusion-models-class/units/en/unit2/3.mdx/0
{ "file_path": "diffusion-models-class/units/en/unit2/3.mdx", "repo_id": "diffusion-models-class", "token_count": 2985 }
288
from typing import Any, Dict, Optional import aiohttp import requests from langchain_core.pydantic_v1 import BaseModel, root_validator from langchain_core.utils import get_from_dict_or_env class SearchApiAPIWrapper(BaseModel): """ Wrapper around SearchApi API. To use, you should have the environment var...
langchain/libs/community/langchain_community/utilities/searchapi.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/searchapi.py", "repo_id": "langchain", "token_count": 2375 }
325
import { resolve, dirname } from "node:path"; import { fileURLToPath } from "node:url"; /** * @param {string} relativePath * @returns {string} */ function abs(relativePath) { return resolve(dirname(fileURLToPath(import.meta.url)), relativePath); } export const config = { internals: [ /node\:/, /js-tikt...
langchainjs/langchain/langchain.config.js/0
{ "file_path": "langchainjs/langchain/langchain.config.js", "repo_id": "langchainjs", "token_count": 13294 }
875
# 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...
peft/setup.py/0
{ "file_path": "peft/setup.py", "repo_id": "peft", "token_count": 1543 }
321