Repository navigation
Accept the cyber guideline category and allow behavior - #245
Merged
Merged
Conversation
Omar-V2
approved these changes
Oct 30, 2026
Omar-V2
pushed a commit
to xai-org/xai-proto
that referenced
this pull request
Oct 30, 2026
Adds `GUIDELINE_CATEGORY_CYBER = 6` to `GuidelineCategory` and `GUIDELINE_BEHAVIOR_ALLOW = 3` to `GuidelineBehavior`. The API already accepts them. `CYBER` accepts only `ALLOW`, and only on API keys enabled for it. Other keys get `PERMISSION_DENIED`. The `PolicyGuideline` and `guidelines` field comments and the unreleased CHANGELOG entry are updated to match. The change is additive, and `buf lint` and `buf breaking` against `main` pass locally. The matching SDK change is xai-org/xai-sdk-python#245.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
client.chat.create(sync and async) now accepts thecyberguideline category and theallowbehavior, as in{"type": "policy", "category": "cyber", "behavior": "allow"}. The API acceptscyberonly withallow, and only on API keys enabled for it. Other keys getPERMISSION_DENIED. Before this change, the SDK raisedValueErrorfor both values.GuidelineCategory,GuidelineBehavior, and their lookup maps gain the new values. Theguidelinesdocstring and the CHANGELOG describe them.The v5 and v6
chat_pb2stubs change only by the two enum values. They are emitted from the vendored descriptors with the two values added, using protoc 29.1 for v5 and protoc 30.0 for v6. Without the two values, the same pipeline reproduces the vendored stubs byte for byte.Verification:
ruff,pyright, andpytestpass: 871 tests under protobuf 6.31.1 and under 5.29.6.api.x.aiwith a key that is not enabled returnPERMISSION_DENIEDforcyberwithallow, andINVALID_ARGUMENTforcyberwithdecline, under both protobuf majors.Depends on xai-org/xai-proto#84, which adds
GUIDELINE_CATEGORY_CYBERandGUIDELINE_BEHAVIOR_ALLOW.