Enhance Educational Tools with Digital Socrates Cognitive Actions

24 Apr 2025
Enhance Educational Tools with Digital Socrates Cognitive Actions

In the world of educational technology, providing instant and meaningful feedback is crucial. The Digital Socrates 13B model offers a set of powerful Cognitive Actions designed to critique explanations, helping educators evaluate student responses more effectively. By utilizing this API, developers can integrate nuanced, interpretable feedback into their applications, enhancing the learning experience.

Prerequisites

Before diving into the implementation of Cognitive Actions, ensure you have the following:

  • An API key for accessing the Cognitive Actions platform.
  • Familiarity with JSON structures as you'll be working with JSON payloads for requests.
  • Understanding of how to authenticate API requests by passing the API key in the headers.

Cognitive Actions Overview

Critique Explanations with Digital Socrates

Purpose:
This action uses the Digital Socrates 13B model to automatically critique explanations by identifying flaws, suggesting improvements, and providing a quality score. It serves as an invaluable tool for educators by offering detailed feedback similar to human-like critiques.

Category:
Text Processing

Input

The input for this action requires several fields, with prompt being mandatory. Below is the schema and an example input:

Schema:

{
  "type": "object",
  "required": ["prompt"],
  "properties": {
    "prompt": { "type": "string" },
    "stop": { "type": "string", "default": "[INST]" },
    "topK": { "type": "integer", "default": -1 },
    "topP": { "type": "number", "default": 0.95 },
    "maxTokens": { "type": "integer", "default": 128 },
    "temperature": { "type": "number", "default": 0.8 },
    "presencePenalty": { "type": "number", "default": 0 },
    "frequencyPenalty": { "type": "number", "default": 0 }
  }
}

Example Input:

{
  "stop": "[INST]",
  "topK": -1,
  "topP": 0.95,
  "prompt": "[INST] <<SYS>>\nYou are a helpful and rigorous tutor.\n<</SYS>>\nYou are a knowledgeable tutor who gives helpful critique on a given answer and explanation to a question. The first component of the critique should reflect back the most significant flaw. [...]",
  "maxTokens": 256,
  "temperature": 0.8,
  "presencePenalty": 0,
  "frequencyPenalty": 0
}

Output

The output returned by this action includes a structured critique along with a quality score. Here’s an example of what you might receive:

Example Output:

The explanation states or suggests the following:
* Main flaw (standalone statement): "The noise and heat generated from the lawnmower are a result of the conversion of energy from the fuel to mechanical energy."
* Dimension: incorrect_information

Consider these points for revising the explanation:
* General: Remember that when discussing thermodynamics, it's important to distinguish between the concepts of heat and temperature.
* Specific: In this case, you should explain that the noise and heat generated from the lawnmower are a result of the conversion of energy from the fuel to thermal energy, not mechanical energy.

Explanation score: 2

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet demonstrating how to invoke this action using a hypothetical endpoint.

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 = "58773df9-1c27-44dd-9d8f-07b93dccece8"  # Action ID for Critique Explanations with Digital Socrates

# Construct the input payload based on the action's requirements
payload = {
    "stop": "[INST]",
    "topK": -1,
    "topP": 0.95,
    "prompt": "[INST] <<SYS>>\nYou are a helpful and rigorous tutor.\n<</SYS>>\nYou are a knowledgeable tutor who gives helpful critique on a given answer and explanation to a question. [...]",
    "maxTokens": 256,
    "temperature": 0.8,
    "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 the code above, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action_id corresponds to the specific action you want to invoke. This example highlights how to structure the input payload and handle the response effectively.

Conclusion

The Digital Socrates Cognitive Actions empower developers to integrate sophisticated feedback mechanisms into educational applications. By leveraging the ability to critique explanations, developers can enhance the learning process, providing users with valuable insights and guidance. Start exploring these actions today to improve educational outcomes in your applications!