npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mortgage-explainer-sdk

v0.0.2

Published

A simple SDK to create plain English descriptions of mortgage products using OpenAI

Downloads

5

Readme

Mortgage Explainer SDK

This is a simple TypeScript SDK which uses the Azure OpenAI service to generate plain English explanations of mortgage products. It is intended to be used as a reference for how to use the Azure OpenAI API, and as a starting point for building your own SDKs.

To use this SDK, you will need to have an Azure subscription running an Azure OpenAI instance and an OpenAI API key. These details are passed to the SDK in the constructor.

Usage

First create a new TypeScript project and install the SDK:

npm install mortgage-explainer-sdk

Then create a new environment file called .env and add the following:

AI_API_KEY=<your-api-key>
AI_INSTANCE=<your-instance>
AI_API_VERSION=<your-api-version>
AI_DEPLOYMENT=<your-deployment>

Finally create a new file called index.ts and add the following code:

import dotenv from "dotenv";
import { MortgageExplainerSDK, OpenAIConfig, Product } from "mortgage-explainer-sdk";

dotenv.config();

export async function main() {
	const explainer = new MortgageExplainerSDK({
		apiKey: process.env.AI_API_KEY,
		instance: process.env.AI_INSTANCE,
		apiVersion: process.env.AI_API_VERSION,
		deployment: process.env.AI_DEPLOYMENT
	} as OpenAIConfig);

	const result = await explainer.explainProduct({
		rate: 4.64,
		duration: 2,
		type: "tracker",
		ltv: 75,
		erc: 0,
		fee: 999,
		clientType: "remortgage"
	} as Product);

	console.log(result);
}

This example calls the explainProduct method of the SDK, which returns a promise that resolves to a string containing the explanation. The Product object passed to the method contains the details of the mortgage product to be explained.

The output of the above code should look something like this:

This is a remortgage product, which means you are switching your existing mortgage product for this one. The initial interest rate is 4.64%, which means that for the first two years of the mortgage, that will be the rate you pay. This mortgage product is a tracker, which means that the interest rate you pay will move up and down in line with a chosen base rate, usually the Bank of England's interest rate.

The maximum loan to value (LTV) is 75%, which means you can borrow up to 75% of the value of your property. There are no early repayment charges (ERC) if you decide to pay off the mortgage fully or partially earlier than the end of the two-year period. However, if you decide to move to a new mortgage product before this initial two-year period ends, you will be subject to early repayment charges. The arrangement fee for this mortgage product is £999, which you will need to pay when you set up the mortgage.

It's important to know that after the initial two-year period, you will move onto the standard variable rate of the bank, which may be higher or lower than the initial rate you are paying. It's always a good idea to keep an eye on your mortgage payments and consider switching to a new mortgage product when the initial period ends, to ensure you are getting the best deal for your circumstances.

I want to highlight that what I've said is only an explanation of the product and does not constitute financial advice. It's always best to speak to a qualified mortgage adviser who can provide tailored advice for your specific situation.