@@ -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.chat.completions.create(
3540 messages = [
3641 {
3742 " role" : " user" ,
@@ -40,13 +45,15 @@ completion = client.agents.chat.completions.create(
4045 ],
4146 model = " llama3.3-70b-instruct" ,
4247)
43- print (completion.choices)
48+
49+ print (completion.choices[0 ].message)
50+
4451```
4552
46- While you can provide an ` api_key ` keyword argument,
53+ While you can provide an ` api_key ` , ` inference_key ` keyword argument,
4754we recommend using [ python-dotenv] ( https://pypi.org/project/python-dotenv/ )
48- to add ` GRADIENTAI_API_KEY="My API Key" ` to your ` .env ` file
49- so that your API Key is not stored in source control.
55+ to add ` GRADIENTAI_API_KEY="My API Key" ` , ` GRADIENTAI_INFERENCE_KEY="My INFERENCE Key" ` to your ` .env ` file
56+ so that your keys are not stored in source control.
5057
5158## Async usage
5259
0 commit comments