Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-extension
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
16 changes: 16 additions & 0 deletions config/ner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const ner = ({text_input = '', description = '', domain = '', labels = '', examples = []}) => {

if(!text_input) throw new Error('input is required');

const _domain = `${domain ? `${domain} domain` : ''}`;
const _label = `${labels ? `following predefined entity types: ${labels}` : 'entity types'}`;
const _example = examples && examples.length > 0 ? `Examples: ${ examples.map(ex => `Input ${ex.sentence} Output [${ex.sentence}]`) }` : ''
return `
${description}
You are a highly intelligent and accurate ${_domain} Named-entity recognition(NER) system. You take Passage as input and your task is to recognize and extract specific types of ${_domain} named entities in that given passage and classify into a set of ${_label}.
Your output format is only {{ output_format|default("[{{'T': type of entity from predefined entity types, 'E': entity in the input text}},...,{{'branch' : Appropriate branch of the passage ,'group': Appropriate Group of the passage}}]") }} form, no other form.
${_example}
Input: ${text_input}
Output:
`
}
15 changes: 15 additions & 0 deletions examples/example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ner } from "../config/ner"
import { OpenAI } from "../models/openai"
import { Prompter } from "../promptify"

const model = OpenAI('api_key')

const prompt = ner({
text_input : '',
description : '',
domain : '',
labels : '',
examples : []
})

const result = Prompter(model, prompt)
5 changes: 5 additions & 0 deletions models/openai.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const OpenAI = (key) => {
if(!key) throw new Error('Open AI key is required')

// Logic to validate `apiKey`
}
Loading