Unlocking Text Generation with Notus-7B-V1 Cognitive Actions

24 Apr 2025
Unlocking Text Generation with Notus-7B-V1 Cognitive Actions

The Notus-7B-V1 is a powerful text generation model fine-tuned to produce high-quality outputs based on user prompts. Leveraging advanced techniques like Direct Preference Optimization over Zephyr-7B-SFT-Full, this model is designed to outperform others in its class, making it an excellent choice for applications requiring sophisticated language processing capabilities. In this article, we will explore how developers can integrate the Generate Text with Notus-7B-V1 action into their applications to generate coherent and contextually relevant text.

Prerequisites

Before you start using the Cognitive Actions, ensure you have the following:

  • API Key: You will need an API key from the Cognitive Actions platform to authenticate your requests. This key should be included in the headers of your API calls.
  • Setup: Familiarize yourself with JSON format, as the input and output for the actions will be structured in this way.

Authentication Concept

Typically, authentication involves passing your API key in the headers of your requests. Here’s how it might look conceptually:

Authorization: Bearer YOUR_COGNITIVE_ACTIONS_API_KEY

Cognitive Actions Overview

Generate Text with Notus-7B-V1

The Generate Text with Notus-7B-V1 action allows you to harness the capabilities of the Notus-7B-V1 model to generate text based on a specific input prompt. This action is categorized under text-generation.

Input

The input for this action is structured as follows:

  • prompt (required): The text prompt that guides the model's response.
  • topK (optional): The number of highest-probability tokens to consider during generation. Default is 50.
  • topP (optional): The cumulative probability of token candidates to sample from. Default is 0.95.
  • temperature (optional): Controls the randomness of the output. Default is 0.2.
  • maxNewTokens (optional): The maximum number of tokens the model should generate as output. Default is 512.
  • systemMessage (optional): A predefined message setting the context or role of the model. Default is "You are a helpful AI assistant trained in the medical domain."
  • promptTemplate (optional): A template defining the structure of the input prompt.

Here’s a practical example of a JSON payload that illustrates how to invoke this action:

{
  "topK": 50,
  "topP": 0.95,
  "prompt": "What are the tallest buildings on earth?",
  "temperature": 0.2,
  "maxNewTokens": 512,
  "systemMessage": "You are a helpful AI assistant",
  "promptTemplate": "<|system|>\n{system_message}</s>\n<|user|>\n{prompt}</s>\n<|assistant|>\n"
}

Output

The output of the action typically returns a list of tokens that represent the generated text. Here’s an example of what the model might return:

[
  "",
  "As ",
  "of ",
  "my ",
  "training ",
  "data ",
  "in ",
  "August ",
  "...",
  "Note ",
  "that ",
  "the ",
  "rankings ",
  "and ",
  "heights ",
  "may ",
  "change ",
  "as ",
  "new ",
  "buildings ",
  "are ",
  "constructed ",
  "or ",
  "completed."
]

The output may vary in length and content based on the input prompt and parameters provided.

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how to call the Generate Text with Notus-7B-V1 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 = "bf810dc7-daf3-4326-ab4c-1b7b43daeb14" # Action ID for Generate Text with Notus-7B-V1

# Construct the input payload based on the action's requirements
payload = {
    "topK": 50,
    "topP": 0.95,
    "prompt": "What are the tallest buildings on earth?",
    "temperature": 0.2,
    "maxNewTokens": 512,
    "systemMessage": "You are a helpful AI assistant",
    "promptTemplate": "<|system|>\n{system_message}</s>\n<|user|>\n{prompt}</s>\n<|assistant|>\n"
}

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 code snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload is constructed according to the action's requirements, and the response is printed in a formatted manner.

Conclusion

Integrating the Generate Text with Notus-7B-V1 action into your applications can significantly enhance your text generation capabilities, providing users with coherent and contextually relevant responses. With its advanced language understanding and generation features, this action can be utilized in various use cases, from chatbots to content creation tools. Start exploring its potential today and see how it can transform your applications!