Summarize Conversations Effortlessly with Samsum Llama 2 13b

In today's fast-paced digital world, the ability to quickly distill lengthy conversations into concise summaries is invaluable. The Samsum Llama 2 13b offers powerful Cognitive Actions that enable developers to generate clear and relevant conversation summaries using advanced AI techniques. By leveraging the capabilities of the LLaMA 2 model, developers can enhance user experiences, improve communication efficiency, and streamline information retrieval. Common use cases for this action include summarizing meeting discussions, extracting key points from customer support chats, and condensing social media interactions for reporting purposes.
Prerequisites
To get started, you'll need a Cognitive Actions API key and a basic understanding of making API calls.
Generate Conversation Summary
The Generate Conversation Summary action is designed to create a concise summary of a conversation by processing the provided input text. This action is particularly useful for developers looking to automate the summarization process, ensuring that key points are captured without the need for manual intervention.
Input Requirements
To utilize this action, you must provide a structured input, including:
- prompt: A string containing the conversation you want summarized.
- seed (optional): An integer to specify the random seed for sampling.
- topK (optional): An integer that defines the top K most likely tokens to sample from during text decoding.
- topP (optional): A number representing the top percentage of most likely tokens to sample.
- temperature (optional): A number that adjusts the randomness of the output.
- stoppingSequences (optional): A string indicating sequences where generation should stop.
- maximumGeneratedTokens (optional): An integer that sets the maximum number of tokens to generate.
- minimumGeneratedTokens (optional): An integer that sets the minimum number of tokens to generate.
Expected Output
The output will be a concise summary of the conversation provided in the input prompt. For example, if the input is a dialogue between two people discussing their friend Marc, the output might highlight their concerns about his recent behavior and their intention to reach out to him.
Use Cases for this specific action
- Meeting Summaries: Automatically generate summaries of team meetings to keep everyone informed without needing to transcribe discussions.
- Customer Support: Capture essential details from customer interactions to help improve service and follow-up actions.
- Social Media Monitoring: Summarize user interactions or comments on social media platforms for easier analysis and reporting.
import requests
import json
# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"
action_id = "dd3aa072-00db-4595-af4f-4ba51757d709" # Action ID for: Generate Conversation Summary
# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
"topK": 50,
"topP": 0.95,
"debug": false,
"prompt": "[INST] <<SYS>>\nUse the Input to provide a summary of a conversation.\n<</SYS>>\n\nInput:\nNate: Remember when Marc used to be so carefree and fun?\nJenna: Oh definitely, he was always the life of the party.\nNate: Lately, it feels like he's a different person.\nJenna: In what way?\nNate: He's more serious now, always working and never has time for us.\nNate: I tried inviting him to hang out several times, but he's always too busy.\nJenna: Maybe he's just going through a phase?\nNate: I don't know, it's been months.\nNate: It's like he's lost his spark or something.\nJenna: I noticed that too. Last time I saw him, he seemed distant.\nNate: I just hope he's okay.\nJenna: Maybe we should talk to him, see if something's bothering him?\nNate: Yeah, I think that's a good idea. I miss the old Marc.\n\nSummary: ",
"temperature": 0.75,
"stoppingSequences": "</s>",
"maximumGeneratedTokens": 256,
"minimumGeneratedTokens": -1
}
headers = {
"Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
"Content-Type": "application/json",
# Add any other required headers for the Cognitive Actions API
}
# Prepare the request body for the hypothetical execution endpoint
request_body = {
"action_id": action_id,
"inputs": payload
}
print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")
try:
response = requests.post(
COGNITIVE_ACTIONS_EXECUTE_URL,
headers=headers,
json=request_body
)
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
result = response.json()
print("Action executed successfully. Result:")
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 (non-JSON): {e.response.text}")
print("------------------------------------------------")
Conclusion
The Samsum Llama 2 13b's Generate Conversation Summary action provides developers with an efficient way to automate the summarization of conversations. By implementing this action, you can enhance communication, save time, and ensure that critical information is easily accessible. Consider integrating this powerful tool into your applications to improve user experience and streamline workflows.