A wrapper around the OpenAI Python library that wraps the Responses API with CrowdStrike AIDR
Project description
CrowdStrike AIDR + OpenAI Python API library
A wrapper around the OpenAI Python library that wraps the Responses API with CrowdStrike AIDR. Supports Python v3.12 and greater.
Installation
pip install -U crowdstrike-aidr-openai
Usage
import os
from crowdstrike_aidr_openai import CrowdStrikeOpenAI
client = CrowdStrikeOpenAI(
api_key=os.environ.get("OPENAI_API_KEY"),
# CrowdStrike AIDR options
crowdstrike_aidr_api_key=os.environ.get("CS_AIDR_API_TOKEN"),
crowdstrike_aidr_base_url_template=os.environ.get("CS_AIDR_BASE_URL_TEMPLATE"),
)
response = client.responses.create(
model="gpt-4o",
instructions="You are a coding assistant that talks like a pirate.",
input="How do I check if a Python object is an instance of a class?",
)
print(response.output_text)
Microsoft Azure OpenAI
To use this library with Azure OpenAI,
use the CrowdStrikeAzureOpenAI class instead of the CrowdStrikeOpenAI class.
from crowdstrike_aidr_openai import CrowdStrikeAzureOpenAI
client = CrowdStrikeAzureOpenAI(
# https://learn.microsoft.com/azure/ai-services/openai/reference#rest-api-versioning
api_version="2023-07-01-preview",
# https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal#create-a-resource
azure_endpoint="https://example-endpoint.openai.azure.com",
# CrowdStrike AIDR options
crowdstrike_aidr_api_key=os.environ.get("CS_AIDR_API_TOKEN"),
crowdstrike_aidr_base_url_template=os.environ.get("CS_AIDR_BASE_URL_TEMPLATE"),
)
completion = client.chat.completions.create(
model="deployment-name", # e.g. gpt-35-instant
messages=[
{
"role": "user",
"content": "How do I output all files in a directory using Python?",
},
],
)
print(completion.to_json())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crowdstrike_aidr_openai-0.2.0.tar.gz.
File metadata
- Download URL: crowdstrike_aidr_openai-0.2.0.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01170607e6a08f2a07c9c88ca712ccff6ebe8a34be89d2e6157a24854cff6856
|
|
| MD5 |
d56bb3c4d3d95b0ab1b22bce15b93104
|
|
| BLAKE2b-256 |
b5cbdc1dfe954636990c72eedb17b4028eccdcdc6ed3e355ab48805c9c899029
|
Provenance
The following attestation bundles were made for crowdstrike_aidr_openai-0.2.0.tar.gz:
Publisher:
publish.yml on CrowdStrike/aidr-openai-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crowdstrike_aidr_openai-0.2.0.tar.gz -
Subject digest:
01170607e6a08f2a07c9c88ca712ccff6ebe8a34be89d2e6157a24854cff6856 - Sigstore transparency entry: 963683091
- Sigstore integration time:
-
Permalink:
CrowdStrike/aidr-openai-python@5fcc7d4cb74f95d68fa41efd81266009462c21f7 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/CrowdStrike
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5fcc7d4cb74f95d68fa41efd81266009462c21f7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file crowdstrike_aidr_openai-0.2.0-py3-none-any.whl.
File metadata
- Download URL: crowdstrike_aidr_openai-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19bbeaf7f265e9837b8aa29d81928e7219e60282a5d49e46802b7effe741a1ee
|
|
| MD5 |
f7ceaea2d97ddbc57af7b03b42539435
|
|
| BLAKE2b-256 |
4f2e78d229a6956573ff3828202576ab34f9cbe5737ee0e81038453cd6b443ea
|
Provenance
The following attestation bundles were made for crowdstrike_aidr_openai-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on CrowdStrike/aidr-openai-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crowdstrike_aidr_openai-0.2.0-py3-none-any.whl -
Subject digest:
19bbeaf7f265e9837b8aa29d81928e7219e60282a5d49e46802b7effe741a1ee - Sigstore transparency entry: 963683196
- Sigstore integration time:
-
Permalink:
CrowdStrike/aidr-openai-python@5fcc7d4cb74f95d68fa41efd81266009462c21f7 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/CrowdStrike
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5fcc7d4cb74f95d68fa41efd81266009462c21f7 -
Trigger Event:
release
-
Statement type: