Bin-Huang / chatbox

User-friendly Desktop Client App for AI Models/LLMs (GPT, Claude, Gemini, Ollama...)
https://chatboxai.app
GNU General Public License v3.0
23.03k stars 2.29k forks source link

[OpenAIEmbeddings issue in OpenRouter] #1486

Open imran-24 opened 3 months ago

imran-24 commented 3 months ago

Is there any dedicated baseURL or endpint for the embedding service in OpenRouter. I have been trying to embed my documents but it's giving me 405 status, 'x-matched-path': '/404'. This is my code - `const embeddings = new OpenAIEmbeddings({ configuration: { baseURL: "https://openrouter.ai/api/v1", // Ensure this is HTTPS }, apiKey: process.env.OPENAI_API_KEY, });

try { const embeddingsArray = await embeddings.embedDocuments(contextArray); console.log(embeddingsArray); } catch (error) { console.error("Error generating embeddings:", error); }`

Error - APIError: 405 status code (no body) at APIError.generate (F:\Headstarter\RagTutorial\node_modules\openai\error.js:68:16) at OpenAI.makeStatusError (F:\Headstarter\RagTutorial\node_modules\openai\core.js:275:33) at OpenAI.makeRequest (F:\Headstarter\RagTutorial\node_modules\openai\core.js:318:30) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async F:\Headstarter\RagTutorial\node_modules\@langchain\openai\dist\embeddings.cjs:271:29 at async RetryOperation._fn (F:\Headstarter\RagTutorial\node_modules\p-retry\index.js:50:12) { status: 405, headers: { 'access-control-allow-credentials': 'true', 'access-control-allow-headers': 'Authorization, User-Agent, X-Api-Key, X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, HTTP-Referer, X-Windowai-Title, X-Openrouter-Title, X-Title, X-Stainless-Lang, X-Stainless-Package-Version, X-Stainless-OS, X-Stainless-Arch, X-Stainless-Runtime, X-Stainless-Runtime-Version', 'access-control-allow-methods': 'GET,OPTIONS,PATCH,DELETE,POST,PUT', 'access-control-allow-origin': '', 'cache-control': 'public, max-age=0, must-revalidate', 'cf-cache-status': 'DYNAMIC', 'cf-ray': '8b3f4b2c588c786d-DAC', connection: 'keep-alive', 'content-disposition': 'inline; filename="404"', 'content-security-policy': "default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://clerk.openrouter.ai https://cunning-heron-18.clerk.accounts.dev https://challenges.cloudflare.com https://checkout.stripe.com https://connect-js.stripe.com https://js.stripe.com https://maps.googleapis.com https://www.googletagmanager.com https://.ingest.sentry.io; connect-src 'self' https://clerk.openrouter.ai https://cunning-heron-18.clerk.accounts.dev https://checkout.stripe.com https://api.stripe.com https://maps.googleapis.com .google-analytics.com https://www.googletagmanager.com https://raw.githubusercontent.com https://.ingest.sentry.io; frame-src 'self' https://challenges.cloudflare.com https://checkout.stripe.com https://connect-js.stripe.com https://js.stripe.com https://hooks.stripe.com https://us5.datadoghq.com https://*.ingest.sentry.io; img-src 'self' data: blob: https://img.clerk.com https://*.stripe.com https://www.googletagmanager.com https://t0.gstatic.com; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' sha256-0hAheEzaMe6uXIKV4EehS9pu1am1lj/KnnzrOYqckXk=; upgrade-insecure-requests", 'content-type': 'text/html; charset=utf-8', date: 'Fri, 16 Aug 2024 06:16:06 GMT', server: 'cloudflare', 'strict-transport-security': 'max-age=63072000', 'transfer-encoding': 'chunked', 'x-matched-path': '/404', 'x-vercel-cache': 'BYPASS', 'x-vercel-id': 'sin1::zgbk9-1723788965955-d69382a99f90' }, request_id: undefined, error: undefined, code: undefined, param: undefined, type: undefined, attemptNumber: 1, retriesLeft: 6 }

shawnmuggle commented 1 month ago

same issue. is it resolved?

imran-24 commented 1 month ago

Couldn't find any solution. If you need to embed a document you may use gemini's embedding service which is free.