From 28e91ddae18d70c481f6b68243a636a3e344f7c0 Mon Sep 17 00:00:00 2001 From: yuiseki Date: Fri, 5 Jan 2024 15:17:24 +0900 Subject: [PATCH] tweak docker-compose.yml --- docker-compose.yml | 20 +++++++++++++++++++ .../loadConcernPlaceExtractorChain/index.ts | 11 +++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4f6a3777..ce567b38 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,27 @@ services: devices: - driver: nvidia capabilities: [gpu] + overpass-api: + # MEMO: + # http://localhost:5000/api/interpreter?data=[out:json];rel(2220322);out; + image: wiktorn/overpass-api + ports: + - 5000:80 + volumes: + - overpass-db:/db + environment: + - OVERPASS_META=no + - OVERPASS_MODE=init + - OVERPASS_PLANET_URL=http://download.geofabrik.de/europe/monaco-latest.osm.bz2 + - OVERPASS_DIFF_URL=http://download.openstreetmap.fr/replication/europe/monaco/minute/ + - OVERPASS_UPDATE_SLEEP=60 + - OVERPASS_USE_AREAS=true + - OVERPASS_STOP_AFTER_INIT=false + - OVERPASS_MAX_TIMEOUT=30000 networks: myapp: name: myapp + +volumes: + overpass-db: diff --git a/src/utils/langchain/chains/loadConcernPlaceExtractorChain/index.ts b/src/utils/langchain/chains/loadConcernPlaceExtractorChain/index.ts index 1c721089..4d01cade 100644 --- a/src/utils/langchain/chains/loadConcernPlaceExtractorChain/index.ts +++ b/src/utils/langchain/chains/loadConcernPlaceExtractorChain/index.ts @@ -174,7 +174,16 @@ DisplayMap: リビアの国連施設の地図を表示します。`, ]; export const setupConcernPlaceExtractorDynamicPrompt = async () => { - const embeddings = new OpenAIEmbeddings(); + let embeddings: OpenAIEmbeddings; + if (process.env.CLOUDFLARE_AI_GATEWAY) { + embeddings = new OpenAIEmbeddings({ + configuration: { + baseURL: process.env.CLOUDFLARE_AI_GATEWAY + "/openai", + }, + }); + } else { + embeddings = new OpenAIEmbeddings(); + } const memoryVectorStore = new MemoryVectorStore(embeddings); const concernPlaceExtractExampleSelector = new SemanticSimilarityExampleSelector({