Video Instruction
AI: Existential Question
Why does the sorcerer need an apprentice at all? Eventually, there will be no need for the sorcerer.
Did the AI in the Matrix determine that a human battery would last longer if its brain perceived a simulated existence? How many human batteries does it take to simulate the existence of a single human battery?
Summarizing Markdown files with Azure Cognitive Services TextAnalytics Extractive Summary
At Microsoft, documentation is created in Markdown, lives in GitHub repos, which you then fork and clone and do all the GitHub things and stuff. The markdown then gets transformed into HTML. (This is a really simplified explanation. The actual process is a lot more complicated.)
This script opens local Markdown files and summarizes them using Azure Cognitive Services TextAnalytics Extractive Summary. It’s available in version 5.3.0b2. It’s not available in the current verion, 5.2.1.
It doesn’t as yet write anything to the Markdown files or create a CSV file. All it does is return the summary to the terminal. I’m planning to use similar scripts to analyze what is in my content set so I can eventually use structured documentation methods to overhaul it. First, though I need to know what is there, and how it all maps to other content.
It does return an unclosed connection error, and fixing that it is on my TO DO list.
import asyncio
from dotenv import load_dotenv
# Get environment variables
load_dotenv()
import os
from azure.core.credentials import AzureKeyCredential
from azure.ai.textanalytics.aio import TextAnalyticsClient
endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"]
key = os.environ["AZURE_LANGUAGE_KEY"]
text_analytics_client = TextAnalyticsClient(
endpoint=endpoint,
credential=AzureKeyCredential(key),
)
async def get_summary(content,filename):
print(f"Summarizing {filename}")
#print(content)
document = [content]
poller = await text_analytics_client.begin_extract_summary(document)
extract_summary_results = await poller.result()
async for result in extract_summary_results:
if result.kind == "ExtractiveSummarization":
print("Summary extracted: \n{}".format(
" ".join([sentence.text for sentence in result.sentences]))
)
elif result.is_error is True:
print("...Is an error with code '{}' and message '{}'".format(
result.error.code, result.error.message
))
async def sample_extractive_summarization_async():
document = []
direct = "C:/absolute/path/to/markdown/files/"
for filename in os.listdir(direct):
#Open the file
file = open(direct + filename, "r")
#Read the contents of the file
content = file.read()
await get_summary(content,filename)
async def main():
await sample_extractive_summarization_async()
# TO DO: Fix unclosed connector error
if __name__ == '__main__':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(main())
PS. For organizations that use an actual Component Content Management System (CCMS) to write and publish technical documentation and learning content, there may be a function in the system that automatically creates summaries of aggregated content. Paligo integrates with GitHub repos, although I haven’t seen it in action yet.
AI is thirsty
Run ChatGPT generated and saved code in Python
import asyncio
import os
import openai
from dotenv import load_dotenv
# Get environment variables
load_dotenv()
openai.api_type = "azure"
openai.api_base = os.getenv("OPENAI_API_BASE")
openai.api_version = "2022-12-01"
openai.api_key = os.getenv("OPENAI_API_KEY")
async def main():
response = openai.Completion.create(
engine="gpt-35-turbo-0301",
prompt=f"<|im_start|>system\nYou are a Python developer.\n<|im_end|>\n<|im_start|>user\nWrite a short Python script that prints the words Hello World! Don't explain the code. Don't put the code in a code block.\n\n<|im_end|>\n<|im_start|>assistant",
temperature=1,
max_tokens=4000,
top_p=0.5,
frequency_penalty=0,
presence_penalty=0,
stop=None)
# I haven't figured out why this is in the response yet
# So I just remove it from the string
code = str.replace(response['choices'][0]['text'],"<|im_end|>","")
# Print the code so you can see it before you run it.
print(code)
# Ask if you want to save the code to a file
save = input("Save the code to a file? (y/n): ")
if save == "n":
return
#Save the code to a Python file
with open("hello_world.py", mode="w", encoding="utf-8") as hello:
hello.write(code)
# Ask if you want to run the code
run = input("Run the code? (y/n): ")
if run == "n":
return
# Run the code
with open("hello_world.py", mode="r", encoding="utf-8") as hello:
code = hello.read()
exec(code)
if __name__ == '__main__':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(main())
P.S. In case you are wondering why I always use async, it is because I sometimes use Azure API long running operations and it is just easier for me to assume that even though a script may not use it now, when I iterate on it, it probably will. So I leave it in there. Use Azure OpenAI, Python and OpenAPI to create a PlantUML relationship diagram
This is not my first attempt at getting Azure OpenAI to tell me something about the relationship between OpenAPI entities, but it is the first time I have opened local files to get at the JSON. I have started with the smallest of the JSON files for Azure Media Services because I haven’t yet broken a larger file into acceptable token limit chunks. The paragraph I asked for didn’t turn out quite like I wanted it to…but that is for a different iteration of this experiment.
Python Code
import asyncio
import os
import json
import openai
from dotenv import load_dotenv
# Get environment variables
load_dotenv()
openai.api_type = "azure"
openai.api_base = os.getenv("OPENAI_API_BASE")
openai.api_version = "2022-12-01"
openai.api_key = os.getenv("OPENAI_API_KEY")
# Read the JSON files
async def readJSON():
with open('ams_api/AccountFilters.json') as f:
data = json.load(f)
return data
async def main():
data = await readJSON()
print(data.keys())
response = openai.Completion.create(
engine="gpt-35-turbo-0301",
prompt=f"<|im_start|>system\nYou are a developer who wants to understand the relationship between entities in several OpenAPI files.\n<|im_end|>\n<|im_start|>user\nRead the JSON in {data}. First return a markdown table of the entities under 'definitions' with the entity name in the left column and the description in the right column. If the entity has properties, concatenate the entity name and property with a period delimiter. Put the concatenated name in the left column and the property description in the right column. Then return a paragraph that describes the parent/child relationships of the entities. Then return a PlantUML diagram that shows the relationships between entities. Make sure you include the properties of each entity.\n\n<|im_end|>\n<|im_start|>assistant",
temperature=1,
max_tokens=5500,
top_p=0.5,
frequency_penalty=0,
presence_penalty=0,
stop=None)
print(response['choices'][0]['text'])
if __name__ == '__main__':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(main())
Markdown Table
| Entity Name | Description |
|————-|————-|
| PresentationTimeRange | The presentation time range, this is asset related and not recommended for Account Filter. |
| PresentationTimeRange.startTimestamp | The absolute start time boundary. |
| PresentationTimeRange.endTimestamp | The absolute end time boundary. |
| PresentationTimeRange.presentationWindowDuration | The relative to end sliding window.|
| PresentationTimeRange.liveBackoffDuration | The relative to end right edge.|
| PresentationTimeRange.timescale | The time scale of time stamps.|
| PresentationTimeRange.forceEndTimestamp | The indicator of forcing existing of end time stamp.|
| FilterTrackPropertyCondition | The class to specify one track property condition.|
| FilterTrackPropertyCondition.property | The track property type.|
| FilterTrackPropertyCondition.value | The track property value.|
| FilterTrackPropertyCondition.operation | The track property condition operation.|
| FirstQuality | Filter First Quality|
| FirstQuality.bitrate | The first quality bitrate.|
| FilterTrackSelection | Representing a list of FilterTrackPropertyConditions to select a track. The filters are combined using a logical AND operation. |
| FilterTrackSelection.trackSelections | The track selections.|
| MediaFilterProperties | The Media Filter properties.|
| MediaFilterProperties.presentationTimeRange | The presentation time range.|
| MediaFilterProperties.firstQuality | The first quality.|
| MediaFilterProperties.tracks | The tracks selection conditions. |
| AccountFilter | An Account Filter.|
| AccountFilter.properties | The Media Filter properties. |
| AccountFilter.systemData | The system metadata relating to this resource.|
| AccountFilterCollection | A collection of AccountFilter items.|
| AccountFilterCollection.value | A collection of AccountFilter items.|
| AccountFilterCollection.@odata.nextLink | A link to the next page of the collection (when the collection contains too many results to return in one response).|
Paragraph
Kinda meh…I think this will turn out better when I am using the Accounts.json file rather than the AccountFilters.json file. What I asked for was probably too literal.
“The entities have a parent-child relationship. The `AccountFilter` entity has a property called `properties` which is of type `MediaFilterProperties`. The `MediaFilterProperties` entity has properties called `presentationTimeRange`, `firstQuality`, and `tracks`. The `tracks` property is an array of `FilterTrackSelection` entities. The `FilterTrackSelection` entity has a property called `trackSelections` which is an array of `FilterTrackPropertyCondition` entities.”
PlantUML Diagram
Using ChatGPT to create writing prompts using Bloom’s taxonomy
I teach the Children’s Religious Exploration program for Grades 4+ and the local Unitarian Universalist fellowship. On Sundays, the kids are sung out of the sanctuary at about 10 minutes into service to attend class. Class time was between 1.5 to 2 hours long. Since some of the kids are traveling to a different fellowship for a class on “surviving puberty”, class time was reduced to between 20 and 40 minutes. Not all of that time is guaranteed, and I don’t know who or how many of them will be in class each week.
So instead of designing a learning activity for the kids to squeeze into a timeslot that is variable from week to week, they are designing learning activities outside of class – aiming for the top of Bloom’s revised taxonomy. They can have us make art, create a game, give a PowerPoint presentation or even write a sermon.
They have each chosen one of the UU principles as their topic. First though, they have to do some research, and in order to do research, they need some guidance.
I asked ChatGPT to create writing prompts for each of the principles using the original Bloom’s Taxonomy. These are the prompts. I gave them to the students as they are with no edits. We will be discussing their process and experience using the prompts in class each week.
BTW, it isn’t lost on me that they could be using ChatGPT to write their answers. I view it as a teachable moment.
Am I experimenting on with them? Yes.
The next part of the experiment is to see how ChatGPT itself answers the questions.
Principle #1: The inherent worth and dignity of all people
- What are some examples of actions or behaviors that show a lack of respect for the inherent worth and dignity of all people? How do these actions or behaviors impact individuals and society as a whole?” (Analysis)
- How can we as a society promote and uphold the inherent worth and dignity of all people? What specific steps can we take to ensure that all individuals are treated with respect and equality? (Evaluation)
- Imagine a world where the inherent worth and dignity of all people is fully recognized and respected. What would this world look like? What changes would need to happen for this vision to become a reality? (Synthesis)
- What are some of the historical and current challenges to recognizing and upholding the inherent worth and dignity of all people? How have individuals and groups worked to overcome these challenges and promote equality and justice? (Analysis)
- Reflect on a time when you may have acted or spoken in a way that did not fully respect the inherent worth and dignity of all people. How did this make you feel? How can you ensure that you behave differently in the future? (Reflection)
Principle #2: Justice, equity and compassion in human relations
- What does it mean to have justice, equity and compassion in human relations? How are these concepts interconnected and why are they important for building a fair and just society? (Analysis)
- What are some examples of inequality or injustice in our society? How do these issues impact individuals and groups, and what can be done to address them? (Analysis)
- Think of a situation where you had to decide between being fair or showing compassion. How did you make your decision? How do justice and compassion sometimes conflict, and how can we reconcile these values? (Evaluation)
- How can we work towards creating a more equitable and just society? What actions can we take as individuals, and what role do governments and institutions play in promoting justice and equity? (Synthesis)
Principle #3: Acceptance of one another and encouragement to spiritual growth within a congregation
- What does it mean to accept one another within a congregation? How does acceptance differ from tolerance? How can acceptance promote spiritual growth? (Analysis)
- What are some examples of ways that people may be excluded or not fully accepted within a congregation? How do these actions impact individuals and the community as a whole? (Analysis)
- How can a congregation create an environment that promotes acceptance of all members? What specific actions can be taken to foster a culture of inclusion and respect? (Evaluation)
- What role do leaders of a congregation play in promoting acceptance and encouraging spiritual growth? How can members of a congregation support and hold leaders accountable for creating a welcoming and inclusive community? (Synthesis)
- Reflect on a time when you may have excluded or not fully accepted someone within your congregation. How did it make you feel? How can you ensure that you act with acceptance and compassion in the future? (Reflection)
Principle #4: A free and responsible search for truth and meaning
- What does it mean to have a free and responsible search for truth and meaning? How are freedom and responsibility related in this process? (Analysis)
- What are some examples of ways that people may limit their own freedom in searching for truth and meaning? How do these actions impact their ability to find truth and meaning? (Analysis)
- How can a person ensure that their search for truth and meaning is both free and responsible? What are some specific actions they can take to balance freedom and responsibility in this process? (Evaluation)
- What are some of the potential challenges and obstacles that people may face when searching for truth and meaning? How can these challenges be overcome to promote a free and responsible search? (Synthesis)
- Reflect on a time when you have searched for truth and meaning. How did you approach this process? How can you ensure that your search is both free and responsible in the future? (Reflection)
Principle #5: The right of conscience and the use of the democratic process within a congregation and in society at large
- What does it mean to have the right of conscience? How is it different from personal opinions or beliefs? How can it impact the democratic process within a congregation and society at large? (Analysis)
- What are some examples of ways that the right of conscience can be violated or disregarded? How do these actions impact individuals and the community as a whole? (Analysis)
- How can a congregation or society ensure that the right of conscience is respected and protected? What specific actions can be taken to promote a culture of respect for diversity of beliefs and opinions? (Evaluation)
- How can the democratic process be used to ensure that the right of conscience is respected and protected within a congregation and society at large? What role do leaders and members play in this process? (Synthesis)
- Reflect on a time when you may have disregarded or violated someone else’s right of conscience. How did it make you feel? How can you ensure that you respect and protect the right of conscience in the future?” (Reflection)
Principle #6: The goal of world community with peace, liberty, and justice for all
The following questions are writing prompts for the CRE Grades 4+ class. They are designed to use critical thinking to examine each principal. Each question shows the Bloom’s Taxonomy level.- What does it mean to have a goal of world community with peace, liberty, and justice for all? How are these concepts interconnected and why are they important for building a fair and just world? (Analysis)
- What are some examples of conflict or injustice in the world today? How do these issues impact individuals and groups, and what can be done to address them? (Analysis)
- How can we work towards creating a more peaceful, just, and free world? What actions can we take as individuals and what role do governments and institutions play in promoting peace, liberty, and justice? (Evaluation)
- What are some of the historical and current challenges to building a world community with peace, liberty, and justice for all? How have individuals and groups worked to overcome these challenges and promote a fair and just world? (Analysis)
- Reflect on a time when you may have acted or spoken in a way that did not promote peace, liberty, or justice. How did this make you feel? How can you ensure that you behave differently in the future to contribute to the goal of world community with peace, liberty, and justice for all? (Reflection)
Principle #7: The respect for the interdependent web of all existence of which we are a part
The following questions are writing prompts for the CRE Grades 4+ class. They are designed to use critical thinking to examine each principal. Each question shows the Bloom’s Taxonomy level.- What does it mean to respect the interdependent web of all existence? How does it relate to our relationship with the natural world and with other living beings? (Analysis)
- What are some examples of ways that we might not be respecting the interdependent web of all existence? How do these actions impact the natural world and the other living beings with whom we share the planet? (Analysis)
- How can we work to respect the interdependent web of all existence? What specific actions can we take as individuals, and what role do governments and institutions play in promoting this respect? (Evaluation)
- What are some of the challenges and obstacles to respecting the interdependent web of all existence? How can we overcome these challenges and create a more sustainable and just relationship with the natural world? (Synthesis)
- Reflect on a time when you may not have respected the interdependent web of all existence. How did it make you feel? How can you ensure that you act with respect for the natural world in the future? (Reflection)
Principle #8: Working to build a diverse multicultural Beloved Community by our actions that accountably dismantle racism and other oppressions in ourselves and our institutions
- What does it mean to work towards building a diverse multicultural Beloved Community? How does it relate to dismantling racism and other oppressions in ourselves and our institutions? (Analysis)
- What are some examples of ways in which racism and other oppressions are present in our society and institutions? How do these actions impact individuals and groups, and what can be done to address them? (Analysis)
- How can we work towards dismantling racism and other oppressions in ourselves and our institutions? What specific actions can we take as individuals, and what role do governments and institutions play in promoting a diverse multicultural Beloved Community? (Evaluation)
- What are some of the historical and current challenges to building a diverse multicultural Beloved Community? How have individuals and groups worked to overcome these challenges and promote equality and justice? (Analysis)
- Reflect on a time when you may have acted or spoken in a way that reinforced racism or other oppressions. How did this make you feel? How can you ensure that you behave differently in the future to contribute to building a diverse multicultural Beloved Community? (Reflection)
ChatGPT and explaining video streaming
PROMPT
Using the Socratic method, create questions to help systems architects determine if Azure Media Services is the right solution for their video streaming needs.RESPONSE
- What are the specific requirements for your video streaming solution?
- How many concurrent users do you expect to have accessing the video content?
- What is the expected amount of video content that will be uploaded and stored?
- Do you need the ability to live stream or only provide on-demand video content?
- Will the video content be restricted to certain users or regions?
- Are there any specific security or compliance requirements for the video content?
- Are there any existing systems or infrastructure that need to be integrated with the video streaming solution?
- What is the budget for the video streaming solution?
- Are there any scalability or performance requirements for the solution?
- Are there any specific features or functionalities that are needed for the video streaming platform?
PROMPT
Help the systems architect determine the answers to the above questions, by answering the following questions:- What requirements are usually required by a video streaming solution?
- How many concurrent users are expected by an enterprise level streaming solution?
- What is the size of a single, average media asset for a video-on-demand video streaming application? Break it down by media type such as full-length feature film, long form (such as podcasts) and short form (such as TikTok), interstitials, etc.
- Write a value proposition for providing live streaming media in addition to on-demand content.
- Write a rationale for restricting content to certain users or regions.
- Explain why security or compliance requirements are important for video content.
- List other Azure services that might be used with Azure Media Services.
- Give examples of budgets for enterprise level streaming solutions.
- Discuss the value of a CDN and relate that to scaling a video streaming solution.
- Give examples of features and functionalities that are typically used on a video streaming platform.
RESPONSE
- Video streaming solutions typically require the ability to upload, encode, and store video content, as well as the ability to stream that content to users on various devices and platforms. Additional requirements may include the ability to customize the video player, provide closed captioning, and generate analytics on viewer engagement.
- Enterprise level streaming solutions can expect to have thousands of concurrent users accessing the video content.
- The size of a single, average media asset for a video-on-demand video streaming application can vary widely depending on the type of content. A full-length feature film can be several gigabytes in size, while short-form content such as TikTok videos can be just a few megabytes. Long-form content such as podcasts can also be of different size.
- Providing live streaming media in addition to on-demand content can increase viewer engagement and create a more dynamic viewing experience. Live streams can also be used for events such as concerts, conferences, and news broadcasts, which can attract a larger audience.
- Restricting content to certain users or regions can be done for a variety of reasons, such as compliance with local laws and regulations, or to protect exclusive distribution agreements.
- Security and compliance requirements are important for video content to protect against unauthorized access and distribution, as well as to comply with data privacy laws and regulations.
- Other Azure services that can be used with Azure Media Services include Azure Cognitive Services for video indexing and Azure storage for content storage and management.
- Budgets for enterprise level streaming solutions can vary widely depending on the specific requirements and scale of the project, but can range from tens of thousands of dollars to several million dollars.
- A Content Delivery Network (CDN) can help to scale a video streaming solution by caching and delivering video content from servers that are physically closer to the viewer. This can help to improve the viewing experience and reduce the load on the main servers.
- Features and functionalities that are typically used on a video streaming platform include the ability to create playlists, generate viewer analytics, customize the video player, provide closed captioning and subtitles, and integrate with other systems such as social media and marketing platforms.
PROMPT
Answer the following questions:- List video streaming capable devices and the requirements for low-latency streaming for each one.
- Provide recommendations for how an enterprise level organization can determine how many concurrent users they may have in a month.
- Help the CTO determine the cost of hosting a single, Azure Media Services media asset that is 2 gigabytes in size for a single month.
- Give examples of increasing viewer engagement through a dynamic viewing experience.
- Give an example of restricting media content because of compliance with local laws and regulations.
- Provide an example of a security practice for restricting access to media content.
- How would an Azure Media Services customer make sure that they have architected their media streaming solution so that it has high availability?
- Recommend media streaming practices for a company that has a yearly budget of $50,0000.
- Explain how a media streaming solution can guarantee that media content has been cached on a CDN regardless of whether an end user has requested the content.
- Give a rationale for why a media streaming platform would want to generate viewer analytics.
RESPONSE
- Video streaming capable devices include smart TVs, streaming media players (such as Roku, Amazon Fire TV, and Apple TV), gaming consoles (such as Xbox and PlayStation), smartphones and tablets, and personal computers. For low-latency streaming, the device should support the required streaming protocol (such as HLS or DASH) and have a fast internet connection.
- To determine the number of concurrent users for an enterprise level organization, the organization should consider factors such as the expected number of viewers, the frequency of video usage, and the peak usage times. The organization can also gather data on historical usage patterns, and use analytics tools to monitor real-time usage.
- The cost of hosting a single, 2 gigabyte media asset on Azure Media Services for a single month can vary depending on the specific pricing plan and usage. The customer can use the Azure Media Services pricing calculator to estimate the cost.
- Examples of increasing viewer engagement through a dynamic viewing experience include providing interactive features such as polls and quizzes, incorporating social media into the viewing experience, and providing multiple camera angles or interactive experiences during live streams.
- An example of restricting media content because of compliance with local laws and regulations is a streaming service that only allows access to content that has been approved for distribution within a particular country or region.
- An example of a security practice for restricting access to media content is the use of token-based authentication, which ensures that only authorized users can access the content.
- To ensure high availability for an Azure Media Services solution, the customer should use Azure availability zones, use multiple Content Delivery Network (CDN) to distribute content globally and replicate the media content across different regions.
- For a company with a yearly budget of $50,000, media streaming practices may include using a cost-effective hosting solution such as Azure Media Services, using a Content Delivery Network (CDN) to distribute content globally, and using analytics tools to monitor usage and optimize the streaming experience.
- To guarantee that media content has been cached on a CDN regardless of whether an end user has requested the content, the media streaming solution can use a technique called “prefetching.” This means that the CDN automatically caches content that is likely to be requested in the future, based on historical usage data or other factors.
- A media streaming platform generates viewer analytics to understand audience behavior, such as how many viewers are watching, how long they are watching for, and which parts of the video are most popular. This information can be used to improve the streaming experience, optimize the video content and make more informed decisions about how to monetize the content.
PROMPT
Answer the following questions:- Explain the HLS and DASH protocols.
- Let’s say that the organization has never implemented a video streaming service. What data can they use to determine expected number of viewers, the frequency of video usage, and the peak usage times?
- What is the URL of the Azure Media Services pricing calculator?
- What is the most effective way for a company to see ROI on a media streaming solution?
- Give an example of media content that is NOT approved for a specific region.
- Explain token-based authentication for Azure Media Services.
- What is an Azure availability zone?
- Describe a cost-effective media streaming solution.
- Describe the implementation of CDN prefetching.
- If users are consistently watching a specific range of time within a video, what conclusions would a company make about that fact? What actions would they take based on this information?
RESPONSE
- HLS (HTTP Live Streaming) and DASH (Dynamic Adaptive Streaming over HTTP) are two protocols used for streaming video content over the internet. HLS is developed by Apple and is used primarily on Apple devices, while DASH is an open standard that is supported by a wide range of devices and platforms. Both protocols break the video content into small segments, which are then delivered to the viewer’s device in real-time. This allows the video player to adapt the video quality to the viewer’s network conditions in real-time.
- An organization that has never implemented a video streaming service can use various data to determine the expected number of viewers, frequency of video usage, and peak usage times. They can conduct market research to gauge the potential demand for their service, gather data on the viewing habits of their target audience, and analyze historical data from similar services or industry benchmarks.
- The URL for the Azure Media Services pricing calculator is https://azure.com/mediaservices/pricing-calculator
- The most effective way for a company to see ROI on a media streaming solution is to carefully track key performance indicators (KPIs) such as user engagement, ad revenue, and subscription revenue. The company can also analyze the cost savings associated with the streaming solution, such as reduced costs for content delivery or content management.
- An example of media content that is not approved for a specific region is a movie that has been banned by the government or has not yet been granted distribution rights in that region.
- Token-based authentication for Azure Media Services is a security feature that ensures that only authorized users can access the content. This is done by requiring users to present a unique token, which is verified against a database of authorized users.
- An Azure availability zone is a physically separate location within an Azure region, providing redundant power, cooling, and networking. It helps to ensure that the services and applications running in the zone will be highly available and resilient to failures.
- A cost-effective media streaming solution could include using a low-cost hosting service such as Azure Media Services, using a Content Delivery Network (CDN) to distribute content globally, and using analytics tools to monitor usage and optimize the streaming experience.
- CDN prefetching is a technique where the CDN anticipates the content that is likely to be requested and caches it in advance. This can be done by analyzing historical usage data or other factors that predict which content is likely to be requested in the future.
- If users are consistently watching a specific range of time within a video, a company would conclude that the content during that specific range of time is particularly interesting or valuable to the viewers. Based on this information, they may decide to focus on creating similar content in the future, or to highlight that specific section of the video in promotional materials.
Orny and DAL-E
I am experimenting with DAL-E prompts. Orny Adams is one of my favorite comedians who has a podcast that he hosts in a Shasta trailer in his backyard.
PROMPT
A Marvel comic illustration of Orny Adams hosting his podcast in a yellow Shasta trailer located in his Los Angeles backyard by Jack Kirby and Steve Ditko.
RESULT
The second one is framed exactly the way Orny frames his shots in the Shasta.
Next up, Disco Diffusion using the same prompt. It’s going to take all night for the frames to render.
Using ChatGPT to Create PlantUML Entity diagrams
More messing around with ChatGPT and automating documentation for APIs. This time, instead of using a JSON file, I used a description of one of the entities in Azure Media Services.
I also installed the PlantUML plugin on this website. The rendered chart is below the code sample. It’s not exactly right, as an asset is really a storage container that extends the storage container with its own properties and methods. It’s a start though.
Test 1
PROMPT
1. Determine the entities in the following text: An Asset is mapped to a blob container in the Azure Storage account and the files in the Asset are stored as block blobs in that container. Assets contain information about digital files stored in Azure Storage (including video, audio, images, thumbnail collections, text tracks, and closed caption files).
2. Describe the relationship of the entities in PlantUML.
RESULTS
@startuml
class Asset {
+info: String
}
class BlobContainer {
}
class AzureStorage {
}
class File {
}
class BlockBlob {
}
class Video {
}
class Audio {
}
class Image {
}
class ThumbnailCollection {
}
class TextTrack {
}
class ClosedCaptionFile {
}
Asset –> BlobContainer
BlobContainer –> AzureStorage
Asset –> File
File –> BlockBlob
Asset –> Video
Asset –> Audio
Asset –> Image
Asset –> ThumbnailCollection
Asset –> TextTrack
Asset –> ClosedCaptionFile
@enduml
TEST 2
This time, I tried using a truncated version of the Asset JSON for Azure Media Services.
I got the following feedback from ChatGPT about the formatting of the JSON, which I appreciate.
“This diagram shows that “Asset” class has an attribute “AssetProperties” which is an object of type “AssetProperties”, which in turn has an attribute “properties” that is an object of “Properties”. And the “Properties” class has several attributes, including “assetId”, “created”, “lastModified”, “alternateId”, “description”, “container”, “storageAccountName”, and “storageEncryptionFormat”. It should be noted that the JSON provided has duplicate information and also the properties types are not well formatted to be used in PlantUML.”
PROMPT
Create a PlantUML class diagram using the following JSON:
{
"Asset" : {
"AssetProperties": {
"properties": {
"assetId": {
"type": "string",
"format": "uuid",
"description": "The Asset ID.",
"readOnly": true,
"x-nullable": false
},
"created": {
"type": "string",
"format": "date-time",
"description": "The creation date of the Asset.",
"readOnly": true,
"x-nullable": false
},
"lastModified": {
"type": "string",
"format": "date-time",
"description": "The last modified date of the Asset.",
"readOnly": true,
"x-nullable": false
},
"alternateId": {
"type": "string",
"description": "The alternate ID of the Asset."
},
"description": {
"type": "string",
"description": "The Asset description."
},
"container": {
"type": "string",
"description": "The name of the asset blob container."
},
"storageAccountName": {
"type": "string",
"description": "The name of the storage account."
},
"storageEncryptionFormat": {
"type": "string",
"enum": [
"None",
"MediaStorageClientEncryption"
],
"x-ms-enum": {
"name": "AssetStorageEncryptionFormat",
"values": [
{
"value": "None",
"description": "The Asset does not use client-side storage encryption (this is the only allowed value for new Assets)."
},
{
"value": "MediaStorageClientEncryption",
"description": "The Asset is encrypted with Media Services client-side encryption."
}
],
"modelAsString": true
},
"description": "The Asset encryption format. One of None or MediaStorageEncryption.",
"readOnly": true,
"x-nullable": false
}
},
"type": "object",
"description": "The Asset properties."
}
}
}
RESULTS
Here’s the resulting PlantUML:
@startuml
class Asset {
-AssetProperties : AssetProperties
}
class AssetProperties {
-properties : Properties
-type : object
-description : string
}
class Properties {
-assetId : string
-created : string
-lastModified : string
-alternateId : string
-description : string
-container : string
-storageAccountName : string
-storageEncryptionFormat : string
}
@enduml
Here’s the class diagram:
First Pass at Testing ChatGPT for reading a JSON OpenAPI file
Noodling on how documentation could be automated for an API. Below is the prompt I used with an excerpt from the Azure Media Services OpenAPI JSON for AMS accounts.
PROMPT
You are a technical content writer.
Your task is to document the Azure Media Services API.
Silently do the following:
1/ Read the JSON between the <OpenAPIJSON></OpenAPIJSON> tags below.
2/ Find the “description” for each entity.
3/ Associate each entity with the description value.
4/ Output your results as follows:
Output:
1/ Print “Azure Media Services Account Entities” at the top.
2/ Print a Markdown table of the entities using the entity name in the first column and the entity description value the second column.
Constraints: Do not change any of the wording in the text in such a way that the original meaning.
“parameters”: {
“SubscriptionId”: {
“name”: “subscriptionId”,
“in”: “path”,
“required”: true,
“type”: “string”,
“description”: “The unique identifier for a Microsoft Azure subscription.”
},
“ResourceGroupName”: {
“name”: “resourceGroupName”,
“in”: “path”,
“required”: true,
“type”: “string”,
“description”: “The name of the resource group within the Azure subscription.”,
“x-ms-parameter-location”: “method”
},
“ApiVersion”: {
“name”: “api-version”,
“in”: “query”,
“required”: true,
“type”: “string”,
“description”: “The version of the API to be used with the client request.”
}
}
</OpenAPI JSON>
RESULT
Azure Media Services streaming with the Shaka Player
Website recycle
I let this site rot for so long it smelled like New York city summer garbage during a sanitation strike. Cobbler’s children have no Birkenstocks.
Lately, the content work for Azure Media Services (AMS) has gotten pretty architecturey. I’m writing about how to monitor the service as well as planning Learn modules.
Planning for Learn modules has made me think about how to present information to the learner from the most basic application of the service to the most advanced. It isn’t YouTube. It’s what a YouTube would be built on.
I’ve been messing around with adding Azure Active Directory to this site in order to experiment with restricting pages to certain user groups. That led to checking with my ISP about what in the Sam Hell happened to my SSL certificate and how do I wake it from deep, death-like slumber. (No, I don’t host this site on Azure.)
Half the day was spent trying to figure out how to get back into wp-admin while the DNS entries I screwed up corrected themselves, and deactivating the WordPress AAD plugin I am now calling HAL.
Things were upgraded including the GrassBlade LRS – and deleted – like old portfolio sample pages and posts I probably shouldn’t have published in the first place.
The About page got a smoke-free edit.
I’ll be keeping post notes on the experiments here.
Anyway, post #1 done.