Create a new secret key at https://app.relevanceai.com/login/sdk. Scroll to the bottom of the integrations page and click on ”+ Create new secret key” and select “Admin” permissions.
Create the RelevanceAI client by importing the library.
Python
Copy
from relevanceai import RelevanceAIclient = RelevanceAI()
You can validate the client credentials by storing the following environment variables and loading them into your project with python-dotenv or os library. Your client should run without any errors.
.env
Copy
RAI_API_KEY=RAI_REGION=RAI_PROJECT=
Python
Copy
from dotenv import load_dotenvload_dotenv()from relevanceai import RelevanceAIclient = RelevanceAI()
Or you can pass the credentials directly to the client.
Python
Copy
from relevanceai import RelevanceAIclient = RelevanceAI( api_key="your_api_key", region="your_region", project="your_project")
You are now ready to start using Relevance AI via the Python SDK.