openai/openai-python
Publicmirrored from https://github.com/openai/openai-pythonAvailable
src/openai/_extras/_common.py
21lines · modecode
| 1 | from .._exceptions import OpenAIError |
| 2 | |
| 3 | INSTRUCTIONS = """ |
| 4 | |
| 5 | OpenAI error: |
| 6 | |
| 7 | missing `{library}` |
| 8 | |
| 9 | This feature requires additional dependencies: |
| 10 | |
| 11 | $ pip install openai[{extra}] |
| 12 | |
| 13 | """ |
| 14 | |
| 15 | |
| 16 | def format_instructions(*, library: str, extra: str) -> str: |
| 17 | return INSTRUCTIONS.format(library=library, extra=extra) |
| 18 | |
| 19 | |
| 20 | class MissingDependencyError(OpenAIError): |
| 21 | pass |
| 22 | |