Skip to content

Commit a19c164

Browse files
feat: Updating files/content response to return additional fields
Signed-off-by: Francisco Javier Arceo <[email protected]>
1 parent e12524a commit a19c164

File tree

143 files changed

+6892
-15089
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+6892
-15089
lines changed

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
# Get test directories dynamically, excluding non-test directories
5454
# NOTE: we are excluding post_training since the tests take too long
5555
TEST_TYPES=$(find tests/integration -maxdepth 1 -mindepth 1 -type d -printf "%f\n" |
56-
grep -Ev "^(__pycache__|fixtures|test_cases|recordings|post_training)$" |
56+
grep -Ev "^(__pycache__|fixtures|test_cases|recordings|non_ci|post_training)$" |
5757
sort | jq -R -s -c 'split("\n")[:-1]')
5858
echo "test-types=$TEST_TYPES" >> $GITHUB_OUTPUT
5959

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ uv sync
157157
that describes the configuration. These descriptions will be used to generate the provider
158158
documentation.
159159
* When possible, use keyword arguments only when calling functions.
160+
* Llama Stack utilizes [custom Exception classes](llama_stack/apis/common/errors.py) for certain Resources that should be used where applicable.
160161

161162
## Common Tasks
162163

docs/_static/llama-stack-spec.html

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4734,6 +4734,49 @@
47344734
}
47354735
}
47364736
},
4737+
"/v1/openai/v1/moderations": {
4738+
"post": {
4739+
"responses": {
4740+
"200": {
4741+
"description": "A moderation object.",
4742+
"content": {
4743+
"application/json": {
4744+
"schema": {
4745+
"$ref": "#/components/schemas/ModerationObject"
4746+
}
4747+
}
4748+
}
4749+
},
4750+
"400": {
4751+
"$ref": "#/components/responses/BadRequest400"
4752+
},
4753+
"429": {
4754+
"$ref": "#/components/responses/TooManyRequests429"
4755+
},
4756+
"500": {
4757+
"$ref": "#/components/responses/InternalServerError500"
4758+
},
4759+
"default": {
4760+
"$ref": "#/components/responses/DefaultError"
4761+
}
4762+
},
4763+
"tags": [
4764+
"Safety"
4765+
],
4766+
"description": "Classifies if text and/or image inputs are potentially harmful.",
4767+
"parameters": [],
4768+
"requestBody": {
4769+
"content": {
4770+
"application/json": {
4771+
"schema": {
4772+
"$ref": "#/components/schemas/RunModerationRequest"
4773+
}
4774+
}
4775+
},
4776+
"required": true
4777+
}
4778+
}
4779+
},
47374780
"/v1/safety/run-shield": {
47384781
"post": {
47394782
"responses": {
@@ -14778,6 +14821,47 @@
1477814821
"text": {
1477914822
"type": "string",
1478014823
"description": "The actual text content"
14824+
},
14825+
"embedding": {
14826+
"type": "array",
14827+
"items": {
14828+
"type": "number"
14829+
},
14830+
"description": "(Optional) Embedding vector for the content, if available"
14831+
},
14832+
"created_timestamp": {
14833+
"type": "integer",
14834+
"description": "(Optional) Timestamp when the content was created"
14835+
},
14836+
"metadata": {
14837+
"type": "object",
14838+
"additionalProperties": {
14839+
"oneOf": [
14840+
{
14841+
"type": "null"
14842+
},
14843+
{
14844+
"type": "boolean"
14845+
},
14846+
{
14847+
"type": "number"
14848+
},
14849+
{
14850+
"type": "string"
14851+
},
14852+
{
14853+
"type": "array"
14854+
},
14855+
{
14856+
"type": "object"
14857+
}
14858+
]
14859+
},
14860+
"description": "(Optional) Metadata associated with the content, such as source, author, etc."
14861+
},
14862+
"chunk_metadata": {
14863+
"$ref": "#/components/schemas/ChunkMetadata",
14864+
"description": "(Optional) Metadata associated with the chunk, such as document ID, source, etc."
1478114865
}
1478214866
},
1478314867
"additionalProperties": false,
@@ -16401,6 +16485,131 @@
1640116485
],
1640216486
"title": "RunEvalRequest"
1640316487
},
16488+
"RunModerationRequest": {
16489+
"type": "object",
16490+
"properties": {
16491+
"input": {
16492+
"oneOf": [
16493+
{
16494+
"type": "string"
16495+
},
16496+
{
16497+
"type": "array",
16498+
"items": {
16499+
"type": "string"
16500+
}
16501+
}
16502+
],
16503+
"description": "Input (or inputs) to classify. Can be a single string, an array of strings, or an array of multi-modal input objects similar to other models."
16504+
},
16505+
"model": {
16506+
"type": "string",
16507+
"description": "The content moderation model you would like to use."
16508+
}
16509+
},
16510+
"additionalProperties": false,
16511+
"required": [
16512+
"input",
16513+
"model"
16514+
],
16515+
"title": "RunModerationRequest"
16516+
},
16517+
"ModerationObject": {
16518+
"type": "object",
16519+
"properties": {
16520+
"id": {
16521+
"type": "string",
16522+
"description": "The unique identifier for the moderation request."
16523+
},
16524+
"model": {
16525+
"type": "string",
16526+
"description": "The model used to generate the moderation results."
16527+
},
16528+
"results": {
16529+
"type": "array",
16530+
"items": {
16531+
"$ref": "#/components/schemas/ModerationObjectResults"
16532+
},
16533+
"description": "A list of moderation objects"
16534+
}
16535+
},
16536+
"additionalProperties": false,
16537+
"required": [
16538+
"id",
16539+
"model",
16540+
"results"
16541+
],
16542+
"title": "ModerationObject",
16543+
"description": "A moderation object."
16544+
},
16545+
"ModerationObjectResults": {
16546+
"type": "object",
16547+
"properties": {
16548+
"flagged": {
16549+
"type": "boolean",
16550+
"description": "Whether any of the below categories are flagged."
16551+
},
16552+
"categories": {
16553+
"type": "object",
16554+
"additionalProperties": {
16555+
"type": "boolean"
16556+
},
16557+
"description": "A list of the categories, and whether they are flagged or not."
16558+
},
16559+
"category_applied_input_types": {
16560+
"type": "object",
16561+
"additionalProperties": {
16562+
"type": "array",
16563+
"items": {
16564+
"type": "string"
16565+
}
16566+
},
16567+
"description": "A list of the categories along with the input type(s) that the score applies to."
16568+
},
16569+
"category_scores": {
16570+
"type": "object",
16571+
"additionalProperties": {
16572+
"type": "number"
16573+
},
16574+
"description": "A list of the categories along with their scores as predicted by model. Required set of categories that need to be in response - violence - violence/graphic - harassment - harassment/threatening - hate - hate/threatening - illicit - illicit/violent - sexual - sexual/minors - self-harm - self-harm/intent - self-harm/instructions"
16575+
},
16576+
"user_message": {
16577+
"type": "string"
16578+
},
16579+
"metadata": {
16580+
"type": "object",
16581+
"additionalProperties": {
16582+
"oneOf": [
16583+
{
16584+
"type": "null"
16585+
},
16586+
{
16587+
"type": "boolean"
16588+
},
16589+
{
16590+
"type": "number"
16591+
},
16592+
{
16593+
"type": "string"
16594+
},
16595+
{
16596+
"type": "array"
16597+
},
16598+
{
16599+
"type": "object"
16600+
}
16601+
]
16602+
}
16603+
}
16604+
},
16605+
"additionalProperties": false,
16606+
"required": [
16607+
"flagged",
16608+
"metadata"
16609+
],
16610+
"title": "ModerationObjectResults",
16611+
"description": "A moderation object."
16612+
},
1640416613
"RunShieldRequest": {
1640516614
"type": "object",
1640616615
"properties": {

0 commit comments

Comments
 (0)