Skip to content

Commit

Permalink
Merge pull request #632 from Clarifai/alfrick-branch
Browse files Browse the repository at this point in the history
added CLI docs
  • Loading branch information
Alfrick authored Jan 29, 2025
2 parents 9719a6e + 917c9a0 commit d97434e
Show file tree
Hide file tree
Showing 57 changed files with 645 additions and 87 deletions.
2 changes: 1 addition & 1 deletion code_snippets/api-guide/audit-log/operation.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

const raw = JSON.stringify({
"query": {
"operations": [300, 400, 600]
"operations": ["MODEL_CREATE", "WORKFLOW_CREATE", "APPLICATION_CREATE"]
}
});

Expand Down
2 changes: 1 addition & 1 deletion code_snippets/api-guide/audit-log/operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ stub.PostAuditLogSearches(
user_id: USER_ID,
},
query: {
operations: [300, 400, 600],
operations: ["MODEL_CREATE", "WORKFLOW_CREATE", "APPLICATION_CREATE"]
},
},
metadata,
Expand Down
2 changes: 1 addition & 1 deletion code_snippets/api-guide/audit-log/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
service_pb2.PostAuditLogSearchesRequest(
user_app_id=userDataObject, # The userDataObject is created in the overview and is required when using a PAT
query=resources_pb2.AuditLogQuery(
operations=[300, 400, 600]
operations=[resources_pb2.EventType.MODEL_CREATE, resources_pb2.EventType.WORKFLOW_CREATE, resources_pb2.EventType.APPLICATION_CREATE]
)
),
metadata=metadata
Expand Down
2 changes: 1 addition & 1 deletion code_snippets/api-guide/audit-log/operation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ curl -X POST "https://api.clarifai.com/v2/users/YOUR_USER_ID_HERE/audit_log/sear
-H "Content-Type: application/json" \
-d '{
"query": {
"operations": [300, 400, 600]
"operations": ["MODEL_CREATE", "WORKFLOW_CREATE", "APPLICATION_CREATE"]
}
}'
1 change: 1 addition & 0 deletions code_snippets/python-sdk/cli/inference_parameters.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/openai/whisper/models/whisper-large-v2 --url https://s3.amazonaws.com/samples.clarifai.com/featured-models/record_out+(3).wav --input_type audio --inference_params "{\"task\":\"transcribe\"}"
2 changes: 2 additions & 0 deletions code_snippets/python-sdk/cli/login.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
user_id: "YOUR_USER_ID_HERE"
pat: "YOUR_PAT_HERE"
1 change: 1 addition & 0 deletions code_snippets/python-sdk/cli/output_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/clarifai/main/models/general-image-recognition --url https://samples.clarifai.com/dog2.jpeg --input_type image --output_config "{\"max_concepts\":3}"
1 change: 1 addition & 0 deletions code_snippets/python-sdk/cli/predict_by_file_path.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_id claude-v2 --user_id anthropic --app_id completion --file_path <add-predict-filepath-here> --input_type text
1 change: 1 addition & 0 deletions code_snippets/python-sdk/cli/predict_by_ids.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_id claude-v2 --user_id anthropic --app_id completion --bytes "Human: Write a tweet on future of AI\nAssistant:" --input_type text
88 changes: 88 additions & 0 deletions code_snippets/python-sdk/cli/predict_by_ids_output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
status {
code: SUCCESS
description: "Ok"
req_id: "sdk-python-11.0.5-ee8ff730ab144888b6062a6b5ece6d1b"
}
outputs {
id: "dddb6616ba594f41abf77dd8f35b351d"
status {
code: SUCCESS
description: "Ok"
}
created_at {
seconds: 1737623976
nanos: 884184949
}
model {
id: "claude-v2"
name: "claude-v2"
created_at {
seconds: 1689360584
nanos: 718730000
}
app_id: "completion"
model_version {
id: "f39db57922eb48188cf41a26660aaf74"
created_at {
seconds: 1706762592
nanos: 463521000
}
status {
code: MODEL_TRAINED
description: "Model is trained and ready"
}
completed_at {
seconds: 1706762763
nanos: 246861000
}
visibility {
gettable: PUBLIC
}
app_id: "completion"
user_id: "anthropic"
metadata {
}
}
user_id: "anthropic"
model_type_id: "text-to-text"
visibility {
gettable: PUBLIC
}
modified_at {
seconds: 1729160329
nanos: 739032000
}
workflow_recommended {
}
image {
url: "https://data.clarifai.com/large/users/anthropic/apps/completion/inputs/image/b9d666a9e16a31c8bbbf6da89cceb804"
hosted {
prefix: "https://data.clarifai.com"
suffix: "users/anthropic/apps/completion/inputs/image/b9d666a9e16a31c8bbbf6da89cceb804"
sizes: "small"
sizes: "large"
crossorigin: "use-credentials"
}
}
license_type: CLOSED_SOURCE
source: WRAPPED
creator: "anthropic"
}
input {
id: "13cf01b7817e4b38a0c7d140a3ce0755"
data {
text {
raw: "Human: Write a tweet on future of AI\\nAssistant:"
url: "https://samples.clarifai.com/placeholder.gif"
}
}
}
data {
text {
raw: " Here\'s a draft 280 character tweet on the future of AI:\n\nThe future of AI holds tremendous promise. As algorithms continue improving, AI will transform industries from healthcare to transportation. But we must ensure AI develops safely and ethically, prioritizing human wellbeing over profits or progress at any cost. Together, through foresight and care, we can build an AI-powered world that benefits all."
text_info {
encoding: "UnknownTextEnc"
}
}
}
}
Empty file.
1 change: 1 addition & 0 deletions code_snippets/python-sdk/cli/predict_by_model_url.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/anthropic/completion/models/claude-v2 --bytes "Human: Write a tweet on future of AI\nAssistant:" --input_type text
1 change: 1 addition & 0 deletions code_snippets/python-sdk/cli/predict_by_url.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_id llama2-7b-chat --user_id meta --app_id Llama-2 --url https://samples.clarifai.com/featured-models/llama2-prompt3.txt --input_type text
3 changes: 3 additions & 0 deletions code_snippets/python-sdk/cli/predict_by_yaml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
model_url: "https://clarifai.com/anthropic/completion/models/claude-v2"
bytes: "Human: Write a tweet on future of AI\nAssistant:"
input_type: "text"
1 change: 1 addition & 0 deletions code_snippets/python-sdk/cli/predict_by_yaml_bash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --config <add-config-filepath-here>
23 changes: 23 additions & 0 deletions code_snippets/python-sdk/cli/predict_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Usage: clarifai model predict [OPTIONS]

Predict using the given model

Options:
--config PATH Path to the model predict config file.
--model_id TEXT Model ID of the model used to predict.
--user_id TEXT User ID of the model used to predict.
--app_id TEXT App ID of the model used to predict.
--model_url TEXT Model URL of the model used to predict.
--file_path TEXT File path of file for the model to predict
--url TEXT URL to the file for the model to predict
--bytes TEXT Bytes to the file for the model to predict
--input_id TEXT Existing input id in the app for the model
to predict
--input_type TEXT Type of input
-cc_id, --compute_cluster_id TEXT
Compute Cluster ID to use for the model
-np_id, --nodepool_id TEXT Nodepool ID to use for the model
-dpl_id, --deployment_id TEXT Deployment ID to use for the model
--inference_params TEXT Inference parameters to override
--output_config TEXT Output config to override
--help Show this message and exit.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$ clarifai model predict --model_id got-ocr-2_0 --user_id stepfun-ai --app_id ocr --url "https://samples.clarifai.com/featured-models/ocr-woman-holding-sold-sign.jpg" --input_type image --deployment_id "test-deployment"
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/audioToText.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/facebook/asr/models/asr-wav2vec2-large-robust-ft-swbd-300h-english --url https://s3.amazonaws.com/samples.clarifai.com/GoodMorning.wav --input_type audio
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/image_to_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/stability-ai/Upscale/models/stabilityai-upscale --url https://s3.amazonaws.com/samples.clarifai.com/featured-models/image-captioning-statue-of-liberty.jpeg --input_type image --inference_params "{\"width\":\"1024\"}"
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/image_to_text.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/salesforce/blip/models/general-english-image-caption-blip --url https://s3.amazonaws.com/samples.clarifai.com/featured-models/image-captioning-statue-of-liberty.jpeg --input_type image
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/text_class_llm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url "https://clarifai.com/openai/chat-completion/models/GPT-4" --bytes "Classes: [`positive`, `negative`, `neutral`] Text: Sunny weather makes me happy. Classify the text into one of the above classes." --input_type "text"
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/text_classifier.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/erfan/text-classification/models/sentiment-analysis-twitter-roberta-base --url https://samples.clarifai.com/finantial-sentiment-1.txt --input_type text
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/text_embedder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url "https://clarifai.com/cohere/embed/models/cohere-embed-english-v3_0" --bytes "In India Green Revolution commenced in the early 1960s that led to an increase in food grain production, especially in Punjab, Haryana, and Uttar Pradesh. Major milestones in this undertaking were the development of high-yielding varieties of wheat. The Green revolution is revolutionary in character due to the introduction of new technology, new ideas, the new application of inputs like HYV seeds, fertilizers, irrigation water, pesticides, etc. As all these were brought suddenly and spread quickly to attain dramatic results thus it is termed as a revolution in green agriculture." --input_type "text"
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/text_gen_llm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/openai/chat-completion/models/GPT-4 --bytes "What is the future of AI?" --input_type text
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/meta/Llama-3/models/llama-3_1-8b-instruct --bytes "What is the future of AI?" --input_type text --inference_params "{\"temperature\":0.7,\"max_tokens\":200,\"top_k\":50,\"top_p\":0.95}"
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/text_to_audio.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url "https://clarifai.com/eleven-labs/audio-generation/models/speech-synthesis" --bytes "Hello, How are you doing today!" --input_type "text"
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/text_to_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url "https://clarifai.com/stability-ai/stable-diffusion-2/models/stable-diffusion-xl" --bytes "floor plan for 2 bedroom kitchen house" --input_type "text"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/clarifai/main/models/general-image-recognition --url https://samples.clarifai.com/metro-north.jpg --input_type image
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/visual_d_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/clarifai/main/models/general-image-detection --url https://s3.amazonaws.com/samples.clarifai.com/people_walking2.jpeg --input_type image
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/visual_d_video.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/clarifai/main/models/general-image-detection --url https://samples.clarifai.com/beer.mp4 --input_type video --output_config "{\"sample_ms\":2000}"
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/visual_embedder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/clarifai/main/models/image-embedder-clip --url https://s3.amazonaws.com/samples.clarifai.com/featured-models/general-elephants.jpg --input_type image
1 change: 1 addition & 0 deletions code_snippets/python-sdk/inference/cli/visual_segmenter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clarifai model predict --model_url https://clarifai.com/clarifai/main/models/image-general-segmentation --url https://s3.amazonaws.com/samples.clarifai.com/people_walking2.jpeg --input_type image
28 changes: 14 additions & 14 deletions docs/api-guide/audit-log/README.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: Track what has been performed, by whom and with which results
description: Track what was performed, who did it, and the results
pagination_prev: null
pagination_next: null
unlisted: true
Expand Down Expand Up @@ -121,7 +121,7 @@ You can apply filters to target specific operation types.

