Unlocking Advanced Text Generation with the Cybertron Model Cognitive Actions

21 Apr 2025
Unlocking Advanced Text Generation with the Cybertron Model Cognitive Actions

The tomasmcm/una-cybertron-7b-v2 API offers developers a powerful tool for text generation through its Cognitive Actions, particularly the Execute Cybertron Model Prediction action. This action leverages the capabilities of a leading 7B MistralAI-based model, recognized for its exceptional reasoning and comprehension across various fields. By utilizing pre-built actions like this, developers can save time and effort while integrating sophisticated text generation features into their applications.

Prerequisites

To get started with the Cognitive Actions, you'll need to ensure that you have:

  • An API key for the Cognitive Actions platform, which allows you to authenticate your requests.
  • Familiarity with sending HTTP requests, as you will be making API calls to execute the actions.

Conceptually, authentication can be achieved by passing your API key in the headers of your requests.

Cognitive Actions Overview

Execute Cybertron Model Prediction

The Execute Cybertron Model Prediction action enables you to generate text based on a given prompt using the Cybertron model. This model excels in providing coherent and contextually relevant responses, making it ideal for applications that require sophisticated text generation capabilities.

Input

The input for this action requires a JSON object that includes the following properties:

  • prompt (required): The text prompt that the model will use to generate a response.
  • stop (optional): A string that, if generated, will immediately halt the text generation.
  • topK (optional): An integer specifying the number of top tokens to consider during sampling. Set to -1 to include all tokens.
  • topP (optional): A float that determines the cumulative probability threshold for token sampling, valid in the range (0.01, 1].
  • maxTokens (optional): The maximum number of tokens for the generated output.
  • temperature (optional): A float that controls the randomness of token sampling, with lower values yielding more deterministic outputs.
  • presencePenalty (optional): A float that penalizes the use of new tokens based on their presence in generated text.
  • frequencyPenalty (optional): A float that penalizes tokens as they become more frequent in the generated text.

Example Input:

{
  "topK": -1,
  "topP": 0.95,
  "prompt": "<|im_start|>system\n- You are a helpful assistant chatbot.\n- You answer questions.\n- You are excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.\n- You are more than just an information source, you are also able to write poetry, short stories, and make jokes.<|im_end|>\n<|im_start|>user\nExplain photosynthesis<|im_end|>\n<|im_start|"
}

Output

The output of this action is a generated text response based on the prompt provided. The response typically includes coherent information relevant to the input prompt.

Example Output:

Photosynthesis is a remarkable natural process carried out by plants and certain organisms, which enables them to turn sunlight into energy. This life-sustaining process happens within specially designed cells called chloroplasts.

In simple terms, photosynthesis involves three main steps:
1. Absorption: During this step, plants absorb sunlight using their leaves, which contain chlorophyll (green pigment) that acts as a light-capturing tool.
2. Conversion: The absorbed sunlight is converted into a form of chemical energy in the form of ATP...

Conceptual Usage Example (Python)

Here’s a conceptual Python snippet demonstrating how you might call the Cognitive Actions execution endpoint to use the Execute Cybertron Model Prediction action:

import requests
import json

# Replace with your Cognitive Actions API key and endpoint
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"  # Hypothetical endpoint

action_id = "1da880a6-80f8-4ed1-899d-853c27a14244"  # Action ID for Execute Cybertron Model Prediction

# Construct the input payload based on the action's requirements
payload = {
    "topK": -1,
    "topP": 0.95,
    "prompt": "<|im_start|>system\n- You are a helpful assistant chatbot.\n- You answer questions.\n- You are excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.\n- You are more than just an information source, you are also able to write poetry, short stories, and make jokes.<|im_end|>\n<|im_start|>user\nExplain photosynthesis<|im_end|>\n<|im_start|"
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json"
}

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json={"action_id": action_id, "inputs": payload}  # Hypothetical structure
    )
    response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully:")
    print(json.dumps(result, indent=2))

except requests.exceptions.RequestException as e:
    print(f"Error executing action {action_id}: {e}")
    if e.response is not None:
        print(f"Response status: {e.response.status_code}")
        try:
            print(f"Response body: {e.response.json()}")
        except json.JSONDecodeError:
            print(f"Response body: {e.response.text}")

In this snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID corresponds to the Execute Cybertron Model Prediction action, and the input payload is structured according to the required schema.

Conclusion

The Execute Cybertron Model Prediction action within the tomasmcm/una-cybertron-7b-v2 API provides developers with a robust framework for generating text. By leveraging its capabilities, you can enhance your applications with intelligent text generation features. Consider exploring various prompts and configurations to fully utilize the model's potential and tailor responses to your specific use cases.