Posts

creating logic app driven by http trigger and send email

Image
We can easily create a logic app that run "When http request is triggered" and then send out email.  The logic app looks something like this :-  We will use the following json to define out schema  {"receipient": "test@example.com","title": "Hello","message": "This is a test"} And this us what our request body JSON schema would look like Then we will create "Send an email (v2)". In our send email parameter setup, it looks something like this. When our http triggers completes, it returns a json but it is also a STRING. And we need to be able to convert it into a json otherwise you will get the following errors :- Unable to process template language expressions in action 'Send_an_email_(V2)' inputs at line '0' and column '0': 'The template language expression 'triggerBody()?['receipient']' cannot be evaluated because property 'receipient' cannot be selected....

dynatrace storing user credentials in credentials vault

We can store credentials like username, password or even your app registration in dynatrace. These are typically used in workflows. Goto Settings -> Preference-> Credential Vault.  Then we can scope - scope configuration allow us to decide if this can is accessbile via workflow or sythetics. How do you access its values? We can access its value using javascripts in Dynatrace workflow. Here is a code snippet that can be use the do this. import { credentialVaultClient , CredentialsDetailsTokenResponseElement } from ' @dynatrace-sdk/client-classic-environment-v2 '; const c redentials = await credentialVaultClient . getCredentialsDetails ( {   id : ' CREDENTIALS_VAULT-xxxxxxxxxxxxxxxx ' , } ) ;   // depeding on what type of credential you have setup   console . log (c redentials . token ) ; // If it is username console . log (c redentials . username ) ; // and password console . log (c redentials . password ) ;

vscode python suddenly does not support goto method definitions with crtrl + click

Image
All in a suddden, my vscode stop responding to Ctrl + click that allows me to go to method defintions. This is due to interpreter are not configured or stop working. In my case, I am using uv manage and therefore I had to ensure the configuration is correct - the green section configure environment while the red rectangle configure "interpreter" - which is what is missing. Once you fix it, we are good to go. 

aws bedrock using qwen.qwen3-coder-next is easy

Image
To work with AWS bedrock, we can consume the qwen.qwen3-coder-next mdoel using API key. Let's dive right in.  Using uv package manager, run  uv init  uv venv uv add openai And you need the following code when using "qwen.qwen3-coder-next" instead of the antrophic library. from openai import OpenAI client = OpenAI () response = client . chat . completions . create (     model = " qwen.qwen3-coder-next " ,     messages =[{ " role " : " user " , " content " : " What is Amazon Bedrock? " }], ) print ( response . choices [ 0 ]. message . content ) You would need to setup your environment variables.  set OPENAI_API_KEY="YOUR-API-KEY" set OPENAI_BASE_URL=https://bedrock-mantle.ap-southeast-2.api.aws/v1 set OPENAI_PROJECT_ID=default And then just run  python main.py   

mcp server configuration for vscode

We can quickly configure vscode to use github mcp by creating a fille under .vscode/mcp.json. This file should contain the followings:- {   " inputs " : [     {       " type " : " promptString " ,       " id " : " github_token " ,       " description " : " GitHub Personal Access Token " ,       " password " : true     }   ],   " servers " : {     " github " : {       " command " : " docker " ,       " args " : [         " run " , " -i " , " --rm " ,         " -e " , " GITHUB_PERSONAL_ACCESS_TOKEN " ,         " ghcr.io/github/github-mcp-server "       ],       " env " : {         " GITHUB_PERSONAL_ACCESS_TOKEN " : " ${input:github_token} "       }     }   } } And then you are good to prompt away

Azure AI Foundry setting up RAG with Azure Search AI

Image
To enable RAG in our agent, we need Azure foundry embedding model and a gpt-4-o model to test it out. This will empower our agent with inhouse knowledge.  Lets deploy our Azure Foundry instance first. Pretty straight forward. Ensure we have deployed 2 model - embedding-3-small as shown below We also need a storage account where we place our document to be indexed by Azure AI Search later.  Next, we will create an Azure AI Search service. This will allow us to index document in our storage account. We can also configure a schedule if we wanted to:-  Then we can import our document to build up our knowledge base.  Here, we will configure our vector searches and now you know why we are creating the embedding model. Next we will setup our agent and then add knowlege to it. So we create an agent.  Under the section, knowledge (on the left tab), that's where we provide a knowledge and index to it. Once we have configure it, we can prompt our agent accordingly.

Azure foundry client code for using response API

OpenAI Respose API is supported by the framework and we can easily use the following code to call it.  from azure . ai . projects import AIProjectClient from azure . identity import DefaultAzureCredential project_client = AIProjectClient (     endpoint = " https://<your-resource>.services.ai.azure.com/api/projects/<your-project> " ,     credential = DefaultAzureCredential () ) # Get an OpenAI-compatible client scoped to this project openai_client = project_client . get_openai_client () # First turn response = openai_client . responses . create (     model = " gpt-4o " ,   # your deployment name     input = " What's the speed of light? " ) print ( response . output_text ) # Next turn — chain via previous_response_id, just send the new input response2 = openai_client . responses . create (     model = " gpt-4o " ,     input = " And what about sound? " ,     previous_response_id = respo...

model training underfitting, overfitting and more

Image
Common challenges in a model training are  1. overfitting - high train accuracy, terrible production performance  Red flag signals Train accuracy 98%+, val accuracy 65–70% Train loss keeps falling, val loss starts rising (divergence point) Large gap between train F1 and val F1 Model memorises noise — shuffling labels barely changes train loss Primary metrics to watch Train/val loss gap Generalisation gap Val accuracy Learning curves Val F1 Watch the gap , not the absolute numbers. Train acc 98% is fine if val acc is also 94%. The gap is the signal. Primary metrics to watch Train/val loss gap Generalisation gap Val accuracy Learning curves Val F1 Watch the gap , not the absolute numbers. Train acc 98% is fine if val acc is also 94%. The gap is the signal. This is what a overfitting learning curve graph looks like. As you can see the generalization gap higher than 0.15 is a red flag. In our case, it is 0.426.  One more thing to note is the red line will diverge and ...