File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -27,11 +27,16 @@ The full API of this library can be found in [api.md](api.md).
2727import os
2828from gradientai import GradientAI
2929
30- client = GradientAI(
30+ api_client = GradientAI(
3131 api_key = os.environ.get(" GRADIENTAI_API_KEY" ), # This is the default and can be omitted
3232)
33+ inference_client = GradientAI(
34+ inference_key = os.environ.get(" GRADIENTAI_INFERENCE_KEY" ), # This is the default and can be omitted
35+ )
3336
34- completion = client.agents.chat.completions.create(
37+ print (api_client.agents.list())
38+
39+ completion = inference_client.agents.chat.completions.create(
3540 messages = [
3641 {
3742 " content" : " string" ,
@@ -40,12 +45,13 @@ completion = client.agents.chat.completions.create(
4045 ],
4146 model = " llama3-8b-instruct" ,
4247)
43- print (completion.id)
48+ print (completion.choices[0 ].message)
49+
4450```
4551
46- While you can provide an ` api_key ` keyword argument,
52+ While you can provide an ` inference_key ` keyword argument,
4753we recommend using [ python-dotenv] ( https://pypi.org/project/python-dotenv/ )
48- to add ` GRADIENTAI_API_KEY ="My API Key"` to your ` .env ` file
54+ to add ` GRADIENTAI_INFERENCE_KEY ="My API Key"` to your ` .env ` file
4955so that your API Key is not stored in source control.
5056
5157## Async usage
You can’t perform that action at this time.
0 commit comments