-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Educhain refactored #40
base: main
Are you sure you want to change the base?
Changes from all commits
c9aee31
cc236e5
3008f82
75f59ab
6237015
8539395
b35b7e2
2003577
f51e339
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"[](https://colab.research.google.com/drive/1i-K3mdWfyApCuUx7t_uSRTczZ-B4qpdI?usp=sharing)" | ||
"[](https://colab.research.google.com/drive/185Py9FXMLspaEqwmUAx0I1p-IeCa67zH?usp=sharing)" | ||
], | ||
"metadata": { | ||
"id": "ScXuwxJl9uTo" | ||
|
@@ -43,7 +43,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": { | ||
"base_uri": "https://localhost:8080/" | ||
|
@@ -89,17 +89,19 @@ | |
"metadata": { | ||
"id": "e5R2skFs6wCq" | ||
}, | ||
"execution_count": 2, | ||
"execution_count": null, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [ | ||
"from educhain import qna_engine\n", | ||
"from educhain import Educhain\n", | ||
"from langchain_openai import ChatOpenAI\n", | ||
"\n", | ||
"gpt_4o_mini = ChatOpenAI(model = \"gpt-4o-mini\")\n", | ||
"\n", | ||
"client = Educhain()\n", | ||
"\n", | ||
Comment on lines
+98
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update The import statement has been correctly updated to use Please update the client = Educhain()
-url_mcqs = qna_engine.generate_mcqs_from_data(
+url_mcqs = client.generate_mcqs_from_data(
source="https://en.wikipedia.org/wiki/Butterfly_effect",
source_type="url",
num=5,
llm = gpt_4o_mini
)
|
||
"url_mcqs = qna_engine.generate_mcqs_from_data(\n", | ||
" source=\"https://en.wikipedia.org/wiki/Butterfly_effect\",\n", | ||
" source_type=\"url\",\n", | ||
|
@@ -116,7 +118,7 @@ | |
"id": "-GIvZQuO6zKH", | ||
"outputId": "230790b6-50b9-4eb3-cb16-289024245d6a" | ||
}, | ||
"execution_count": 4, | ||
"execution_count": null, | ||
"outputs": [ | ||
{ | ||
"output_type": "stream", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,10 @@ Generate engaging MCQs from various data sources using AI! 🧠✨ | |
## 🚀 Basic Usage | ||
|
||
```python | ||
from educhain import generate_mcqs_from_data | ||
from educhain import Educhain | ||
|
||
questions = generate_mcqs_from_data( | ||
client = Educhain() | ||
questions = client.qna_engine.generate_questions_from_data( | ||
Comment on lines
+8
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update code snippet and align documentation with new API The code snippet has been updated to use the new
To address these points, please:
| Option | Description | Example Values |
|--------|-------------|----------------|
| `source` | Data source for question generation | PDF file path, URL, or text content |
| `source_type` | Type of the data source | "pdf", "url", "text" |
| `num` | Number of questions to generate | 5, 10, 20 |
| `learning_objective` | Goal of the questions | "Understand AI basics", "Apply ML concepts" |
| `difficulty_level` | Difficulty of the questions | "Beginner", "Intermediate", "Advanced" |
| `llm` | Custom language model (optional) | ChatOpenAI(model="gpt-4") |
| `prompt_template` | Custom prompt template (optional) | "Generate questions about {topic}..." |
|
||
source="https://en.wikipedia.org/wiki/Artificial_intelligence", | ||
source_type="url", | ||
num=5, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider making the model name configurable.
The code specifies a particular model ("gpt-4o-mini") for the
ChatOpenAI
instance. This might not be flexible for all users, and it's unclear if this is a publicly available model.Consider the following improvements:
Here's a suggested implementation: