deepmodeling / deepmodeling/SciAssess
Problem with OpenAI keys and base url
- Dominant language
- Python
- Stars
- 89
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
I was following the steps described in the README.md and I couldn't make the connection with OpenAI. According to the README.md we need to do the following exports:
```bash
export OPENAI_BASE_URL=your_openai_base_url
export OPENAI_API_KEY=your_openai_api_key
```
After debugging your code, I didn't find any mechanism for the program to read it. Instead I found the following in the file `openai-asure.py`:
```python
key_4 = [
{"api_base": "", "api_key": "", "api_version": ''},
]
key_35 = [
{"api_base": "", "api_key": "", "api_version": ''},
]
...
self.key_pool = key_4 if model.startswith('gpt-4') else key_35
...
choose_api = random.choice(self.key_pool) # -> {'api_base': '', 'api_key': '', 'api_version': ''}
api_base = choose_api["api_base"]
api_key = choose_api['api_key']
api_version = choose_api['api_version']
client = AzureOpenAI(
azure_endpoint=api_base,
api_key=api_key,
api_version=api_version
)
```
Why is `choose_api` picked randomly?
The values are `{'api_base': '', 'api_key': '', 'api_version': ''}`, therefore in order to make the code work, I had to input the api_base, api_key, and api_version directly into the code.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.