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
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ I also tried to make it as **generic** and **reusable** as possible to cover mos
- AI Agent ReAct (Reasoning + Acting) with tool calling, MongoDB session persistence, and input guardrails
- RAG with semantic and embedding caching
- Llama 3.3, Llama 4 Scout (vision use case)
- OpenAI Moderation
- Support for a range of foundational and embedding models (DeepSeek, Llama, Mistral, Sentence Transformers, etc.) via LangChain, Groq, and Hugging Face
- **API Examples**
- **Backoffice:** Lob (USPS Mail), Paypal, Quickbooks, Stripe, Twilio (text messaging)
Expand Down Expand Up @@ -414,17 +413,6 @@ Next, create API keys for the services you enabled:

<hr>

<img src="https://i.imgur.com/iCsCgp6.png" height="75">

The OpenAI moderation API for checking harmful inputs is free to use as long as you have paid credits in your OpenAI developer account. The cost of using their other models depends on the model, as well as the input and output size of the API call.

- Visit <a href="https://platform.openai.com/api-keys" target="_blank">OpenAI API Keys</a>
- Sign in or create an OpenAI account.
- Click on **Create new secret key** to generate an API key.
- Copy and paste the generated API key into your `.env` file as `OPENAI_API_KEY` or set it as an environment variable.

<hr>

<img src="https://imgur.com/VpWnjp1.png" height="75">

- Visit <a href="https://developer.paypal.com" target="_blank">PayPal Developer</a>
Expand Down
2 changes: 0 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,6 @@ app.get('/api/giphy', apiController.getGiphy);
* AI Integrations and Boilerplate example routes.
*/
app.get('/ai', aiController.getAi);
app.get('/ai/openai-moderation', aiController.getOpenAIModeration);
app.post('/ai/openai-moderation', aiController.postOpenAIModeration);
app.get('/ai/llm-classifier', aiController.getLLMClassifier);
app.post('/ai/llm-classifier', aiController.postLLMClassifier);
app.get('/ai/llm-camera', lusca({ csrf: true }), aiController.getLLMCamera);
Expand Down
61 changes: 0 additions & 61 deletions controllers/ai.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,67 +525,6 @@ exports.postRagAsk = async (req, res) => {
}
};

/**
* GET /ai/openai-moderation
* OpenAI Moderation API example.
*/
exports.getOpenAIModeration = (req, res) => {
res.render('ai/openai-moderation', {
title: 'OpenAI Input Moderation',
result: null,
error: null,
input: '',
});
};

/**
* POST /ai/openai-moderation
* OpenAI Moderation API example.
*/
exports.postOpenAIModeration = async (req, res) => {
const openAiKey = process.env.OPENAI_API_KEY;
const inputText = req.body.inputText || '';
let result = null;
let error = null;

if (!openAiKey) {
error = 'OpenAI API key is not set in environment variables.';
} else if (!inputText.trim()) {
error = 'Text for input modaration check:';
} else {
try {
const response = await fetch('https://api.openai.com/v1/moderations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${openAiKey}`,
},
body: JSON.stringify({
model: 'omni-moderation-latest',
input: inputText,
}),
});
if (!response.ok) {
const errData = await response.json().catch(() => ({}));
error = errData.error && errData.error.message ? errData.error.message : `API Error: ${response.status}`;
} else {
const data = await response.json();
result = data.results && data.results[0];
}
} catch (err) {
console.error('OpenAI Moderation API Error:', err);
error = 'Failed to call OpenAI Moderation API.';
}
}

res.render('ai/openai-moderation', {
title: 'OpenAI Moderation API',
result,
error,
input: inputText,
});
};

/**
* Helper functions and constants for LLM API Examples
* We are using LLMs to classify text or analyze a picture taken by the user's camera.
Expand Down
1 change: 0 additions & 1 deletion test/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ test/
│ ├── here-maps.e2e.test.js
│ ├── lob.e2e.test.js
│ ├── nyt.e2e.test.js
│ ├── openai-moderation.e2e.test.js
│ ├── llm-classifier.e2e.test.js
│ ├── trakt.e2e.test.js
│ └── twilio.e2e.test.js
Expand Down
54 changes: 0 additions & 54 deletions test/e2e/openai-moderation.e2e.test.js

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 1 addition & 12 deletions test/fixtures/fixture_manifest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1 @@
[
"e2e-nokey/github-api.e2e.test.js",
"e2e-nokey/pubchem.e2e.test.js",
"e2e-nokey/scraping.e2e.test.js",
"e2e-nokey/wikipedia.e2e.test.js",
"e2e/chart.e2e.test.js",
"e2e/foursquare.e2e.test.js",
"e2e/nyt.e2e.test.js",
"e2e/openai-moderation.e2e.test.js",
"e2e/trakt.e2e.test.js",
"e2e/giphy.e2e.test.js"
]
["e2e-nokey/github-api.e2e.test.js", "e2e-nokey/pubchem.e2e.test.js", "e2e-nokey/scraping.e2e.test.js", "e2e-nokey/wikipedia.e2e.test.js", "e2e/chart.e2e.test.js", "e2e/foursquare.e2e.test.js", "e2e/nyt.e2e.test.js", "e2e/trakt.e2e.test.js", "e2e/giphy.e2e.test.js"]
Comment thread
YasharF marked this conversation as resolved.
13 changes: 0 additions & 13 deletions views/ai/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,3 @@ block content
li Input guardrail
li SSE streaming responses
li MongoDB chat session persistence

.col-md-4
a.text-decoration-none(href='/ai/openai-moderation')
.card.text-white.h-100(style='background-color: #fff3cd')
.card-body.d-flex.flex-column.flex-grow-1
.d-flex.align-items-center.mb-2.flex-wrap.justify-content-center
img(src='https://i.imgur.com/EP2SafD.png', style='height: 40px; width: auto')
.text-dark.text-start.w-100
h5.text-center OpenAI LLM Input Moderation
ul.mb-0
li OpenAI Moderation API
li Real-time input filtering
li Safe content enforcement
61 changes: 0 additions & 61 deletions views/ai/openai-moderation.pug

This file was deleted.

Loading