Python SDK to integrate Ownlayer
Install SDK
pip install ownlayer
Change openai import to use Ownlayer wrapper
- import openai
+ from ownlayer.openai import openai
def some_AI_func:
# use AI as you did before
return openai.chat.completions.create(
...
)
Be sure to have add OWNLAYER_API_KEY
to your .env
file:
OWNLAYER_API_KEY=ey...xxx
First you'll need to install the SDK of your choice (or all of them)
poetry install --extras "openai" # needed to use openai
poetry install --extras "anthropic" # needed to use anthropic
The "examples" folder holds demos of how to use this SDK. In order to run one from root folder run:
python -m examples.<path-to-example>
E.g. to run openai/chat_completion.py
example, run:
python -m examples.openai.chat_completion