Open andersfalt opened 7 months ago
@andersfalt
Check your API key and make sure input your API key in .env and run:
make sync
or
dart run build_runner build --delete-conflicting-outputs
You can see your API key generated in project at path: lib/core/src/config/env.g.dart
@andersfalt OMG @@ I think i know issue.
You used:
OPEN_AI_API_KEY=<sk-NM6A*****************************************MC1>
=> This not correct.
You should be change to here:
OPEN_AI_API_KEY=sk-NM6A*****************************************MC1
I did the changes that you suggested, but I am still getting the same error.
@andersfalt
You make sure run when change env?
make sync
or
dart run build_runner build --delete-conflicting-outputs
And you make sure check your OPEN_AI_API_KEY ?
open terminal and run:
curl https://api.openai.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer $OPEN_AI_API_KEY" -d '{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."
},
{
"role": "user",
"content": "Compose a poem that explains the concept of recursion in programming."
}
]
}'
I get the following error in the terminal
[log] { "provider": "AutoDisposeStateNotifierProvider<DefineStoryVM, WrapState<DefineStoryState>>", "newValue": "WrapState<DefineStoryState>(data: DefineStoryState(loading: true, text: null), appExceptionWrapper: null, isLoading: false, countLoading: 0)" } [OpenAI] Starting to reading stream response 2 [log] Emit Data: DefineStoryState(loading: false, text: null) [log] Emit: WrapState<DefineStoryState>(data: DefineStoryState(loading: true, text: null), appExceptionWrapper: AppError{appExceptionType: AppExceptionType.uncaugth, message: RequestFailedException(message: Incorrect API key provided: <sk-NM6A*****************************************MC1>. You can find your API key at https://platform.openai.com/account/api-keys., statusCode: 401), error: RequestFailedException(message: Incorrect API key provided: <sk-NM6A*****************************************MC1>. You can find your API key at https://platform.openai.com/account/api-keys., statusCode: 401)}, isLoading: false, countLoading: 0) [log] { "provider": "AutoDisposeStateNotifierProvider<DefineStoryVM, WrapState<DefineStoryState>>", "newValue": "WrapState<DefineStoryState>(data: DefineStoryState(loading: true, text: null), appExceptionWrapper: AppError{appExceptionType: AppExceptionType.uncaugth, message: RequestFailedException(message: Incorrect API key provided: <sk-NM6A*****************************************MC1>. You can find your API key at https://platform.openai.com/account/api-keys., statusCode: 401), error: RequestFailedException(message: Incorrect API key provided: <sk-NM6A*****************************************MC1>. You can find your API key at https://platform.openai.com/account/api-keys., statusCode: 401)}, isLoading: false, countLoading: 0)" } 2 [log] { "provider": "AutoDisposeStateNotifierProvider<DefineStoryVM, WrapState<DefineStoryState>>", "newValue": "WrapState<DefineStoryState>(data: DefineStoryState(loading: false, text: null), appExceptionWrapper: AppError{appExceptionType: AppExceptionType.uncaugth, message: RequestFailedException(message: Incorrect API key provided: <sk-NM6A*****************************************MC1>. You can find your API key at https://platform.openai.com/account/api-keys., statusCode: 401), error: RequestFailedException(message: Incorrect API key provided: <sk-NM6A*****************************************MC1>. You can find your API key at https://platform.openai.com/account/api-keys., statusCode: 401)}, isLoading: false, countLoading: 0)" }