The Audit Logging feature currently supports tracking the following critical resource operations (_we're planning to support more resources in the future_):

- **Organization and Team Membership activities** — Includes creating, updating, or deleting organizations and teams, sending invitations, and managing team users and applications.
- **Organization and team membership activities** — Includes creating, updating, or deleting organizations and teams, sending invitations, and managing team users and applications.
- **Module activities** — Tracks the creation, updating, and deletion of modules.
- **Model activities** — Tracks actions such as creating, training, publishing, and deleting models.
- **Workflow activities** — Covers the creation, publishing, updating, and deletion of workflows.
Expand Down Expand Up @@ -308,18 +308,18 @@ You can define the target of your query; that is, specify the resource on which
<summary>**Target Types Supported**</summary>


| Target |Code |
|-----------------|--------------------|
| `User user` | 1 |
| `Role role` | 2 |
| `Team team` | 3 |
| `App app` | 4 |
| `Module module` | 5 |
| `ModuleVersion module_version` | 6 |
| `Workflow workflow` | 7 |
| `WorkflowVersion workflow_version ` | 8 |
| `Model model` | 9 |
| `ModelVersion model_version` | 10 |
| Target |
|-----------------|
| `User user` |
| `Role role` |
| `Team team` |
| `App app` |
| `Module module` |
| `ModuleVersion module_version` |
| `Workflow workflow` |
| `WorkflowVersion workflow_version ` |
| `Model model` |
| `ModelVersion model_version` |


</details>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
description: Capture information from an organization's form that are stored as PDF documents
pagination_next: null
sidebar_position: 7
unlisted: true
draft: true
---
# Test

**Test doc**
<hr />




Test document


Loading

0 comments on commit d97434e

Please sign in to comment.