Elevate Your Applications with the lucataco/hermes-2-pro-llama-3-8b Cognitive Actions

21 Apr 2025
Elevate Your Applications with the lucataco/hermes-2-pro-llama-3-8b Cognitive Actions

Integrating advanced AI capabilities into your applications has never been easier with the lucataco/hermes-2-pro-llama-3-8b Cognitive Actions. These pre-built actions allow developers to leverage the power of the Hermes 2 Pro - Llama-3 8B model, enabling seamless execution of complex function calls and generating structured JSON outputs with improved speed, quality, and accuracy. This blog post will guide you through the capabilities of these actions and how to effectively integrate them into your applications.

Prerequisites

Before getting started with the Cognitive Actions, ensure you have the following:

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Basic knowledge of JSON and how to structure API calls.

For authentication, you will typically pass your API key in the request headers to access the Cognitive Actions endpoints.

Cognitive Actions Overview

Execute Hermes 2 Pro Function Calls

The Execute Hermes 2 Pro Function Calls action allows developers to utilize the advanced capabilities of the Hermes 2 Pro - Llama-3 8B model for executing function calls and generating structured JSON outputs.

  • Category: API Management

Input

The input for this action is defined by the following schema:

{
  "topK": 50,
  "topP": 0.9,
  "prompt": "Write a short story about Goku discovering kirby has teamed up with Majin Buu to destroy the world.",
  "maxTokens": 512,
  "minTokens": 0,
  "temperature": 0.6,
  "systemPrompt": "You are Hermes 2, a helpful assistant.",
  "presencePenalty": 0,
  "frequencyPenalty": 0
}

Here’s a breakdown of the key properties:

  • topK (integer): The number of highest probability tokens to consider for generating the output (default: 50).
  • topP (number): A probability threshold for generating the output (default: 0.9).
  • prompt (string): The initial text input for generating a response.
  • maxTokens (integer): The maximum number of tokens allowed in the output (default: 512).
  • minTokens (integer): The minimum number of tokens to generate (default: 0).
  • temperature (number): Controls the randomness of predictions (default: 0.6).
  • systemPrompt (string): A predefined statement to set the context for the model (default: "You are a helpful assistant.").
  • presencePenalty (number): A penalty to reduce repetition of new token occurrences (default: 0).
  • frequencyPenalty (number): A penalty based on existing token frequency to dampen repeated tokens (default: 0).

Output

The action typically returns an array of strings representing the generated text. Here’s an example of the output:

[
  "Once", " upon", " a", " time", ",", " in", " the", " peaceful", " world", " of", " Dragon", " Ball", ",", " Goku", " and", " his", " friends", " were", " enjoying", " a", " day", " off", " after", " another", " successful", " tournament", "."
  // ... more tokens
]

The output consists of the generated text split into tokens, which can be easily reconstructed into a coherent response.

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how you might call the Cognitive Actions execution endpoint for this 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 = "9bd7308b-3ada-46bc-b8a2-306631d99a95" # Action ID for Execute Hermes 2 Pro Function Calls

# Construct the input payload based on the action's requirements
payload = {
    "topK": 50,
    "topP": 0.9,
    "prompt": "Write a short story about Goku discovering kirby has teamed up with Majin Buu to destroy the world.",
    "maxTokens": 512,
    "minTokens": 0,
    "temperature": 0.6,
    "systemPrompt": "You are Hermes 2, a helpful assistant.",
    "presencePenalty": 0,
    "frequencyPenalty": 0
}

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 the placeholder with your actual API key. The action ID corresponds to the Execute Hermes 2 Pro Function Calls action. The input payload is structured according to the action's schema.

Conclusion

The lucataco/hermes-2-pro-llama-3-8b Cognitive Actions offer developers powerful tools to integrate AI-driven functionalities into their applications effortlessly. By using the Execute Hermes 2 Pro Function Calls action, you can create engaging and dynamic experiences for your users. Consider exploring more use cases and experimenting with the parameters to fully harness the capabilities of this action. Happy coding!