Skip to content

Commit 5d25467

Browse files
committed
Add variable request throttling
1 parent 530ae6c commit 5d25467

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

asciidoc/courses/genai-workshop/course.adoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
:usecase: recommendations
66
:key-points: A comma, separated, list of learnings
77
:repository: neo4j-graphacademy/genai-workshop
8+
:allow-llm-calls: true
9+
:llm-call-limit: 0
810

911
== Course Description
1012

11-
In this GenAI and Neo4j workshop, you will learn how Neo4j can support your GenAI projects.
13+
In this GenAI and Neo4j workshop, you will learn how Neo4j can support your GenAI projects.
1214

13-
You will:
15+
You will:
1416

1517
* Use Vector indexes and embeddings in Neo4j to perform similarity and keyword search
1618
* Use Python and LangChain to integrate with Neo4j and OpenAI
@@ -34,7 +36,7 @@ While not essential, we completing the GraphAcademy link:/courses/neo4j-fundamen
3436

3537
== What you need
3638

37-
To complete the practical tasks within this workshop, you will need:
39+
To complete the practical tasks within this workshop, you will need:
3840

3941
* Access to gitpod.io (you will need a github, gitpod, or bitbucket account) or a local Python environment
4042
* An OpenAI billing account and API key

asciidoc/courses/llm-chatbot-python/course.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
:key-points: Building a Neo4j-backed Chatbot, Neo4j & Langchain, Neo4j & Streamlit
99
:repository: neo4j-graphacademy/llm-chatbot-python
1010
:allow-llm-calls: true
11+
:llm-call-limit: 50
12+
:llm-call-limit-period: PT2M
13+
1114

1215
== Course Description
1316

asciidoc/courses/llm-chatbot-typescript/course.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
:reward-provider: printful
1414
:reward-product-id: @65f874e831d488,@65f875094279d1
1515
:allow-llm-calls: true
16+
:llm-call-limit: 20
17+
:llm-call-limit-period: PT2M
1618

1719
== Course Description
1820

src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,5 @@ export const ATTRIBUTE_QUESTIONS = 'questions'
6565
export const ATTRIBUTE_PASS_PERCENTAGE = 'pass-percentage'
6666
export const ATTRIBUTE_KEY_POINTS = 'key-points'
6767
export const ATTRIBUTE_ALLOW_LLM_CALLS = 'allow-llm-calls'
68+
export const ATTRIBUTE_LLM_CALL_LIMIT_PERIOD = 'llm-call-limit-period'
69+
export const ATTRIBUTE_LLM_CALL_LIMIT = 'llm-call-limit'

