text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from typing import Any, Callable, Dict, List, Sequence, Optional import fastapi from fastapi import FastAPI as _FastAPI, Response from fastapi.responses import JSONResponse from fastapi.middleware.cors import CORSMiddleware from fastapi.routing import APIRoute from fastapi import HTTPException, status from uuid import...
chroma/chromadb/server/fastapi/__init__.py/0
{ "file_path": "chroma/chromadb/server/fastapi/__init__.py", "repo_id": "chroma", "token_count": 10030 }
20
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/setup.py/0
{ "file_path": "transformers/setup.py", "repo_id": "transformers", "token_count": 6407 }
566
// 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/common/common.go/0
{ "file_path": "milvus/pkg/common/common.go", "repo_id": "milvus", "token_count": 1612 }
2,028
from llama_index.readers.hubspot.base import HubspotReader __all__ = ["HubspotReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-hubspot/llama_index/readers/hubspot/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hubspot/llama_index/readers/hubspot/__init__.py", "repo_id": "llama_index", "token_count": 29 }
1,365
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use candle::test_utils::{to_vec0_round, to_vec2_round}; use anyhow::Result; use candle::{Device, Tensor, Var}; use candle_nn::{AdamW, Linear, Module, Optimizer, ParamsAdamW, SGD}; #[test] fn sgd_optim() -...
candle/candle-nn/tests/optim.rs/0
{ "file_path": "candle/candle-nn/tests/optim.rs", "repo_id": "candle", "token_count": 1886 }
58
import unittest from langchain_community.document_loaders.couchbase import CouchbaseLoader try: import couchbase # noqa: F401 couchbase_installed = True except ImportError: couchbase_installed = False @unittest.skipIf(not couchbase_installed, "couchbase not installed") class TestCouchbaseLoader(unitte...
langchain/libs/community/tests/integration_tests/document_loaders/test_couchbase.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_couchbase.py", "repo_id": "langchain", "token_count": 691 }
353
from langchain_core.tracers import __all__ EXPECTED_ALL = [ "BaseTracer", "EvaluatorCallbackHandler", "LangChainTracer", "ConsoleCallbackHandler", "Run", "RunLog", "RunLogPatch", "LogStreamCallbackHandler", ] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)...
langchain/libs/core/tests/unit_tests/tracers/test_imports.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/tracers/test_imports.py", "repo_id": "langchain", "token_count": 132 }
412
#!/usr/bin/env python3 import logging import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import librosa import torch from datasets import DatasetDict, load_dataset from packaging import version from torch import nn from transformers import ( HfArgumentParser, ...
transformers/examples/research_projects/wav2vec2/run_pretrain.py/0
{ "file_path": "transformers/examples/research_projects/wav2vec2/run_pretrain.py", "repo_id": "transformers", "token_count": 6513 }
594
// 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/streamrpc/in_memory_streamer.go/0
{ "file_path": "milvus/internal/util/streamrpc/in_memory_streamer.go", "repo_id": "milvus", "token_count": 1647 }
1,810
"""Test PGVector functionality.""" import os from typing import List from langchain_core.documents import Document from langchain_community.vectorstores.analyticdb import AnalyticDB from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings CONNECTION_STRING = AnalyticDB.connection_string_from_...
langchain/libs/community/tests/integration_tests/vectorstores/test_analyticdb.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_analyticdb.py", "repo_id": "langchain", "token_count": 2534 }
375
search_stability: collections: - milvus: db_config.primary_path: /test/milvus/db_data_011/sift_50m_128_l2_sq8_16384_stability cache_config.cpu_cache_capacity: 32GB engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 100 gpu_resource_config.enab...
milvus/tests/benchmark/milvus_benchmark/suites/011_search_stability.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/011_search_stability.yaml", "repo_id": "milvus", "token_count": 323 }
1,947
"""Epub parser. Contains parsers for epub files. """ from pathlib import Path from typing import Dict, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class EpubReader(BaseReader): """Epub Parser.""" def load_data( self, file: Path, ...
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/epub/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/epub/base.py", "repo_id": "llama_index", "token_count": 574 }
1,435
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-dynamodb/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-dynamodb/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,458
# Gradio ReActAgent Chatbot Pack Create a ReActAgent Chatbot equipped with two LlamaHub tools, namely: [ArxivToolSpec](https://llamahub.ai/l/tools-arxiv) and Wikipedia tool and [WikipediaToolSpec](https://llamahub.ai/l/tools-wikipedia). This pack's Gradio app is built using Gradio `Blocks`. User messages are submitte...
llama_index/llama-index-packs/llama-index-packs-gradio-react-agent-chatbot/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-gradio-react-agent-chatbot/README.md", "repo_id": "llama_index", "token_count": 322 }
1,791
import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { ConversationalRetrievalQAChain } from "langchain/chains"; import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import { BufferMemory } from "langchain/memo...
langchainjs/examples/src/chains/conversational_qa_built_in_memory_legacy.ts/0
{ "file_path": "langchainjs/examples/src/chains/conversational_qa_built_in_memory_legacy.ts", "repo_id": "langchainjs", "token_count": 556 }
818
<!--Copyright 2021 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/xlsr_wav2vec2.md/0
{ "file_path": "transformers/docs/source/en/model_doc/xlsr_wav2vec2.md", "repo_id": "transformers", "token_count": 699 }
461
# Two main approaches for solving RL problems [[two-methods]] <Tip> Now that we learned the RL framework, how do we solve the RL problem? </Tip> In other words, how do we build an RL agent that can **select the actions that maximize its expected cumulative reward?** ## The Policy π: the agent’s brain [[policy]] The...
deep-rl-class/units/en/unit1/two-methods.mdx/0
{ "file_path": "deep-rl-class/units/en/unit1/two-methods.mdx", "repo_id": "deep-rl-class", "token_count": 1565 }
156
import { LLMChain } from "langchain/chains"; import { ChatOpenAI } from "@langchain/openai"; import { ChatPromptTemplate } from "@langchain/core/prompts"; // We can also construct an LLMChain from a ChatPromptTemplate and a chat model. const chat = new ChatOpenAI({ temperature: 0 }); const chatPrompt = ChatPromptTempl...
langchainjs/examples/src/chains/llm_chain_chat.ts/0
{ "file_path": "langchainjs/examples/src/chains/llm_chain_chat.ts", "repo_id": "langchainjs", "token_count": 243 }
790
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-hubspot/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-hubspot/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,451
""" Dataset reader that wraps TFDS datasets Wraps many (most?) TFDS image-classification datasets from https://github.com/tensorflow/datasets https://www.tensorflow.org/datasets/catalog/overview#image_classification Hacked together by / Copyright 2020 Ross Wightman """ import math import os import sys from typing imp...
pytorch-image-models/timm/data/readers/reader_tfds.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/reader_tfds.py", "repo_id": "pytorch-image-models", "token_count": 7089 }
371
"""Hive data reader.""" from typing import List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class HiveReader(BaseReader): """ Read documents from a Hive. These documents can then be used in a downstream Llama Index data structure. Arg...
llama_index/llama-index-integrations/readers/llama-index-readers-hive/llama_index/readers/hive/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hive/llama_index/readers/hive/base.py", "repo_id": "llama_index", "token_count": 895 }
1,312
Tokenizers ==================================================================================================== Fast State-of-the-art tokenizers, optimized for both research and production `🤗 Tokenizers`_ provides an implementation of today's most used tokenizers, with a focus on performance and versatility. These t...
tokenizers/docs/source/index.rst/0
{ "file_path": "tokenizers/docs/source/index.rst", "repo_id": "tokenizers", "token_count": 404 }
458
from langchain_community.retrievers.google_vertex_ai_search import ( GoogleCloudEnterpriseSearchRetriever, GoogleVertexAIMultiTurnSearchRetriever, GoogleVertexAISearchRetriever, ) __all__ = [ "GoogleVertexAISearchRetriever", "GoogleVertexAIMultiTurnSearchRetriever", "GoogleCloudEnterpriseSearch...
langchain/libs/langchain/langchain/retrievers/google_vertex_ai_search.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/google_vertex_ai_search.py", "repo_id": "langchain", "token_count": 123 }
567
from dataclasses import dataclass from typing import Any, Dict, List import numpy as np from llama_index.core.response import Response from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.bridge.pydantic import Field from llama_index.core.query_engine import CustomQueryEngine from llama_ind...
llama_index/llama-index-packs/llama-index-packs-self-rag/llama_index/packs/self_rag/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-self-rag/llama_index/packs/self_rag/base.py", "repo_id": "llama_index", "token_count": 4669 }
1,727
<!--- Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/examples/tensorflow/benchmarking/README.md/0
{ "file_path": "transformers/examples/tensorflow/benchmarking/README.md", "repo_id": "transformers", "token_count": 493 }
561
"""Load documents from Evernote. https://gist.github.com/foxmask/7b29c43a161e001ff04afdb2f181e31c """ import hashlib import logging from base64 import b64decode from time import strptime from typing import Any, Dict, Iterator, List, Optional from langchain_core.documents import Document from langchain_community.docu...
langchain/libs/community/langchain_community/document_loaders/evernote.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/evernote.py", "repo_id": "langchain", "token_count": 2605 }
231
import sys from typing import Any, Dict, List from unittest.mock import MagicMock, patch import pytest from langchain_community.embeddings import GradientEmbeddings _MODEL_ID = "my_model_valid_id" _GRADIENT_SECRET = "secret_valid_token_123456" _GRADIENT_WORKSPACE_ID = "valid_workspace_12345" _GRADIENT_BASE_URL = "ht...
langchain/libs/community/tests/unit_tests/embeddings/test_gradient_ai.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/embeddings/test_gradient_ai.py", "repo_id": "langchain", "token_count": 1861 }
404
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lice...
transformers/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py/0
{ "file_path": "transformers/src/transformers/models/deprecated/transfo_xl/modeling_transfo_xl.py", "repo_id": "transformers", "token_count": 25754 }
659
"""Wolfram Alpha tool spec.""" import urllib.parse from typing import Optional import requests from llama_index.core.tools.tool_spec.base import BaseToolSpec QUERY_URL_TMPL = "http://api.wolframalpha.com/v1/result?appid={app_id}&i={query}" class WolframAlphaToolSpec(BaseToolSpec): """Wolfram Alpha tool spec.""...
llama_index/llama-index-integrations/tools/llama-index-tools-wolfram-alpha/llama_index/tools/wolfram_alpha/base.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-wolfram-alpha/llama_index/tools/wolfram_alpha/base.py", "repo_id": "llama_index", "token_count": 441 }
1,588
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
trl/tests/testing_utils.py/0
{ "file_path": "trl/tests/testing_utils.py", "repo_id": "trl", "token_count": 1062 }
791
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-chatgpt-plugin/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-chatgpt-plugin/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,386
import ast from typing import List, Optional from llama_index.core.tools.tool_spec.base import BaseToolSpec class PythonFileToolSpec(BaseToolSpec): spec_functions = ["function_definitions", "get_function", "get_functions"] def __init__(self, file_name: str) -> None: f = open(file_name).read() ...
llama_index/llama-index-integrations/tools/llama-index-tools-python-file/llama_index/tools/python_file/base.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-python-file/llama_index/tools/python_file/base.py", "repo_id": "llama_index", "token_count": 838 }
1,498
"""Test String Iterable Reader.""" from llama_index.core.readers.string_iterable import StringIterableReader def test_load() -> None: """Test loading data into StringIterableReader.""" reader = StringIterableReader() documents = reader.load_data(texts=["I went to the store", "I bought an apple"]) ass...
llama_index/llama-index-core/tests/readers/test_string_iterable.py/0
{ "file_path": "llama_index/llama-index-core/tests/readers/test_string_iterable.py", "repo_id": "llama_index", "token_count": 108 }
1,242
import { InputValues, OutputValues, MemoryVariables, getInputValue, getOutputValue, } from "@langchain/core/memory"; import { getBufferString } from "@langchain/core/messages"; import { AsyncCaller, AsyncCallerParams, } from "@langchain/core/utils/async_caller"; import { BaseChatMemory, BaseChatMemoryInpu...
langchainjs/libs/langchain-community/src/memory/motorhead_memory.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/memory/motorhead_memory.ts", "repo_id": "langchainjs", "token_count": 1937 }
961
"""Redis Ingestion Pipeline Completion pack.""" from typing import Any, Dict, List from llama_index.core.ingestion.cache import IngestionCache from llama_index.core.ingestion.pipeline import IngestionPipeline from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.schema import BaseNode, Tra...
llama_index/llama-index-packs/llama-index-packs-redis-ingestion-pipeline/llama_index/packs/redis_ingestion_pipeline/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-redis-ingestion-pipeline/llama_index/packs/redis_ingestion_pipeline/base.py", "repo_id": "llama_index", "token_count": 815 }
1,589
"""Custom agent worker.""" import uuid from abc import abstractmethod from typing import ( Any, Callable, Dict, List, Optional, Sequence, Tuple, cast, ) from llama_index.legacy.agent.types import ( BaseAgentWorker, Task, TaskStep, TaskStepOutput, ) from llama_index.lega...
llama_index/llama-index-legacy/llama_index/legacy/agent/custom/simple.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/agent/custom/simple.py", "repo_id": "llama_index", "token_count": 3760 }
1,575
"""CSV toolkit."""
langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/csv/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/csv/__init__.py", "repo_id": "langchain", "token_count": 8 }
411
package proxy import ( "context" "fmt" "strings" "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "github.com/milvus-io/milvus/pkg/log" "github.com/milvus-io/milvus/pkg/metrics" "github.com/milvus-io/milvus/pkg/util" "github.com/milvus-io/m...
milvus/internal/proxy/authentication_interceptor.go/0
{ "file_path": "milvus/internal/proxy/authentication_interceptor.go", "repo_id": "milvus", "token_count": 1317 }
1,823
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,669
import assert from "assert"; import { OpenAI } from "langchain/llms/openai"; import { LLMChain } from "langchain/chains"; import { ChatPromptTemplate } from "langchain/prompts"; import { loadPrompt } from "langchain/prompts/load"; import { MemoryVectorStore } from "langchain/vectorstores/memory"; import { OpenAIEmbeddi...
langchainjs/environment_tests/test-exports-bun/src/index.ts/0
{ "file_path": "langchainjs/environment_tests/test-exports-bun/src/index.ts", "repo_id": "langchainjs", "token_count": 723 }
774
# 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/examples/pytorch/semantic-segmentation/run_semantic_segmentation_no_trainer.py/0
{ "file_path": "transformers/examples/pytorch/semantic-segmentation/run_semantic_segmentation_no_trainer.py", "repo_id": "transformers", "token_count": 11989 }
551
from rag_timescale_conversation.chain import chain __all__ = ["chain"]
langchain/templates/rag-timescale-conversation/rag_timescale_conversation/__init__.py/0
{ "file_path": "langchain/templates/rag-timescale-conversation/rag_timescale_conversation/__init__.py", "repo_id": "langchain", "token_count": 23 }
669
from langchain_community.retrievers.embedchain import EmbedchainRetriever __all__ = ["EmbedchainRetriever"]
langchain/libs/langchain/langchain/retrievers/embedchain.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/embedchain.py", "repo_id": "langchain", "token_count": 34 }
531
# Telegram >[Telegram Messenger](https://web.telegram.org/a/) is a globally accessible freemium, cross-platform, encrypted, cloud-based and centralized instant messaging service. The application also provides optional end-to-end encrypted chats and video calling, VoIP, file sharing and several other features. ## Ins...
langchain/docs/docs/integrations/providers/telegram.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/telegram.mdx", "repo_id": "langchain", "token_count": 166 }
158
export async function share(url: string, title: string) { if (navigator.share) { navigator.share({ url, title }); } else { await navigator.clipboard.writeText(url); } }
chat-ui/src/lib/utils/share.ts/0
{ "file_path": "chat-ui/src/lib/utils/share.ts", "repo_id": "chat-ui", "token_count": 63 }
113
import builtins import json from typing import Optional, Type, Union from langchain_core.callbacks import AsyncCallbackManagerForToolRun from langchain_core.pydantic_v1 import BaseModel, Field from langchain_community.tools.ainetwork.base import AINBaseTool, OperationType class ValueSchema(BaseModel): """Schema...
langchain/libs/community/langchain_community/tools/ainetwork/value.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/ainetwork/value.py", "repo_id": "langchain", "token_count": 1036 }
277
"""Spark SQL agent."""
langchain/libs/community/langchain_community/agent_toolkits/spark_sql/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/spark_sql/__init__.py", "repo_id": "langchain", "token_count": 8 }
214
# coding=utf-8 # Copyright 2022 {{cookiecutter.authors}} 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/lice...
transformers/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/tokenization_fast_{{cookiecutter.lowercase_modelname}}.py/0
{ "file_path": "transformers/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/tokenization_fast_{{cookiecutter.lowercase_modelname}}.py", "repo_id": "transformers", "token_count": 2997 }
721
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "storage/upstash_redis", }); export * from "@langchain/community/storage/upstash_redis";
langchainjs/langchain/src/storage/upstash_redis.ts/0
{ "file_path": "langchainjs/langchain/src/storage/upstash_redis.ts", "repo_id": "langchainjs", "token_count": 78 }
937
# 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/data2vec/convert_data2vec_audio_original_pytorch_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/data2vec/convert_data2vec_audio_original_pytorch_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 4725 }
587
from langchain_core.language_models.base import LanguageModelLike from langchain_core.messages import SystemMessage from langgraph.checkpoint import BaseCheckpointSaver from langgraph.graph import END from langgraph.graph.message import MessageGraph def get_chatbot_executor( llm: LanguageModelLike, system_mes...
opengpts/backend/app/chatbot.py/0
{ "file_path": "opengpts/backend/app/chatbot.py", "repo_id": "opengpts", "token_count": 234 }
2,136
#!/usr/bin/env bash # Copyright 2019 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
milvus/build/docker/krte/wrapper.sh/0
{ "file_path": "milvus/build/docker/krte/wrapper.sh", "repo_id": "milvus", "token_count": 1892 }
1,695
"""ReAct output parser.""" import re from typing import Tuple from llama_index.core.agent.react.types import ( ActionReasoningStep, BaseReasoningStep, ResponseReasoningStep, ) from llama_index.core.output_parsers.utils import extract_json_str from llama_index.core.types import BaseOutputParser def extr...
llama_index/llama-index-core/llama_index/core/agent/react/output_parser.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/agent/react/output_parser.py", "repo_id": "llama_index", "token_count": 1494 }
1,197
"""Zendesk reader.""" import json from typing import List from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class ZendeskReader(BaseReader): """Zendesk reader. Reads data from a Zendesk workspace. Args: zendesk_subdomain (str): Zendesk subdomain ...
llama_index/llama-index-integrations/readers/llama-index-readers-zendesk/llama_index/readers/zendesk/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-zendesk/llama_index/readers/zendesk/base.py", "repo_id": "llama_index", "token_count": 1136 }
1,579
python_sources()
llama_index/llama-index-core/llama_index/core/indices/knowledge_graph/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/knowledge_graph/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,123
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-neutrino/llama_index/llms/neutrino/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-neutrino/llama_index/llms/neutrino/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,362
import { test } from "@jest/globals"; import { HNLoader } from "../web/hn.js"; test("Test Hacker News loader", async () => { const loader = new HNLoader("https://news.ycombinator.com/item?id=34817881"); await loader.load(); });
langchainjs/langchain/src/document_loaders/tests/hn.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/hn.int.test.ts", "repo_id": "langchainjs", "token_count": 82 }
943
# 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/speech_to_text/processing_speech_to_text.py/0
{ "file_path": "transformers/src/transformers/models/speech_to_text/processing_speech_to_text.py", "repo_id": "transformers", "token_count": 1792 }
723
// 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/commonpbutil/commonpbutil.go/0
{ "file_path": "milvus/pkg/util/commonpbutil/commonpbutil.go", "repo_id": "milvus", "token_count": 859 }
1,928
import type { CSPair } from "ansi-styles"; import styles from "ansi-styles"; import { BaseTracer, type AgentRun, type Run } from "./base.js"; function wrap(style: CSPair, text: string) { return `${style.open}${text}${style.close}`; } function tryJsonStringify(obj: unknown, fallback: string) { try { return JSO...
langchainjs/langchain-core/src/tracers/console.ts/0
{ "file_path": "langchainjs/langchain-core/src/tracers/console.ts", "repo_id": "langchainjs", "token_count": 3387 }
841
// 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/proxyutil/proxy_client_manager.go/0
{ "file_path": "milvus/internal/util/proxyutil/proxy_client_manager.go", "repo_id": "milvus", "token_count": 4173 }
1,875
"""Notebook utils.""" from collections import defaultdict from typing import List, Optional, Tuple import pandas as pd from llama_index.core.evaluation import EvaluationResult from llama_index.core.evaluation.retrieval.base import RetrievalEvalResult DEFAULT_METRIC_KEYS = ["hit_rate", "mrr"] def get_retrieval_resu...
llama_index/llama-index-core/llama_index/core/evaluation/notebook_utils.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/evaluation/notebook_utils.py", "repo_id": "llama_index", "token_count": 1000 }
1,117
# order by contributions reviewers: - cydrain - yhmo - xiaocai2333 - sunby approvers: - maintainers
milvus/cmd/OWNERS/0
{ "file_path": "milvus/cmd/OWNERS", "repo_id": "milvus", "token_count": 45 }
1,718
// 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/indexnode_manager_test.go/0
{ "file_path": "milvus/internal/datacoord/indexnode_manager_test.go", "repo_id": "milvus", "token_count": 2371 }
1,693
<jupyter_start><jupyter_text>Open Document Format (ODT)>The [Open Document Format for Office Applications (ODF)](https://en.wikipedia.org/wiki/OpenDocument), also known as `OpenDocument`, is an open file format for word processing documents, spreadsheets, presentations and graphics and using ZIP-compressed XML files. I...
langchain/docs/docs/integrations/document_loaders/odt.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/odt.ipynb", "repo_id": "langchain", "token_count": 279 }
117
/* eslint-disable @typescript-eslint/no-explicit-any */ import { jest, test, expect } from "@jest/globals"; import { Document } from "@langchain/core/documents"; import { FakeEmbeddings } from "@langchain/core/utils/testing"; import { AzureCosmosDBVectorStore } from "../azure_cosmosdb.js"; // Mock mongodb client const...
langchainjs/libs/langchain-community/src/vectorstores/tests/azure_cosmosdb.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/azure_cosmosdb.test.ts", "repo_id": "langchainjs", "token_count": 2033 }
1,016
<jupyter_start><jupyter_text>🧨 Fast Stable Diffusion in free Colab with JAX / Flax on TPU!🤗 Hugging Face [Diffusers](https://github.com/huggingface/diffusers) supports Flax since version `0.5.1`! This allows for snappy inference on Google TPUs, such as those available in Colab, Kaggle or through Google Cloud Platform...
notebooks/diffusers/stable_diffusion_fast_jax.ipynb/0
{ "file_path": "notebooks/diffusers/stable_diffusion_fast_jax.ipynb", "repo_id": "notebooks", "token_count": 1808 }
301
"""Init params."""
llama_index/llama-index-core/llama_index/core/agent/legacy/react/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/agent/legacy/react/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,174
from llama_index.packs.deeplake_deepmemory_retriever.base import DeepMemoryRetrieverPack __all__ = ["DeepMemoryRetrieverPack"]
llama_index/llama-index-packs/llama-index-packs-deeplake-deepmemory-retriever/llama_index/packs/deeplake_deepmemory_retriever/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-deeplake-deepmemory-retriever/llama_index/packs/deeplake_deepmemory_retriever/__init__.py", "repo_id": "llama_index", "token_count": 43 }
1,650
python_sources()
llama_index/llama-index-core/llama_index/core/readers/file/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/readers/file/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,202
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-txtai/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-txtai/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,627
<!--⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer. --> # Webサーバー用のパイプラインの使用 <Tip> 推論エンジンの作成は複雑なトピックであり、"最適な"ソリューションはおそらく問題の領域に依存するでしょう。CPUまたはGPUを使用していますか?最低のレイテンシ、最高のスループット、多くのモデルのサポート、または特定のモデルの高度な最適化を望...
transformers/docs/source/ja/pipeline_webserver.md/0
{ "file_path": "transformers/docs/source/ja/pipeline_webserver.md", "repo_id": "transformers", "token_count": 3398 }
547
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/blip_2/convert_blip_2_original_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/blip_2/convert_blip_2_original_to_pytorch.py", "repo_id": "transformers", "token_count": 5162 }
614
# Copyright 2024 Katherine Crowson and 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...
diffusers/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py/0
{ "file_path": "diffusers/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py", "repo_id": "diffusers", "token_count": 8875 }
271
"""Test Konko API wrapper. In order to run this test, you need to have an Konko api key. You'll then need to set KONKO_API_KEY environment variable to your api key. """ import pytest as pytest from langchain_community.llms import Konko def test_konko_call() -> None: """Test simple call to konko.""" llm = Ko...
langchain/libs/community/tests/integration_tests/llms/test_konko.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_konko.py", "repo_id": "langchain", "token_count": 402 }
364
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querynodev2/segments/validate.go/0
{ "file_path": "milvus/internal/querynodev2/segments/validate.go", "repo_id": "milvus", "token_count": 1089 }
1,996
import langchain_core.tracers.schemas as schemas from langchain_core.tracers.schemas import __all__ as schemas_all def test_public_api() -> None: """Test for changes in the public API.""" expected_all = [ "BaseRun", "ChainRun", "LLMRun", "Run", "RunTypeEnum", "T...
langchain/libs/core/tests/unit_tests/tracers/test_schemas.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/tracers/test_schemas.py", "repo_id": "langchain", "token_count": 330 }
440
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/models/sew/__init__.py/0
{ "file_path": "transformers/src/transformers/models/sew/__init__.py", "repo_id": "transformers", "token_count": 679 }
658
#!/usr/bin/env python # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
transformers/examples/tensorflow/language-modeling-tpu/train_unigram.py/0
{ "file_path": "transformers/examples/tensorflow/language-modeling-tpu/train_unigram.py", "repo_id": "transformers", "token_count": 1489 }
583
from llama_index.readers.azcognitive_search.base import AzCognitiveSearchReader __all__ = ["AzCognitiveSearchReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-azcognitive-search/llama_index/readers/azcognitive_search/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-azcognitive-search/llama_index/readers/azcognitive_search/__init__.py", "repo_id": "llama_index", "token_count": 36 }
1,295
<jupyter_start><jupyter_text>BabyAGI with ToolsThis notebook builds on top of [baby agi](baby_agi.html), but shows how you can swap out the execution chain. The previous execution chain was just an LLM which made stuff up. By swapping it out with an agent that has access to tools, we can hopefully get real reliable inf...
langchain/cookbook/baby_agi_with_agent.ipynb/0
{ "file_path": "langchain/cookbook/baby_agi_with_agent.ipynb", "repo_id": "langchain", "token_count": 1471 }
75
"""Jina embeddings file.""" from typing import Any, List, Optional import requests from llama_index.core.base.embeddings.base import ( DEFAULT_EMBED_BATCH_SIZE, BaseEmbedding, ) from llama_index.core.bridge.pydantic import Field, PrivateAttr from llama_index.core.callbacks.base import CallbackManager from lla...
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-jinaai/llama_index/embeddings/jinaai/base.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-jinaai/llama_index/embeddings/jinaai/base.py", "repo_id": "llama_index", "token_count": 1794 }
1,279
--- hide_table_of_contents: true --- # Hacker News This example goes over how to load data from the hacker news website, using Cheerio. One document will be created for each page. ## Setup ```bash npm2yarn npm install cheerio ``` ## Usage ```typescript import { HNLoader } from "langchain/document_loaders/web/hn";...
langchainjs/docs/core_docs/docs/integrations/document_loaders/web_loaders/hn.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/document_loaders/web_loaders/hn.mdx", "repo_id": "langchainjs", "token_count": 147 }
715
"""Reorder documents""" from typing import Any, List, Sequence from langchain_core.documents import BaseDocumentTransformer, Document from langchain_core.pydantic_v1 import BaseModel def _litm_reordering(documents: List[Document]) -> List[Document]: """Lost in the middle reorder: the less relevant documents will...
langchain/libs/community/langchain_community/document_transformers/long_context_reorder.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_transformers/long_context_reorder.py", "repo_id": "langchain", "token_count": 486 }
254
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/models/nat/__init__.py/0
{ "file_path": "transformers/src/transformers/models/nat/__init__.py", "repo_id": "transformers", "token_count": 657 }
637
"""Test NLPCloud API wrapper.""" from pathlib import Path from typing import cast from langchain_core.pydantic_v1 import SecretStr from pytest import CaptureFixture, MonkeyPatch from langchain_community.llms.loading import load_llm from langchain_community.llms.nlpcloud import NLPCloud from tests.integration_tests.l...
langchain/libs/community/tests/integration_tests/llms/test_nlpcloud.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_nlpcloud.py", "repo_id": "langchain", "token_count": 536 }
372
# 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_2/test_stable_diffusion_flax_inpaint.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion_flax_inpaint.py", "repo_id": "diffusers", "token_count": 1259 }
267
""" PyTorch LARS / LARC Optimizer An implementation of LARS (SGD) + LARC in PyTorch Based on: * PyTorch SGD: https://github.com/pytorch/pytorch/blob/1.7/torch/optim/sgd.py#L100 * NVIDIA APEX LARC: https://github.com/NVIDIA/apex/blob/master/apex/parallel/LARC.py Additional cleanup and modifications to properly su...
pytorch-image-models/timm/optim/lars.py/0
{ "file_path": "pytorch-image-models/timm/optim/lars.py", "repo_id": "pytorch-image-models", "token_count": 2571 }
406
{ "dependencies": { "chromadb": "^1.5.3", "cohere-ai": "^6.2.2" } }
chroma/examples/use_with/cohere/package.json/0
{ "file_path": "chroma/examples/use_with/cohere/package.json", "repo_id": "chroma", "token_count": 49 }
45
"""Test voyage embeddings.""" from langchain_community.embeddings.voyageai import VoyageEmbeddings # Please set VOYAGE_API_KEY in the environment variables MODEL = "voyage-01" def test_voyagi_embedding_documents() -> None: """Test voyage embeddings.""" documents = ["foo bar"] embedding = VoyageEmbeddings...
langchain/libs/community/tests/integration_tests/embeddings/test_voyageai.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/embeddings/test_voyageai.py", "repo_id": "langchain", "token_count": 374 }
350
use crate::benchmarks::{BenchDevice, BenchDeviceHandler}; use candle_core::{DType, Device, Tensor}; use criterion::{black_box, criterion_group, Criterion, Throughput}; use std::time::Instant; fn run(a: &Tensor) { a.affine(12.34, 56.78).unwrap(); } fn run_affine_benchmark(c: &mut Criterion, device: &Device, dtype:...
candle/candle-core/benches/benchmarks/affine.rs/0
{ "file_path": "candle/candle-core/benches/benchmarks/affine.rs", "repo_id": "candle", "token_count": 591 }
31
--- sidebar_position: 2 --- # Chatbots ## Overview Chatbots are one of the most popular use-cases for LLMs. The core features of chatbots are that they can have long-running, stateful conversations and can answer user questions using relevant information. ## Architectures Designing a chatbot involves considering v...
langchainjs/docs/core_docs/docs/use_cases/chatbots/index.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/use_cases/chatbots/index.mdx", "repo_id": "langchainjs", "token_count": 437 }
754
# LlamaIndex Vector_Stores Integration: Weaviate
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/README.md", "repo_id": "llama_index", "token_count": 14 }
1,682
"""Test Fireworks chat model""" import sys import pytest from langchain_core.pydantic_v1 import SecretStr from pytest import CaptureFixture from langchain_community.llms import Fireworks if sys.version_info < (3, 9): pytest.skip("fireworks-ai requires Python > 3.8", allow_module_level=True) @pytest.mark.requi...
langchain/libs/community/tests/unit_tests/llms/test_fireworks.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/llms/test_fireworks.py", "repo_id": "langchain", "token_count": 293 }
398
from __future__ import annotations import copy import json import logging from typing import ( TYPE_CHECKING, Any, Dict, List, Literal, Optional, TypedDict, Union, overload, ) from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) ...
langchain/libs/community/langchain_community/llms/openllm.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/openllm.py", "repo_id": "langchain", "token_count": 5148 }
272
# Consuming Text Generation Inference There are many ways you can consume Text Generation Inference server in your applications. After launching, you can use the `/generate` route and make a `POST` request to get results from the server. You can also use the `/generate_stream` route if you want TGI to return a stream ...
text-generation-inference/docs/source/basic_tutorials/consuming_tgi.md/0
{ "file_path": "text-generation-inference/docs/source/basic_tutorials/consuming_tgi.md", "repo_id": "text-generation-inference", "token_count": 2274 }
370
//go:build linux // +build linux package accesslog import ( "os" "syscall" ) func chown(name string, info os.FileInfo) error { f, err := os.OpenFile(name, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, info.Mode()) if err != nil { return err } f.Close() stat := info.Sys().(*syscall.Stat_t) return os.Chown(name, int(s...
milvus/internal/proxy/accesslog/chown_linux.go/0
{ "file_path": "milvus/internal/proxy/accesslog/chown_linux.go", "repo_id": "milvus", "token_count": 153 }
1,733
import { base } from "$app/paths"; import { ERROR_MESSAGES, error } from "$lib/stores/errors"; import { share } from "./utils/share"; import { page } from "$app/stores"; import { get } from "svelte/store"; import { getShareUrl } from "./utils/getShareUrl"; export async function shareConversation(id: string, title: stri...
chat-ui/src/lib/shareConversation.ts/0
{ "file_path": "chat-ui/src/lib/shareConversation.ts", "repo_id": "chat-ui", "token_count": 359 }
93
# Query Engines
llama_index/docs/community/faq/query_engines.md/0
{ "file_path": "llama_index/docs/community/faq/query_engines.md", "repo_id": "llama_index", "token_count": 5 }
1,084
"""O365 tool utils.""" from __future__ import annotations import logging import os from typing import TYPE_CHECKING if TYPE_CHECKING: from amadeus import Client logger = logging.getLogger(__name__) def authenticate() -> Client: """Authenticate using the Amadeus API""" try: from amadeus import C...
langchain/libs/community/langchain_community/tools/amadeus/utils.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/amadeus/utils.py", "repo_id": "langchain", "token_count": 521 }
281