This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import weaviate | |
| from weaviate.connect import ConnectionParams | |
| from weaviate.classes.config import Property, DataType | |
| import weaviate.classes.config as Configure | |
| COLLECT_NAME = "document" | |
| client = weaviate.WeaviateClient( | |
| connection_params=ConnectionParams.from_url( | |
| "http://localhost:8080", | |
| grpc_port=50051 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from qdrant_client import QdrantClient | |
| from qdrant_client.models import PointStruct | |
| import random | |
| client = QdrantClient( | |
| url="http://localhost:6333" | |
| ) | |
| points = [ | |
| PointStruct( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ChromaDB + Ollama を使用したベクトル検索のサンプルコード | |
| // 必要なパッケージ: | |
| // npm install chromadb ollama | |
| import { ChromaClient } from 'chromadb'; | |
| import ollama from 'ollama'; | |
| // ChromaDBクライアントの初期化 | |
| const chromaClient = new ChromaClient({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import chromadb | |
| import ollama | |
| import uuid | |
| # | |
| # | |
| # | |
| def test(): | |
| # クライアントの初期化 (ローカルにデータベースファイルを作成) | |
| # インメモリで実行する場合は chromadb.Client() を使用します |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GOOGLE_GENAI_USE_VERTEXAI=FALSE | |
| GOOGLE_API_KEY=your-key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import glob | |
| import os | |
| from langchain_text_splitters import RecursiveCharacterTextSplitter | |
| import ollama | |
| import psycopg2 | |
| from pgvector.psycopg2 import register_vector | |
| # PostgreSQL 接続 | |
| conn = psycopg2.connect( | |
| dbname="mydb", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.9" | |
| services: | |
| db: | |
| image: pgvector/pgvector:pg16 | |
| container_name: pgvector-db | |
| restart: always | |
| environment: | |
| POSTGRES_USER: root | |
| POSTGRES_PASSWORD: admin | |
| POSTGRES_DB: mydb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // app/lib/RpcClient.ts | |
| import { spawn } from "child_process"; | |
| class RpcClient { | |
| constructor(command: any) { | |
| /* @ts-ignore */ | |
| this.proc = spawn(command); | |
| /* @ts-ignore */ | |
| this.idCounter = 1; | |
| /* @ts-ignore */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Cloudflare Workers - MCP Server with JSON-RPC 2.0 | |
| * Model Context Protocol Remote Server Implementation | |
| */ | |
| export default { | |
| async fetch(request, env, ctx) { | |
| // CORS headers | |
| const corsHeaders = { | |
| 'Access-Control-Allow-Origin': '*', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const start = async function() { | |
| try{ | |
| const item = { | |
| "jsonrpc": "2.0", | |
| "method": "tools/list", | |
| "id": 2 | |
| } | |
| const response = await fetch("http://localhost:3000/mcp", { |
NewerOlder