src/services/merge-courses.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Session, ManagedTransaction } from 'neo4j-driver';
55
import { loadFile } from '../modules/asciidoc'
66
import { getDriver } from '../modules/neo4j';
77
import { CourseToImport, LessonToImport, ModuleToImport, QuestionToImport } from '../types';
8-
import { ASCIIDOC_DIRECTORY, ATTRIBUTE_CAPTION, ATTRIBUTE_CATEGORIES, ATTRIBUTE_CERTIFICATION, ATTRIBUTE_CLASSMARKER_ID, ATTRIBUTE_CLASSMARKER_REFERENCE, ATTRIBUTE_DISABLE_CACHE, ATTRIBUTE_DURATION, ATTRIBUTE_LAB, ATTRIBUTE_LANGUAGE, ATTRIBUTE_NEXT, ATTRIBUTE_OPTIONAL, ATTRIBUTE_REDIRECT, ATTRIBUTE_REPOSITORY, ATTRIBUTE_SANDBOX, ATTRIBUTE_STATUS, ATTRIBUTE_THUMBNAIL, ATTRIBUTE_TRANSLATIONS, ATTRIBUTE_REWARD_FORM, ATTRIBUTE_REWARD_IMAGE, ATTRIBUTE_REWARD_PRODUCT_ID, ATTRIBUTE_REWARD_PROVIDER, ATTRIBUTE_TYPE, ATTRIBUTE_UPDATED_AT, ATTRIBUTE_USECASE, ATTRIBUTE_VIDEO, COURSE_DIRECTORY, DEFAULT_COURSE_STATUS, DEFAULT_COURSE_THUMBNAIL, DEFAULT_LANGUAGE, DEFAULT_LESSON_TYPE, STATUS_DISABLED, ATTRIBUTE_REWARD_TYPE, ATTRIBUTE_DESCRIPTION, ATTRIBUTE_QUESTIONS, ATTRIBUTE_PASS_PERCENTAGE, ATTRIBUTE_KEY_POINTS, ATTRIBUTE_BRANCH, ATTRIBUTE_ALLOW_LLM_CALLS } from '../constants';
8+
import { ASCIIDOC_DIRECTORY, ATTRIBUTE_CAPTION, ATTRIBUTE_CATEGORIES, ATTRIBUTE_CERTIFICATION, ATTRIBUTE_CLASSMARKER_ID, ATTRIBUTE_CLASSMARKER_REFERENCE, ATTRIBUTE_DISABLE_CACHE, ATTRIBUTE_DURATION, ATTRIBUTE_LAB, ATTRIBUTE_LANGUAGE, ATTRIBUTE_NEXT, ATTRIBUTE_OPTIONAL, ATTRIBUTE_REDIRECT, ATTRIBUTE_REPOSITORY, ATTRIBUTE_SANDBOX, ATTRIBUTE_STATUS, ATTRIBUTE_THUMBNAIL, ATTRIBUTE_TRANSLATIONS, ATTRIBUTE_REWARD_FORM, ATTRIBUTE_REWARD_IMAGE, ATTRIBUTE_REWARD_PRODUCT_ID, ATTRIBUTE_REWARD_PROVIDER, ATTRIBUTE_TYPE, ATTRIBUTE_UPDATED_AT, ATTRIBUTE_USECASE, ATTRIBUTE_VIDEO, COURSE_DIRECTORY, DEFAULT_COURSE_STATUS, DEFAULT_COURSE_THUMBNAIL, DEFAULT_LANGUAGE, DEFAULT_LESSON_TYPE, STATUS_DISABLED, ATTRIBUTE_REWARD_TYPE, ATTRIBUTE_DESCRIPTION, ATTRIBUTE_QUESTIONS, ATTRIBUTE_PASS_PERCENTAGE, ATTRIBUTE_KEY_POINTS, ATTRIBUTE_BRANCH, ATTRIBUTE_ALLOW_LLM_CALLS, ATTRIBUTE_LLM_CALL_LIMIT, ATTRIBUTE_LLM_CALL_LIMIT_PERIOD } from '../constants';
99
import { courseOverviewPath, getDateAttribute, getOrderAttribute } from '../utils';
1010

1111
const loadCourses = (): CourseToImport[] => {
@@ -88,6 +88,8 @@ const loadCourse = (courseFolder: string): CourseToImport => {
8888
questions: file.getAttribute(ATTRIBUTE_QUESTIONS, null),
8989
passPercentage: file.getAttribute(ATTRIBUTE_PASS_PERCENTAGE, null),
9090
allowsLLMCalls: file.getAttribute(ATTRIBUTE_ALLOW_LLM_CALLS, 'false') === 'true',
91+
llmCallLimit: file.getAttribute(ATTRIBUTE_LLM_CALL_LIMIT),
92+
llmCallLimitPeriod: file.getAttribute(ATTRIBUTE_LLM_CALL_LIMIT_PERIOD),
9193
attributes: {
9294
rewardType: file.getAttribute(ATTRIBUTE_REWARD_TYPE, null),
9395
rewardForm: file.getAttribute(ATTRIBUTE_REWARD_FORM, null),
@@ -218,6 +220,8 @@ const mergeCourseDetails = (tx: ManagedTransaction, courses: CourseToImport[]) =
218220
c.questions = toInteger(course.questions),
219221
c.passPercentage = toInteger(course.passPercentage),
220222
c.allowsLLMCalls = course.allowsLLMCalls,
223+
c.llmCallLimit = toInteger(course.llmCallLimit),
224+
c.llmCallLimitPeriod = course.llmCallLimitPeriod,
221225
c += course.attributes
222226
223227
FOREACH (_ IN CASE WHEN course.certification THEN [1] ELSE [] END | SET c:Certification)

0 commit comments

Comments
 (0)