coderabbitai / ai-pr-reviewer

AI-based Pull Request Summarizer and Reviewer with Chat Capabilities.
https://coderabbit.ai
MIT License
1.41k stars 256 forks source link

getting 404 resource not found error #382

Open darshilshahquantive opened 11 months ago

darshilshahquantive commented 11 months ago

using azure openai as openai_base_url? i am trying to do it and getting this error :

response: undefined, failed to send message to openai: Error: OpenAI error 404: {"error":{"code":"404","message": "Resource not found"}}, backtrace: Error: OpenAI error 404: {"error":{"code":"404","message": "Resource not found"}} at Promise.then.promptTokens (/actions-runner/_work/_actions/fluxninja/openai-pr-reviewer/latest/dist/index.js:3310:29) at processTicksAndRejections (node:internal/process/task_queues:96:5)

and this is how my workflow yaml looks like :

name: Code Review

permissions:
contents: read
pull-requests: write

on:
pull_request:
pull_request_review_comment:
types: [ created ]

concurrency:
group:
${{ github.repository }}-${{ github.event.number || github.head_ref ||
github.sha }}-${{ github.workflow }}-${{ github.event_name ==
'pull_request_review_comment' && 'pr_comment' || 'pr' }}
cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }}

jobs:
review:
runs-on: self-hosted
environment: new-env
steps:
- uses: fluxninja/openai-pr-reviewer@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
with:
debug: false
openai_base_url: https://"your endpoint deployment name".openai.azure.com/
openai_light_model: gpt-35-turbo
openai_heavy_model: gpt-35-turbo
harjotgill commented 11 months ago

Model name looks incorrect. Try gpt-3.5-turbo

darshilshahquantive commented 11 months ago

Tried same error , i tried this name as in azure openai services the model name deployed under this name

darshilshahquantive commented 11 months ago

@harjotgill i got the issue now , basically we are using the chatgpt node package but to use azure/openai as a openai base URL we will need to add support for azure/openai node package as they both have different api's altogether

dulalbert commented 11 months ago

Azure OpenAi support can be added with this I guess : https://github.com/transitive-bullshit/chatgpt-api/issues/352#issuecomment-1506801907

harjotgill commented 11 months ago

If you folks fix it, please contribute back! Cheers!

darshilshahquantive commented 11 months ago

Yes it works , i will push it with generalising the feature with paramas https://github.com/darshilshahquantive/ai-pr-reviewer

darinkishore commented 10 months ago

@darshilshahquantive Did you change anything typescript wise, or just index.js to get it working? This thing has been a huge pain in my butt these last couple weeks, so any help would be appreciated.

darshilshahquantive commented 10 months ago

index.ts fix will work but if you want to use azure 3.5 turbo with 16 k context you have to edit limit.ts else it will use this much tokrn limit by default https://github.com/darshilshahquantive/ai-pr-reviewer/blob/10783d111ba827426dc67c38e809283ad18877ca/src/limits.ts#L21