cryogenic22 commited on
Commit
8182147
·
verified ·
1 Parent(s): 97a8e00

Update learning_platform.py

Browse files
Files changed (1) hide show
  1. learning_platform.py +4 -15
learning_platform.py CHANGED
@@ -5,11 +5,9 @@ from datetime import datetime
5
  from typing import List, Dict, Any, Literal
6
 
7
  import faiss # Example for vector store
8
- from langchain.chains import LLMChain # Example for LLMChain
9
  from langchain.chat_models import ChatOpenAI
10
  from langchain.embeddings import OpenAIEmbeddings # Example for embeddings
11
- from langchain.prompts import PromptTemplate # Example for PromptTemplate
12
- from langgraph.graph import StateGraph, START, END
13
 
14
 
15
  @dataclass
@@ -65,16 +63,8 @@ class Config:
65
  "max_retries": 3,
66
  "timeout": 300
67
  }
68
- self.rag_config = {
69
- "chunk_size": 500,
70
- "chunk_overlap": 50,
71
- "distance_metric": "cosine",
72
- "k_similar": 3
73
- }
74
  self.course_defaults = {
75
- "max_modules": 5,
76
- "sections_per_module": 4,
77
- "questions_per_quiz": 3
78
  }
79
 
80
 
@@ -141,8 +131,8 @@ class CourseBuilder:
141
  temperature=self.config.llm_config["temperature"],
142
  max_tokens=self.config.llm_config["max_tokens"])
143
 
144
- # Example OpenAI Embeddings usage (if needed)
145
- self.embeddings = OpenAIEmbeddings(self.api_key)
146
 
147
  # Example FAISS initialization for vector store (if needed)
148
  self.vector_store = faiss.IndexFlatL2(128)
@@ -241,7 +231,6 @@ class LearningPlatform:
241
  async def create_course(self, topic: str, difficulty: str) -> LearningPath:
242
  try:
243
  state = CourseState(topic=topic, difficulty=difficulty)
244
- # Corrected to use 'arun'
245
  result = await self.course_builder.graph.arun(
246
  state,
247
  config={"recursion_limit": self.config.graph_config["recursion_limit"]}
 
5
  from typing import List, Dict, Any, Literal
6
 
7
  import faiss # Example for vector store
 
8
  from langchain.chat_models import ChatOpenAI
9
  from langchain.embeddings import OpenAIEmbeddings # Example for embeddings
10
+ from langgraph.graph import StateGraph, END
 
11
 
12
 
13
  @dataclass
 
63
  "max_retries": 3,
64
  "timeout": 300
65
  }
 
 
 
 
 
 
66
  self.course_defaults = {
67
+ "max_modules": 5
 
 
68
  }
69
 
70
 
 
131
  temperature=self.config.llm_config["temperature"],
132
  max_tokens=self.config.llm_config["max_tokens"])
133
 
134
+ # Corrected instantiation of OpenAIEmbeddings
135
+ self.embeddings = OpenAIEmbeddings(openai_api_key=self.api_key)
136
 
137
  # Example FAISS initialization for vector store (if needed)
138
  self.vector_store = faiss.IndexFlatL2(128)
 
231
  async def create_course(self, topic: str, difficulty: str) -> LearningPath:
232
  try:
233
  state = CourseState(topic=topic, difficulty=difficulty)
 
234
  result = await self.course_builder.graph.arun(
235
  state,
236
  config={"recursion_limit": self.config.graph_config["recursion_limit"]}