├── llamacppembeddings-steramlit.gif
├── README.md
├── st-ChatLlamaCPP.py
└── llamacppEmbeddings+Model_chatWithDocs.ipynb
/llamacppembeddings-steramlit.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fabiomatricardi/llamacppChatDocs/main/llamacppembeddings-steramlit.gif
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # llamacppChatDocs
2 | Chat with your documents using only LlamaCPP and Langchain
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/st-ChatLlamaCPP.py:
--------------------------------------------------------------------------------
1 | import streamlit as st
2 | import datetime
3 | import os
4 | from io import StringIO
5 | from rich.markdown import Markdown
6 | import warnings
7 | warnings.filterwarnings(action='ignore')
8 | import datetime
9 | from rich.console import Console
10 | console = Console(width=90)
11 | import tiktoken
12 | from time import sleep
13 |
14 | encoding = tiktoken.get_encoding("r50k_base") #context_count = len(encoding.encode(yourtext))
15 |
16 | from langchain.text_splitter import TokenTextSplitter
17 | from langchain_community.document_loaders import TextLoader
18 | from langchain_community.vectorstores import FAISS
19 | from langchain_community.embeddings import LlamaCppEmbeddings
20 | from langchain_text_splitters import CharacterTextSplitter
21 | from llama_cpp import Llama
22 |
23 | st.set_page_config(layout="wide", page_title="LlamaCPP AIO chat with documents")
24 |
25 | @st.cache_resource
26 | def create_embeddings():
27 | # Set HF API token and HF repo
28 | from langchain_community.embeddings import LlamaCppEmbeddings
29 | embpath = "models/all-MiniLM-L6-v2.F16.gguf"
30 | embeddings = LlamaCppEmbeddings(model_path=embpath)
31 | print('loading all-MiniLM-L6-v2.F16.gguf with LlamaCPP...')
32 | return embeddings
33 |
34 | @st.cache_resource
35 | def create_chat():
36 | # Set HF API token and HF repo
37 | from llama_cpp import Llama
38 | qwen05b = Llama(
39 | model_path='models/qwen2-0_5b-instruct-q8_0.gguf',
40 | n_gpu_layers=0,
41 | temperature=0.1,
42 | top_p = 0.5,
43 | n_ctx=8192,
44 | max_tokens=600,
45 | repeat_penalty=1.7,
46 | stop=["<|im_end|>","Instruction:","### Instruction:","###
⡀⠀ Qwen-0.5b-Chat AI is working ✅✅✅ ...\n\n"
43 | },
44 | "metadata": {}
45 | }
46 | ]
47 | }
48 | },
49 | "b02f5d0c391644d6a7534066f8cc1193": {
50 | "model_module": "@jupyter-widgets/base",
51 | "model_name": "LayoutModel",
52 | "model_module_version": "1.2.0",
53 | "state": {
54 | "_model_module": "@jupyter-widgets/base",
55 | "_model_module_version": "1.2.0",
56 | "_model_name": "LayoutModel",
57 | "_view_count": null,
58 | "_view_module": "@jupyter-widgets/base",
59 | "_view_module_version": "1.2.0",
60 | "_view_name": "LayoutView",
61 | "align_content": null,
62 | "align_items": null,
63 | "align_self": null,
64 | "border": null,
65 | "bottom": null,
66 | "display": null,
67 | "flex": null,
68 | "flex_flow": null,
69 | "grid_area": null,
70 | "grid_auto_columns": null,
71 | "grid_auto_flow": null,
72 | "grid_auto_rows": null,
73 | "grid_column": null,
74 | "grid_gap": null,
75 | "grid_row": null,
76 | "grid_template_areas": null,
77 | "grid_template_columns": null,
78 | "grid_template_rows": null,
79 | "height": null,
80 | "justify_content": null,
81 | "justify_items": null,
82 | "left": null,
83 | "margin": null,
84 | "max_height": null,
85 | "max_width": null,
86 | "min_height": null,
87 | "min_width": null,
88 | "object_fit": null,
89 | "object_position": null,
90 | "order": null,
91 | "overflow": null,
92 | "overflow_x": null,
93 | "overflow_y": null,
94 | "padding": null,
95 | "right": null,
96 | "top": null,
97 | "visibility": null,
98 | "width": null
99 | }
100 | },
101 | "4aa3082ec7ec4df6a5c3313b81887cfa": {
102 | "model_module": "@jupyter-widgets/output",
103 | "model_name": "OutputModel",
104 | "model_module_version": "1.0.0",
105 | "state": {
106 | "_dom_classes": [],
107 | "_model_module": "@jupyter-widgets/output",
108 | "_model_module_version": "1.0.0",
109 | "_model_name": "OutputModel",
110 | "_view_count": null,
111 | "_view_module": "@jupyter-widgets/output",
112 | "_view_module_version": "1.0.0",
113 | "_view_name": "OutputView",
114 | "layout": "IPY_MODEL_6d6b2f1584db4acab1bd785342acfad8",
115 | "msg_id": "",
116 | "outputs": [
117 | {
118 | "output_type": "display_data",
119 | "data": {
120 | "text/plain": "\u001b[32m⢋⠀\u001b[0m Qwen-0.5b-Chat AI is working ✅✅✅ ...\n",
121 | "text/html": "⢋⠀ Qwen-0.5b-Chat AI is working ✅✅✅ ...\n\n"
122 | },
123 | "metadata": {}
124 | }
125 | ]
126 | }
127 | },
128 | "6d6b2f1584db4acab1bd785342acfad8": {
129 | "model_module": "@jupyter-widgets/base",
130 | "model_name": "LayoutModel",
131 | "model_module_version": "1.2.0",
132 | "state": {
133 | "_model_module": "@jupyter-widgets/base",
134 | "_model_module_version": "1.2.0",
135 | "_model_name": "LayoutModel",
136 | "_view_count": null,
137 | "_view_module": "@jupyter-widgets/base",
138 | "_view_module_version": "1.2.0",
139 | "_view_name": "LayoutView",
140 | "align_content": null,
141 | "align_items": null,
142 | "align_self": null,
143 | "border": null,
144 | "bottom": null,
145 | "display": null,
146 | "flex": null,
147 | "flex_flow": null,
148 | "grid_area": null,
149 | "grid_auto_columns": null,
150 | "grid_auto_flow": null,
151 | "grid_auto_rows": null,
152 | "grid_column": null,
153 | "grid_gap": null,
154 | "grid_row": null,
155 | "grid_template_areas": null,
156 | "grid_template_columns": null,
157 | "grid_template_rows": null,
158 | "height": null,
159 | "justify_content": null,
160 | "justify_items": null,
161 | "left": null,
162 | "margin": null,
163 | "max_height": null,
164 | "max_width": null,
165 | "min_height": null,
166 | "min_width": null,
167 | "object_fit": null,
168 | "object_position": null,
169 | "order": null,
170 | "overflow": null,
171 | "overflow_x": null,
172 | "overflow_y": null,
173 | "padding": null,
174 | "right": null,
175 | "top": null,
176 | "visibility": null,
177 | "width": null
178 | }
179 | },
180 | "f91344233fd3435ab1359dfeb2b5143a": {
181 | "model_module": "@jupyter-widgets/output",
182 | "model_name": "OutputModel",
183 | "model_module_version": "1.0.0",
184 | "state": {
185 | "_dom_classes": [],
186 | "_model_module": "@jupyter-widgets/output",
187 | "_model_module_version": "1.0.0",
188 | "_model_name": "OutputModel",
189 | "_view_count": null,
190 | "_view_module": "@jupyter-widgets/output",
191 | "_view_module_version": "1.0.0",
192 | "_view_name": "OutputView",
193 | "layout": "IPY_MODEL_669b6315922b402391e7c519c22307f2",
194 | "msg_id": "",
195 | "outputs": [
196 | {
197 | "output_type": "display_data",
198 | "data": {
199 | "text/plain": "\u001b[32m⠀⡀\u001b[0m Qwen-0.5b-Chat AI is working ✅✅✅ ...\n",
200 | "text/html": "⠀⡀ Qwen-0.5b-Chat AI is working ✅✅✅ ...\n\n"
201 | },
202 | "metadata": {}
203 | }
204 | ]
205 | }
206 | },
207 | "669b6315922b402391e7c519c22307f2": {
208 | "model_module": "@jupyter-widgets/base",
209 | "model_name": "LayoutModel",
210 | "model_module_version": "1.2.0",
211 | "state": {
212 | "_model_module": "@jupyter-widgets/base",
213 | "_model_module_version": "1.2.0",
214 | "_model_name": "LayoutModel",
215 | "_view_count": null,
216 | "_view_module": "@jupyter-widgets/base",
217 | "_view_module_version": "1.2.0",
218 | "_view_name": "LayoutView",
219 | "align_content": null,
220 | "align_items": null,
221 | "align_self": null,
222 | "border": null,
223 | "bottom": null,
224 | "display": null,
225 | "flex": null,
226 | "flex_flow": null,
227 | "grid_area": null,
228 | "grid_auto_columns": null,
229 | "grid_auto_flow": null,
230 | "grid_auto_rows": null,
231 | "grid_column": null,
232 | "grid_gap": null,
233 | "grid_row": null,
234 | "grid_template_areas": null,
235 | "grid_template_columns": null,
236 | "grid_template_rows": null,
237 | "height": null,
238 | "justify_content": null,
239 | "justify_items": null,
240 | "left": null,
241 | "margin": null,
242 | "max_height": null,
243 | "max_width": null,
244 | "min_height": null,
245 | "min_width": null,
246 | "object_fit": null,
247 | "object_position": null,
248 | "order": null,
249 | "overflow": null,
250 | "overflow_x": null,
251 | "overflow_y": null,
252 | "padding": null,
253 | "right": null,
254 | "top": null,
255 | "visibility": null,
256 | "width": null
257 | }
258 | }
259 | }
260 | }
261 | },
262 | "cells": [
263 | {
264 | "cell_type": "markdown",
265 | "metadata": {
266 | "id": "view-in-github",
267 | "colab_type": "text"
268 | },
269 | "source": [
270 | "
"
277 | ],
278 | "metadata": {
279 | "id": "gAD4TQB2qMlM"
280 | }
281 | },
282 | {
283 | "cell_type": "code",
284 | "execution_count": 1,
285 | "metadata": {
286 | "colab": {
287 | "base_uri": "https://localhost:8080/"
288 | },
289 | "id": "ckiOgraRmhLI",
290 | "outputId": "08418664-1e4e-47c2-a66a-232697bb428c"
291 | },
292 | "outputs": [
293 | {
294 | "output_type": "stream",
295 | "name": "stdout",
296 | "text": [
297 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m4.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
298 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.5/3.5 MB\u001b[0m \u001b[31m35.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
299 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m974.0/974.0 kB\u001b[0m \u001b[31m51.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
300 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.2/2.2 MB\u001b[0m \u001b[31m68.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
301 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m50.2/50.2 MB\u001b[0m \u001b[31m14.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
302 | "\u001b[?25h Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
303 | " Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
304 | " Installing backend dependencies ... \u001b[?25l\u001b[?25hdone\n",
305 | " Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
306 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m27.0/27.0 MB\u001b[0m \u001b[31m26.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
307 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m15.8/15.8 MB\u001b[0m \u001b[31m55.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
308 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m314.7/314.7 kB\u001b[0m \u001b[31m29.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
309 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m124.9/124.9 kB\u001b[0m \u001b[31m12.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
310 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m45.5/45.5 kB\u001b[0m \u001b[31m5.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
311 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.2/49.2 kB\u001b[0m \u001b[31m5.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
312 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m53.0/53.0 kB\u001b[0m \u001b[31m5.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
313 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m142.7/142.7 kB\u001b[0m \u001b[31m14.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
314 | "\u001b[?25h Building wheel for llama-cpp-python (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n"
315 | ]
316 | }
317 | ],
318 | "source": [
319 | "%pip install --upgrade --quiet rich tiktoken PyMuPDF langchain langchain-community llama-cpp-python faiss-cpu"
320 | ]
321 | },
322 | {
323 | "cell_type": "code",
324 | "source": [
325 | "!wget https://huggingface.co/leliuga/all-MiniLM-L6-v2-GGUF/resolve/main/all-MiniLM-L6-v2.F16.gguf\n",
326 | "!wget https://huggingface.co/Qwen/Qwen2-0.5B-Instruct-GGUF/resolve/main/qwen2-0_5b-instruct-q8_0.gguf\n",
327 | "!wget https://github.com/fabiomatricardi/How-I-Built-a-Chatbot-that-Crushed-ChatGPT/raw/main/What%20is%20Entrepreneurship%205%20Factors%20Affecting%20Ent.txt\n",
328 | "!wget https://huggingface.co/gaianet/Nomic-embed-text-v1.5-Embedding-GGUF/resolve/main/nomic-embed-text-v1.5.f16.gguf"
329 | ],
330 | "metadata": {
331 | "id": "KJqaHZUBfLyL",
332 | "colab": {
333 | "base_uri": "https://localhost:8080/"
334 | },
335 | "outputId": "3cc9f2d1-9945-4cc7-a6d5-42775945c8b5"
336 | },
337 | "execution_count": 2,
338 | "outputs": [
339 | {
340 | "output_type": "stream",
341 | "name": "stdout",
342 | "text": [
343 | "--2024-06-11 19:17:34-- https://huggingface.co/leliuga/all-MiniLM-L6-v2-GGUF/resolve/main/all-MiniLM-L6-v2.F16.gguf\n",
344 | "Resolving huggingface.co (huggingface.co)... 18.172.134.124, 18.172.134.88, 18.172.134.4, ...\n",
345 | "Connecting to huggingface.co (huggingface.co)|18.172.134.124|:443... connected.\n",
346 | "HTTP request sent, awaiting response... 302 Found\n",
347 | "Location: https://cdn-lfs-us-1.huggingface.co/repos/68/86/688665eb5b2019706f226f4e2a0cb26c8f210c781549d129dc7f26d630ac2863/797b70c4edf85907fe0a49eb85811256f65fa0f7bf52166b147fd16be2be4662?response-content-disposition=inline%3B+filename*%3DUTF-8%27%27all-MiniLM-L6-v2.F16.gguf%3B+filename%3D%22all-MiniLM-L6-v2.F16.gguf%22%3B&Expires=1718392654&Policy=eyJTdGF0ZW1lbnQiOlt7IkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTcxODM5MjY1NH19LCJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLWxmcy11cy0xLmh1Z2dpbmdmYWNlLmNvL3JlcG9zLzY4Lzg2LzY4ODY2NWViNWIyMDE5NzA2ZjIyNmY0ZTJhMGNiMjZjOGYyMTBjNzgxNTQ5ZDEyOWRjN2YyNmQ2MzBhYzI4NjMvNzk3YjcwYzRlZGY4NTkwN2ZlMGE0OWViODU4MTEyNTZmNjVmYTBmN2JmNTIxNjZiMTQ3ZmQxNmJlMmJlNDY2Mj9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoifV19&Signature=RdI4Ji%7Eqx5MiJ1WTFXKDlFTGjXP5nblrtvMz9kYAlWnp7yE3mtXaBkNkOMhOWdTQdvz8SL7fAaJunpV3Z33%7EkuEo4a6z07PdYapxNMuZdeZeuvRUki9qKaaDKRQMC29vdTIUbkq0%7E8f-6e6jOYM1tQ0wjtoR%7ENU%7EBnqaBtViCVzXTtP6C-d23m8NmJ85Q2cOrGnTF7O1nwqHsLlq3f-XYB7vjHhYWXptEkAfUNfLV4AbLZm2yRt7YUCKHSLqLI8dDV7WEyIFOzDOiZOhy0a8EJbftKpQTFSoIz4EPuUOKPVCb9P4h6EGpKxxvxFJAcfQ8TzGuqCcNMEs%7EQCOiNeloA__&Key-Pair-Id=KCD77M1F0VK2B [following]\n",
348 | "--2024-06-11 19:17:34-- https://cdn-lfs-us-1.huggingface.co/repos/68/86/688665eb5b2019706f226f4e2a0cb26c8f210c781549d129dc7f26d630ac2863/797b70c4edf85907fe0a49eb85811256f65fa0f7bf52166b147fd16be2be4662?response-content-disposition=inline%3B+filename*%3DUTF-8%27%27all-MiniLM-L6-v2.F16.gguf%3B+filename%3D%22all-MiniLM-L6-v2.F16.gguf%22%3B&Expires=1718392654&Policy=eyJTdGF0ZW1lbnQiOlt7IkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTcxODM5MjY1NH19LCJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLWxmcy11cy0xLmh1Z2dpbmdmYWNlLmNvL3JlcG9zLzY4Lzg2LzY4ODY2NWViNWIyMDE5NzA2ZjIyNmY0ZTJhMGNiMjZjOGYyMTBjNzgxNTQ5ZDEyOWRjN2YyNmQ2MzBhYzI4NjMvNzk3YjcwYzRlZGY4NTkwN2ZlMGE0OWViODU4MTEyNTZmNjVmYTBmN2JmNTIxNjZiMTQ3ZmQxNmJlMmJlNDY2Mj9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoifV19&Signature=RdI4Ji%7Eqx5MiJ1WTFXKDlFTGjXP5nblrtvMz9kYAlWnp7yE3mtXaBkNkOMhOWdTQdvz8SL7fAaJunpV3Z33%7EkuEo4a6z07PdYapxNMuZdeZeuvRUki9qKaaDKRQMC29vdTIUbkq0%7E8f-6e6jOYM1tQ0wjtoR%7ENU%7EBnqaBtViCVzXTtP6C-d23m8NmJ85Q2cOrGnTF7O1nwqHsLlq3f-XYB7vjHhYWXptEkAfUNfLV4AbLZm2yRt7YUCKHSLqLI8dDV7WEyIFOzDOiZOhy0a8EJbftKpQTFSoIz4EPuUOKPVCb9P4h6EGpKxxvxFJAcfQ8TzGuqCcNMEs%7EQCOiNeloA__&Key-Pair-Id=KCD77M1F0VK2B\n",
349 | "Resolving cdn-lfs-us-1.huggingface.co (cdn-lfs-us-1.huggingface.co)... 108.156.107.44, 108.156.107.80, 108.156.107.49, ...\n",
350 | "Connecting to cdn-lfs-us-1.huggingface.co (cdn-lfs-us-1.huggingface.co)|108.156.107.44|:443... connected.\n",
351 | "HTTP request sent, awaiting response... 200 OK\n",
352 | "Length: 45949216 (44M) [application/octet-stream]\n",
353 | "Saving to: ‘all-MiniLM-L6-v2.F16.gguf’\n",
354 | "\n",
355 | "all-MiniLM-L6-v2.F1 100%[===================>] 43.82M 129MB/s in 0.3s \n",
356 | "\n",
357 | "2024-06-11 19:17:35 (129 MB/s) - ‘all-MiniLM-L6-v2.F16.gguf’ saved [45949216/45949216]\n",
358 | "\n",
359 | "--2024-06-11 19:17:35-- https://huggingface.co/Qwen/Qwen2-0.5B-Instruct-GGUF/resolve/main/qwen2-0_5b-instruct-q8_0.gguf\n",
360 | "Resolving huggingface.co (huggingface.co)... 18.172.134.124, 18.172.134.88, 18.172.134.4, ...\n",
361 | "Connecting to huggingface.co (huggingface.co)|18.172.134.124|:443... connected.\n",
362 | "HTTP request sent, awaiting response... 302 Found\n",
363 | "Location: https://cdn-lfs-us-1.huggingface.co/repos/de/a7/dea7cb7dd91181a6289326a9659bea3ef76442ab6822ba741994f21ad9825f70/703ba70a4459d597ad855837362e6364ae10be4aefd0e01496df2022575550b2?response-content-disposition=inline%3B+filename*%3DUTF-8%27%27qwen2-0_5b-instruct-q8_0.gguf%3B+filename%3D%22qwen2-0_5b-instruct-q8_0.gguf%22%3B&Expires=1718392655&Policy=eyJTdGF0ZW1lbnQiOlt7IkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTcxODM5MjY1NX19LCJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLWxmcy11cy0xLmh1Z2dpbmdmYWNlLmNvL3JlcG9zL2RlL2E3L2RlYTdjYjdkZDkxMTgxYTYyODkzMjZhOTY1OWJlYTNlZjc2NDQyYWI2ODIyYmE3NDE5OTRmMjFhZDk4MjVmNzAvNzAzYmE3MGE0NDU5ZDU5N2FkODU1ODM3MzYyZTYzNjRhZTEwYmU0YWVmZDBlMDE0OTZkZjIwMjI1NzU1NTBiMj9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoifV19&Signature=OoWnw%7Ee5mOS6AGVMXBVVHylCFtDy3MnLJ-W5BSypktcBF3IH%7E8KxeFkFO%7E24VgJncYDIKDEmbg0xvIHCQ7cJgxBIwKqj%7E1GcCTfS95964d0K52Bwqucm0bBBtM75drqQRARTctKjfTaA6a7jUknh72MabJWKpru9TMzCCjwx-1%7EoFrWkBKQqvTQHPRneCGmjiX8m2imvJX%7EVK-vd3puxuv-lmHkErbooi7zQQWMrKI7KycX2JkQZ1Zj%7EGU9NP-tKcdDKFkdAX2rSYf8WpAiRio8A7KfFssrft63y-IzuujIkinwcAUNnaQg%7EnP3U0Zvpv5QcTi253nDrQC%7EvlkKHcQ__&Key-Pair-Id=KCD77M1F0VK2B [following]\n",
364 | "--2024-06-11 19:17:35-- https://cdn-lfs-us-1.huggingface.co/repos/de/a7/dea7cb7dd91181a6289326a9659bea3ef76442ab6822ba741994f21ad9825f70/703ba70a4459d597ad855837362e6364ae10be4aefd0e01496df2022575550b2?response-content-disposition=inline%3B+filename*%3DUTF-8%27%27qwen2-0_5b-instruct-q8_0.gguf%3B+filename%3D%22qwen2-0_5b-instruct-q8_0.gguf%22%3B&Expires=1718392655&Policy=eyJTdGF0ZW1lbnQiOlt7IkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTcxODM5MjY1NX19LCJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLWxmcy11cy0xLmh1Z2dpbmdmYWNlLmNvL3JlcG9zL2RlL2E3L2RlYTdjYjdkZDkxMTgxYTYyODkzMjZhOTY1OWJlYTNlZjc2NDQyYWI2ODIyYmE3NDE5OTRmMjFhZDk4MjVmNzAvNzAzYmE3MGE0NDU5ZDU5N2FkODU1ODM3MzYyZTYzNjRhZTEwYmU0YWVmZDBlMDE0OTZkZjIwMjI1NzU1NTBiMj9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoifV19&Signature=OoWnw%7Ee5mOS6AGVMXBVVHylCFtDy3MnLJ-W5BSypktcBF3IH%7E8KxeFkFO%7E24VgJncYDIKDEmbg0xvIHCQ7cJgxBIwKqj%7E1GcCTfS95964d0K52Bwqucm0bBBtM75drqQRARTctKjfTaA6a7jUknh72MabJWKpru9TMzCCjwx-1%7EoFrWkBKQqvTQHPRneCGmjiX8m2imvJX%7EVK-vd3puxuv-lmHkErbooi7zQQWMrKI7KycX2JkQZ1Zj%7EGU9NP-tKcdDKFkdAX2rSYf8WpAiRio8A7KfFssrft63y-IzuujIkinwcAUNnaQg%7EnP3U0Zvpv5QcTi253nDrQC%7EvlkKHcQ__&Key-Pair-Id=KCD77M1F0VK2B\n",
365 | "Resolving cdn-lfs-us-1.huggingface.co (cdn-lfs-us-1.huggingface.co)... 108.156.107.44, 108.156.107.80, 108.156.107.49, ...\n",
366 | "Connecting to cdn-lfs-us-1.huggingface.co (cdn-lfs-us-1.huggingface.co)|108.156.107.44|:443... connected.\n",
367 | "HTTP request sent, awaiting response... 200 OK\n",
368 | "Length: 675708384 (644M) [application/octet-stream]\n",
369 | "Saving to: ‘qwen2-0_5b-instruct-q8_0.gguf’\n",
370 | "\n",
371 | "qwen2-0_5b-instruct 100%[===================>] 644.41M 169MB/s in 3.8s \n",
372 | "\n",
373 | "2024-06-11 19:17:39 (168 MB/s) - ‘qwen2-0_5b-instruct-q8_0.gguf’ saved [675708384/675708384]\n",
374 | "\n",
375 | "--2024-06-11 19:17:39-- https://github.com/fabiomatricardi/How-I-Built-a-Chatbot-that-Crushed-ChatGPT/raw/main/What%20is%20Entrepreneurship%205%20Factors%20Affecting%20Ent.txt\n",
376 | "Resolving github.com (github.com)... 140.82.112.3\n",
377 | "Connecting to github.com (github.com)|140.82.112.3|:443... connected.\n",
378 | "HTTP request sent, awaiting response... 302 Found\n",
379 | "Location: https://raw.githubusercontent.com/fabiomatricardi/How-I-Built-a-Chatbot-that-Crushed-ChatGPT/main/What%20is%20Entrepreneurship%205%20Factors%20Affecting%20Ent.txt [following]\n",
380 | "--2024-06-11 19:17:39-- https://raw.githubusercontent.com/fabiomatricardi/How-I-Built-a-Chatbot-that-Crushed-ChatGPT/main/What%20is%20Entrepreneurship%205%20Factors%20Affecting%20Ent.txt\n",
381 | "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.108.133, ...\n",
382 | "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.\n",
383 | "HTTP request sent, awaiting response... 200 OK\n",
384 | "Length: 17389 (17K) [text/plain]\n",
385 | "Saving to: ‘What is Entrepreneurship 5 Factors Affecting Ent.txt’\n",
386 | "\n",
387 | "What is Entrepreneu 100%[===================>] 16.98K --.-KB/s in 0s \n",
388 | "\n",
389 | "2024-06-11 19:17:39 (38.5 MB/s) - ‘What is Entrepreneurship 5 Factors Affecting Ent.txt’ saved [17389/17389]\n",
390 | "\n",
391 | "--2024-06-11 19:17:39-- https://huggingface.co/gaianet/Nomic-embed-text-v1.5-Embedding-GGUF/resolve/main/nomic-embed-text-v1.5.f16.gguf\n",
392 | "Resolving huggingface.co (huggingface.co)... 18.172.134.124, 18.172.134.88, 18.172.134.4, ...\n",
393 | "Connecting to huggingface.co (huggingface.co)|18.172.134.124|:443... connected.\n",
394 | "HTTP request sent, awaiting response... 302 Found\n",
395 | "Location: https://cdn-lfs-us-1.huggingface.co/repos/90/cb/90cba57d8aa1ec193c28f257b79bb0760ea9684dbc05fc877d58c3959c19fa04/f7af6f66802f4df86eda10fe9bbcfc75c39562bed48ef6ace719a251cf1c2fdb?response-content-disposition=inline%3B+filename*%3DUTF-8%27%27nomic-embed-text-v1.5.f16.gguf%3B+filename%3D%22nomic-embed-text-v1.5.f16.gguf%22%3B&Expires=1718392659&Policy=eyJTdGF0ZW1lbnQiOlt7IkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTcxODM5MjY1OX19LCJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLWxmcy11cy0xLmh1Z2dpbmdmYWNlLmNvL3JlcG9zLzkwL2NiLzkwY2JhNTdkOGFhMWVjMTkzYzI4ZjI1N2I3OWJiMDc2MGVhOTY4NGRiYzA1ZmM4NzdkNThjMzk1OWMxOWZhMDQvZjdhZjZmNjY4MDJmNGRmODZlZGExMGZlOWJiY2ZjNzVjMzk1NjJiZWQ0OGVmNmFjZTcxOWEyNTFjZjFjMmZkYj9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoifV19&Signature=fvvQgwK5lz7rVGbSBMPBeqp6WUv7YpCp7cBHLivBPqXGaC8BU69oT2Yf%7EUc4q%7Ee6CDEl-X19hXrwCEnLFs0NE0-0xR-xBASUdWqtrsNBo7g8qgDzdL77XlqeISjruiNO3zhPBv9LstLU%7EkPODT96dwIk-XzakQWyaF1Q6nBfHiPzhZsnvlmFb7SuPI5vC4WePQKrm1yB%7EmLcxf-wYUGzlXtip6GtQJSLezOk%7Eav1lvfprHj36qDrFbb7DYNFI8hwwL6f3DuTUCXlQ6ewWC7wPFQHNmFrRm9JMoGbMyMEtAAOBWcG42E7-5g90YfJFPfe2SCo78biRwfgGmMvOzRGRA__&Key-Pair-Id=KCD77M1F0VK2B [following]\n",
396 | "--2024-06-11 19:17:39-- https://cdn-lfs-us-1.huggingface.co/repos/90/cb/90cba57d8aa1ec193c28f257b79bb0760ea9684dbc05fc877d58c3959c19fa04/f7af6f66802f4df86eda10fe9bbcfc75c39562bed48ef6ace719a251cf1c2fdb?response-content-disposition=inline%3B+filename*%3DUTF-8%27%27nomic-embed-text-v1.5.f16.gguf%3B+filename%3D%22nomic-embed-text-v1.5.f16.gguf%22%3B&Expires=1718392659&Policy=eyJTdGF0ZW1lbnQiOlt7IkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTcxODM5MjY1OX19LCJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLWxmcy11cy0xLmh1Z2dpbmdmYWNlLmNvL3JlcG9zLzkwL2NiLzkwY2JhNTdkOGFhMWVjMTkzYzI4ZjI1N2I3OWJiMDc2MGVhOTY4NGRiYzA1ZmM4NzdkNThjMzk1OWMxOWZhMDQvZjdhZjZmNjY4MDJmNGRmODZlZGExMGZlOWJiY2ZjNzVjMzk1NjJiZWQ0OGVmNmFjZTcxOWEyNTFjZjFjMmZkYj9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoifV19&Signature=fvvQgwK5lz7rVGbSBMPBeqp6WUv7YpCp7cBHLivBPqXGaC8BU69oT2Yf%7EUc4q%7Ee6CDEl-X19hXrwCEnLFs0NE0-0xR-xBASUdWqtrsNBo7g8qgDzdL77XlqeISjruiNO3zhPBv9LstLU%7EkPODT96dwIk-XzakQWyaF1Q6nBfHiPzhZsnvlmFb7SuPI5vC4WePQKrm1yB%7EmLcxf-wYUGzlXtip6GtQJSLezOk%7Eav1lvfprHj36qDrFbb7DYNFI8hwwL6f3DuTUCXlQ6ewWC7wPFQHNmFrRm9JMoGbMyMEtAAOBWcG42E7-5g90YfJFPfe2SCo78biRwfgGmMvOzRGRA__&Key-Pair-Id=KCD77M1F0VK2B\n",
397 | "Resolving cdn-lfs-us-1.huggingface.co (cdn-lfs-us-1.huggingface.co)... 108.156.107.44, 108.156.107.80, 108.156.107.49, ...\n",
398 | "Connecting to cdn-lfs-us-1.huggingface.co (cdn-lfs-us-1.huggingface.co)|108.156.107.44|:443... connected.\n",
399 | "HTTP request sent, awaiting response... 200 OK\n",
400 | "Length: 274290560 (262M) [binary/octet-stream]\n",
401 | "Saving to: ‘nomic-embed-text-v1.5.f16.gguf’\n",
402 | "\n",
403 | "nomic-embed-text-v1 100%[===================>] 261.58M 143MB/s in 1.8s \n",
404 | "\n",
405 | "2024-06-11 19:17:41 (143 MB/s) - ‘nomic-embed-text-v1.5.f16.gguf’ saved [274290560/274290560]\n",
406 | "\n"
407 | ]
408 | }
409 | ]
410 | },
411 | {
412 | "cell_type": "markdown",
413 | "source": [
414 | "directly from https://python.langchain.com/v0.2/docs/how_to/vectorstore_retriever/"
415 | ],
416 | "metadata": {
417 | "id": "fyrzggo6uTbi"
418 | }
419 | },
420 | {
421 | "cell_type": "code",
422 | "source": [
423 | "from rich.markdown import Markdown\n",
424 | "import warnings\n",
425 | "warnings.filterwarnings(action='ignore')\n",
426 | "import datetime\n",
427 | "from rich.console import Console\n",
428 | "console = Console(width=90)\n",
429 | "import tiktoken\n",
430 | "from time import sleep\n",
431 | "encoding = tiktoken.get_encoding(\"r50k_base\") #context_count = len(encoding.encode(yourtext))\n",
432 | "\n",
433 | "from langchain.text_splitter import TokenTextSplitter\n",
434 | "from langchain_community.document_loaders import TextLoader\n",
435 | "from langchain_community.vectorstores import FAISS\n",
436 | "from langchain_community.embeddings import LlamaCppEmbeddings\n",
437 | "from llama_cpp import Llama\n",
438 | "from langchain_text_splitters import CharacterTextSplitter"
439 | ],
440 | "metadata": {
441 | "id": "51Km9wcTuuPq"
442 | },
443 | "execution_count": 3,
444 | "outputs": []
445 | },
446 | {
447 | "cell_type": "code",
448 | "source": [
449 | "embpath = \"/content/all-MiniLM-L6-v2.F16.gguf\"\n",
450 | "embeddings = LlamaCppEmbeddings(model_path=embpath)"
451 | ],
452 | "metadata": {
453 | "id": "hsrDphBNuTLy",
454 | "colab": {
455 | "base_uri": "https://localhost:8080/"
456 | },
457 | "outputId": "c1c6619c-fc90-4398-a948-abfd011ba239"
458 | },
459 | "execution_count": 4,
460 | "outputs": [
461 | {
462 | "output_type": "stream",
463 | "name": "stderr",
464 | "text": [
465 | "llama_model_loader: loaded meta data with 23 key-value pairs and 101 tensors from /content/all-MiniLM-L6-v2.F16.gguf (version GGUF V3 (latest))\n",
466 | "llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.\n",
467 | "llama_model_loader: - kv 0: general.architecture str = bert\n",
468 | "llama_model_loader: - kv 1: general.name str = all-MiniLM-L6-v2\n",
469 | "llama_model_loader: - kv 2: bert.block_count u32 = 6\n",
470 | "llama_model_loader: - kv 3: bert.context_length u32 = 512\n",
471 | "llama_model_loader: - kv 4: bert.embedding_length u32 = 384\n",
472 | "llama_model_loader: - kv 5: bert.feed_forward_length u32 = 1536\n",
473 | "llama_model_loader: - kv 6: bert.attention.head_count u32 = 12\n",
474 | "llama_model_loader: - kv 7: bert.attention.layer_norm_epsilon f32 = 0.000000\n",
475 | "llama_model_loader: - kv 8: general.file_type u32 = 1\n",
476 | "llama_model_loader: - kv 9: bert.attention.causal bool = false\n",
477 | "llama_model_loader: - kv 10: bert.pooling_type u32 = 1\n",
478 | "llama_model_loader: - kv 11: tokenizer.ggml.token_type_count u32 = 2\n",
479 | "llama_model_loader: - kv 12: tokenizer.ggml.bos_token_id u32 = 101\n",
480 | "llama_model_loader: - kv 13: tokenizer.ggml.eos_token_id u32 = 102\n",
481 | "llama_model_loader: - kv 14: tokenizer.ggml.model str = bert\n",
482 | "llama_model_loader: - kv 15: tokenizer.ggml.tokens arr[str,30522] = [\"[PAD]\", \"[unused0]\", \"[unused1]\", \"...\n",
483 | "llama_model_loader: - kv 16: tokenizer.ggml.scores arr[f32,30522] = [-1000.000000, -1000.000000, -1000.00...\n",
484 | "llama_model_loader: - kv 17: tokenizer.ggml.token_type arr[i32,30522] = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...\n",
485 | "llama_model_loader: - kv 18: tokenizer.ggml.unknown_token_id u32 = 100\n",
486 | "llama_model_loader: - kv 19: tokenizer.ggml.seperator_token_id u32 = 102\n",
487 | "llama_model_loader: - kv 20: tokenizer.ggml.padding_token_id u32 = 0\n",
488 | "llama_model_loader: - kv 21: tokenizer.ggml.cls_token_id u32 = 101\n",
489 | "llama_model_loader: - kv 22: tokenizer.ggml.mask_token_id u32 = 103\n",
490 | "llama_model_loader: - type f32: 63 tensors\n",
491 | "llama_model_loader: - type f16: 38 tensors\n",
492 | "llm_load_vocab: special tokens cache size = 5\n",
493 | "llm_load_vocab: token to piece cache size = 0.2032 MB\n",
494 | "llm_load_print_meta: format = GGUF V3 (latest)\n",
495 | "llm_load_print_meta: arch = bert\n",
496 | "llm_load_print_meta: vocab type = WPM\n",
497 | "llm_load_print_meta: n_vocab = 30522\n",
498 | "llm_load_print_meta: n_merges = 0\n",
499 | "llm_load_print_meta: n_ctx_train = 512\n",
500 | "llm_load_print_meta: n_embd = 384\n",
501 | "llm_load_print_meta: n_head = 12\n",
502 | "llm_load_print_meta: n_head_kv = 12\n",
503 | "llm_load_print_meta: n_layer = 6\n",
504 | "llm_load_print_meta: n_rot = 32\n",
505 | "llm_load_print_meta: n_embd_head_k = 32\n",
506 | "llm_load_print_meta: n_embd_head_v = 32\n",
507 | "llm_load_print_meta: n_gqa = 1\n",
508 | "llm_load_print_meta: n_embd_k_gqa = 384\n",
509 | "llm_load_print_meta: n_embd_v_gqa = 384\n",
510 | "llm_load_print_meta: f_norm_eps = 1.0e-12\n",
511 | "llm_load_print_meta: f_norm_rms_eps = 0.0e+00\n",
512 | "llm_load_print_meta: f_clamp_kqv = 0.0e+00\n",
513 | "llm_load_print_meta: f_max_alibi_bias = 0.0e+00\n",
514 | "llm_load_print_meta: f_logit_scale = 0.0e+00\n",
515 | "llm_load_print_meta: n_ff = 1536\n",
516 | "llm_load_print_meta: n_expert = 0\n",
517 | "llm_load_print_meta: n_expert_used = 0\n",
518 | "llm_load_print_meta: causal attn = 0\n",
519 | "llm_load_print_meta: pooling type = 1\n",
520 | "llm_load_print_meta: rope type = 2\n",
521 | "llm_load_print_meta: rope scaling = linear\n",
522 | "llm_load_print_meta: freq_base_train = 10000.0\n",
523 | "llm_load_print_meta: freq_scale_train = 1\n",
524 | "llm_load_print_meta: n_ctx_orig_yarn = 512\n",
525 | "llm_load_print_meta: rope_finetuned = unknown\n",
526 | "llm_load_print_meta: ssm_d_conv = 0\n",
527 | "llm_load_print_meta: ssm_d_inner = 0\n",
528 | "llm_load_print_meta: ssm_d_state = 0\n",
529 | "llm_load_print_meta: ssm_dt_rank = 0\n",
530 | "llm_load_print_meta: model type = 22M\n",
531 | "llm_load_print_meta: model ftype = F16\n",
532 | "llm_load_print_meta: model params = 22.57 M\n",
533 | "llm_load_print_meta: model size = 43.10 MiB (16.02 BPW) \n",
534 | "llm_load_print_meta: general.name = all-MiniLM-L6-v2\n",
535 | "llm_load_print_meta: BOS token = 101 '[CLS]'\n",
536 | "llm_load_print_meta: EOS token = 102 '[SEP]'\n",
537 | "llm_load_print_meta: UNK token = 100 '[UNK]'\n",
538 | "llm_load_print_meta: SEP token = 102 '[SEP]'\n",
539 | "llm_load_print_meta: PAD token = 0 '[PAD]'\n",
540 | "llm_load_print_meta: CLS token = 101 '[CLS]'\n",
541 | "llm_load_print_meta: MASK token = 103 '[MASK]'\n",
542 | "llm_load_print_meta: LF token = 0 '[PAD]'\n",
543 | "llm_load_tensors: ggml ctx size = 0.05 MiB\n",
544 | "llm_load_tensors: CPU buffer size = 43.10 MiB\n",
545 | "...............................\n",
546 | "llama_new_context_with_model: n_ctx = 512\n",
547 | "llama_new_context_with_model: n_batch = 512\n",
548 | "llama_new_context_with_model: n_ubatch = 512\n",
549 | "llama_new_context_with_model: flash_attn = 0\n",
550 | "llama_new_context_with_model: freq_base = 10000.0\n",
551 | "llama_new_context_with_model: freq_scale = 1\n",
552 | "llama_kv_cache_init: CPU KV buffer size = 4.50 MiB\n",
553 | "llama_new_context_with_model: KV self size = 4.50 MiB, K (f16): 2.25 MiB, V (f16): 2.25 MiB\n",
554 | "llama_new_context_with_model: CPU output buffer size = 0.00 MiB\n",
555 | "llama_new_context_with_model: CPU compute buffer size = 17.00 MiB\n",
556 | "llama_new_context_with_model: graph nodes = 221\n",
557 | "llama_new_context_with_model: graph splits = 1\n",
558 | "AVX = 1 | AVX_VNNI = 0 | AVX2 = 1 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | AVX512_BF16 = 0 | FMA = 1 | NEON = 0 | SVE = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 0 | SSE3 = 1 | SSSE3 = 1 | VSX = 0 | MATMUL_INT8 = 0 | LLAMAFILE = 1 | \n",
559 | "Model metadata: {'tokenizer.ggml.mask_token_id': '103', 'tokenizer.ggml.padding_token_id': '0', 'tokenizer.ggml.seperator_token_id': '102', 'tokenizer.ggml.unknown_token_id': '100', 'tokenizer.ggml.model': 'bert', 'tokenizer.ggml.eos_token_id': '102', 'general.architecture': 'bert', 'bert.block_count': '6', 'bert.attention.layer_norm_epsilon': '0.000000', 'bert.context_length': '512', 'bert.feed_forward_length': '1536', 'bert.embedding_length': '384', 'tokenizer.ggml.cls_token_id': '101', 'tokenizer.ggml.token_type_count': '2', 'bert.attention.head_count': '12', 'tokenizer.ggml.bos_token_id': '101', 'general.file_type': '1', 'general.name': 'all-MiniLM-L6-v2', 'bert.attention.causal': 'false', 'bert.pooling_type': '1'}\n",
560 | "Using fallback chat format: llama-2\n"
561 | ]
562 | }
563 | ]
564 | },
565 | {
566 | "cell_type": "code",
567 | "source": [
568 | "from llama_cpp import Llama\n",
569 | "qwen05b = Llama(\n",
570 | " model_path='/content/qwen2-0_5b-instruct-q8_0.gguf',\n",
571 | " n_gpu_layers=0,\n",
572 | " temperature=0.1,\n",
573 | " top_p = 0.5,\n",
574 | " n_ctx=8192,\n",
575 | " max_tokens=600,\n",
576 | " repeat_penalty=1.7,\n",
577 | " stop=[\"<|im_end|>\",\"Instruction:\",\"### Instruction:\",\"###[\n", 707 | " Document(\n", 708 | " page_content=' success.\\nBy carefully considering these factors, entrepreneurs can\n", 709 | "increase their chances of navigating the challenges and maximizing the opportunities \n", 710 | "within the dynamic world of entrepreneurship.\\nVI. Step-by-step guide to get started with \n", 711 | "entrepreneurship\\nStep-by-step guide to get started with entrepreneurship\\nThe world of \n", 712 | "entrepreneurship beckons with the promise of innovation, independence, and the chance to \n", 713 | "make a real difference. If you’re brimming with an idea and ready to embark on this \n", 714 | "exciting path, here’s a roadmap to guide you through the initial stages:\\n1. Validate Your\n", 715 | "Idea\\nMarket Research: Don’t be afraid to get out there and talk to people! Conduct \n", 716 | "thorough market research to understand if there’s a',\n", 717 | " metadata={\n", 718 | " 'source': '/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\n", 719 | " }\n", 720 | " ),\n", 721 | " Document(\n", 722 | " page_content=' Practices and Examples\\n3. Secure Funding\\nBootstrapping: Many \n", 723 | "entrepreneurs start by bootstrapping their businesses using personal savings, loans from \n", 724 | "family and friends, or crowdfunding platforms.\\nSeeking Investors: For ventures requiring \n", 725 | "significant capital, exploring options like angel investors or venture capital firms might\n", 726 | "be necessary. Be prepared to present a compelling pitch that highlights the potential of \n", 727 | "your business.\\n4. Build Your Team\\nAssemble Your A-Team: Surround yourself with talented \n", 728 | "and passionate individuals who complement your skillset. Delegate tasks effectively and \n", 729 | "foster a collaborative environment where everyone feels valued and empowered to \n", 730 | "contribute.\\n5. Choose a Business Structure\\nSole Proprietorship, Partnership, LLC, or \n", 731 | "Corporation? The legal structure you choose for your',\n", 732 | " metadata={\n", 733 | " 'source': '/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\n", 734 | " }\n", 735 | " ),\n", 736 | " Document(\n", 737 | " page_content=' us. Here’s why entrepreneurship is so important:\\n1. Driving \n", 738 | "Economic Growth: Entrepreneurs are the lifeblood of economic dynamism. By starting new \n", 739 | "businesses, they create jobs, stimulate competition, and introduce innovative products and\n", 740 | "services. This fosters a healthy and growing economy for everyone.\\n2. Fostering \n", 741 | "Innovation: Entrepreneurs are constantly pushing boundaries and seeking solutions to \n", 742 | "problems. Their drive to create something new leads to breakthroughs in technology, \n", 743 | "business models, and social approaches. This continuous innovation keeps industries \n", 744 | "evolving and benefits society as a whole.\\n3. Job Creation: New businesses create new \n", 745 | "jobs. In fact, startups and small businesses are responsible for a significant portion of \n", 746 | "job growth in many economies. Entrepreneurship provides opportunities',\n", 747 | " metadata={\n", 748 | " 'source': '/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\n", 749 | " }\n", 750 | " )\n", 751 | "]\n", 752 | "\n" 753 | ] 754 | }, 755 | "metadata": {} 756 | } 757 | ] 758 | }, 759 | { 760 | "cell_type": "markdown", 761 | "source": [ 762 | "#### RESULTS With scores\n", 763 | "\n", 764 | "https://python.langchain.com/v0.2/docs/how_to/add_scores_retriever/\n", 765 | "\n", 766 | "https://python.langchain.com/v0.1/docs/integrations/vectorstores/faiss/" 767 | ], 768 | "metadata": { 769 | "id": "21m8OFTJwEP-" 770 | } 771 | }, 772 | { 773 | "cell_type": "code", 774 | "source": [ 775 | "docs_and_scores = vectorstore.similarity_search_with_score(\"what is Apple news?\",k=3) #or .similarity_search_with_relevance_scores()" 776 | ], 777 | "metadata": { 778 | "colab": { 779 | "base_uri": "https://localhost:8080/" 780 | }, 781 | "id": "YqEgg2JCuTCd", 782 | "outputId": "d4c47289-f669-4d4f-a5d1-79333a3f0ad6" 783 | }, 784 | "execution_count": null, 785 | "outputs": [ 786 | { 787 | "output_type": "stream", 788 | "name": "stderr", 789 | "text": [ 790 | "\n", 791 | "llama_print_timings: load time = 169.52 ms\n", 792 | "llama_print_timings: sample time = 0.00 ms / 1 runs ( 0.00 ms per token, inf tokens per second)\n", 793 | "llama_print_timings: prompt eval time = 15.07 ms / 7 tokens ( 2.15 ms per token, 464.56 tokens per second)\n", 794 | "llama_print_timings: eval time = 0.00 ms / 1 runs ( 0.00 ms per token, inf tokens per second)\n", 795 | "llama_print_timings: total time = 16.47 ms / 8 tokens\n" 796 | ] 797 | } 798 | ] 799 | }, 800 | { 801 | "cell_type": "code", 802 | "source": [ 803 | "console.print(docs_and_scores)" 804 | ], 805 | "metadata": { 806 | "colab": { 807 | "base_uri": "https://localhost:8080/", 808 | "height": 773 809 | }, 810 | "id": "Tpf6D4g1uS_9", 811 | "outputId": "0ffb88b7-5659-434c-fa58-4cc5da168090" 812 | }, 813 | "execution_count": null, 814 | "outputs": [ 815 | { 816 | "output_type": "display_data", 817 | "data": { 818 | "text/plain": [ 819 | "\u001b[1m[\u001b[0m\n", 820 | " \u001b[1m(\u001b[0m\n", 821 | " \u001b[1;35mDocument\u001b[0m\u001b[1m(\u001b[0m\n", 822 | " \u001b[33mpage_content\u001b[0m=\u001b[32m'Apple\\'s iOS App Store announces sweeping changes in the \u001b[0m\n", 823 | "\u001b[32mEU\\nhttps://www.axios.com/2024/01/25/apple-app-store-eu-changes\\nAuthor: Ashley Gold, \u001b[0m\n", 824 | "\u001b[32mauthor of\\xa0Axios Pro\\n\\n\\nApple will allow alternative app stores and other new options \u001b[0m\n", 825 | "\u001b[32mfor app developers in order to comply with Europe\\'s Digital Markets Act, the company said\u001b[0m\n", 826 | "\u001b[32mThursday.\\n\\nDriving the news: Europe\\'s major tech competition law, set to go into effect\u001b[0m\n", 827 | "\u001b[32mMarch 7, requires Apple to loosen its strict rules requiring developers to rely on the App\u001b[0m\n", 828 | "\u001b[32mStore for distribution and payment processing.\\n\\nApple has long resisted any changes to \u001b[0m\n", 829 | "\u001b[32mits App Store rules, citing security and privacy. The company also argues its services for\u001b[0m\n", 830 | "\u001b[32mdevelopers are best-in-class and ensure smooth user experiences free of spam or harmful \u001b[0m\n", 831 | "\u001b[32mcontent.\\n\\nWhy it matters: Apple is being forced to make sweeping changes to one of its \u001b[0m\n", 832 | "\u001b[32mflagship \"walled garden\" systems in what some smaller companies are seeing as a major \u001b[0m\n", 833 | "\u001b[32mwin.'\u001b[0m,\n", 834 | " \u001b[33mmetadata\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'source'\u001b[0m: \u001b[32m'/content/Article-edited.txt'\u001b[0m\u001b[1m}\u001b[0m\n", 835 | " \u001b[1m)\u001b[0m,\n", 836 | " \u001b[1;36m39.76284\u001b[0m\n", 837 | " \u001b[1m)\u001b[0m,\n", 838 | " \u001b[1m(\u001b[0m\n", 839 | " \u001b[1;35mDocument\u001b[0m\u001b[1m(\u001b[0m\n", 840 | " \u001b[33mpage_content\u001b[0m=\u001b[32m'Go deeper: The iOS changes will include notarization for iOS \u001b[0m\n", 841 | "\u001b[32mapps, authorization for marketplace developers and disclosures on alternative payments. \u001b[0m\n", 842 | "\u001b[32mApple says in the release that if apps opt out of Apple\\'s system, the company \"has less \u001b[0m\n", 843 | "\u001b[32mability to address other risks\" like \"scam, fraud, abuse\" or \"objectionable or harmful\" \u001b[0m\n", 844 | "\u001b[32mcontent.\\n\\nUsers in the EU will also see a browser choice screen in iOS 17.4 to pick a \u001b[0m\n", 845 | "\u001b[32mdefault browser.\\n\\nThe other side: Epic Games CEO Tim Sweeney said on X: \"Apple\\'s plan \u001b[0m\n", 846 | "\u001b[32mto thwart Europe\\'s new Digital Markets Act law is a devious new instance of Malicious \u001b[0m\n", 847 | "\u001b[32mCompliance... Epic has always supported the notion of Apple notarization and malware \u001b[0m\n", 848 | "\u001b[32mscanning for apps, but we strongly reject Apple\\'s twisting this process to undermine \u001b[0m\n", 849 | "\u001b[32mcompetition and continue imposing Apple taxes on transactions they\\'re not involved in.\"'\u001b[0m,\n", 850 | " \u001b[33mmetadata\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'source'\u001b[0m: \u001b[32m'/content/Article-edited.txt'\u001b[0m\u001b[1m}\u001b[0m\n", 851 | " \u001b[1m)\u001b[0m,\n", 852 | " \u001b[1;36m40.713356\u001b[0m\n", 853 | " \u001b[1m)\u001b[0m,\n", 854 | " \u001b[1m(\u001b[0m\n", 855 | " \u001b[1;35mDocument\u001b[0m\u001b[1m(\u001b[0m\n", 856 | " \u001b[33mpage_content\u001b[0m=\u001b[32m\"What\u001b[0m\u001b[32m to watch: It's up to the European Commission to determine \u001b[0m\n", 857 | "\u001b[32mwhether Apple's plan fully complies with the DMA. iPhone app developers face a whole new \u001b[0m\n", 858 | "\u001b[32mworld of choices, and time will tell if the changes boost competition and improve \u001b[0m\n", 859 | "\u001b[32mexperiences for users.\"\u001b[0m,\n", 860 | " \u001b[33mmetadata\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'source'\u001b[0m: \u001b[32m'/content/Article-edited.txt'\u001b[0m\u001b[1m}\u001b[0m\n", 861 | " \u001b[1m)\u001b[0m,\n", 862 | " \u001b[1;36m41.08703\u001b[0m\n", 863 | " \u001b[1m)\u001b[0m\n", 864 | "\u001b[1m]\u001b[0m\n" 865 | ], 866 | "text/html": [ 867 | "
[\n", 868 | " (\n", 869 | " Document(\n", 870 | " page_content='Apple\\'s iOS App Store announces sweeping changes in the \n", 871 | "EU\\nhttps://www.axios.com/2024/01/25/apple-app-store-eu-changes\\nAuthor: Ashley Gold, \n", 872 | "author of\\xa0Axios Pro\\n\\n\\nApple will allow alternative app stores and other new options \n", 873 | "for app developers in order to comply with Europe\\'s Digital Markets Act, the company said\n", 874 | "Thursday.\\n\\nDriving the news: Europe\\'s major tech competition law, set to go into effect\n", 875 | "March 7, requires Apple to loosen its strict rules requiring developers to rely on the App\n", 876 | "Store for distribution and payment processing.\\n\\nApple has long resisted any changes to \n", 877 | "its App Store rules, citing security and privacy. The company also argues its services for\n", 878 | "developers are best-in-class and ensure smooth user experiences free of spam or harmful \n", 879 | "content.\\n\\nWhy it matters: Apple is being forced to make sweeping changes to one of its \n", 880 | "flagship \"walled garden\" systems in what some smaller companies are seeing as a major \n", 881 | "win.',\n", 882 | " metadata={'source': '/content/Article-edited.txt'}\n", 883 | " ),\n", 884 | " 39.76284\n", 885 | " ),\n", 886 | " (\n", 887 | " Document(\n", 888 | " page_content='Go deeper: The iOS changes will include notarization for iOS \n", 889 | "apps, authorization for marketplace developers and disclosures on alternative payments. \n", 890 | "Apple says in the release that if apps opt out of Apple\\'s system, the company \"has less \n", 891 | "ability to address other risks\" like \"scam, fraud, abuse\" or \"objectionable or harmful\" \n", 892 | "content.\\n\\nUsers in the EU will also see a browser choice screen in iOS 17.4 to pick a \n", 893 | "default browser.\\n\\nThe other side: Epic Games CEO Tim Sweeney said on X: \"Apple\\'s plan \n", 894 | "to thwart Europe\\'s new Digital Markets Act law is a devious new instance of Malicious \n", 895 | "Compliance... Epic has always supported the notion of Apple notarization and malware \n", 896 | "scanning for apps, but we strongly reject Apple\\'s twisting this process to undermine \n", 897 | "competition and continue imposing Apple taxes on transactions they\\'re not involved in.\"',\n", 898 | " metadata={'source': '/content/Article-edited.txt'}\n", 899 | " ),\n", 900 | " 40.713356\n", 901 | " ),\n", 902 | " (\n", 903 | " Document(\n", 904 | " page_content=\"What to watch: It's up to the European Commission to determine \n", 905 | "whether Apple's plan fully complies with the DMA. iPhone app developers face a whole new \n", 906 | "world of choices, and time will tell if the changes boost competition and improve \n", 907 | "experiences for users.\",\n", 908 | " metadata={'source': '/content/Article-edited.txt'}\n", 909 | " ),\n", 910 | " 41.08703\n", 911 | " )\n", 912 | "]\n", 913 | "\n" 914 | ] 915 | }, 916 | "metadata": {} 917 | } 918 | ] 919 | }, 920 | { 921 | "cell_type": "markdown", 922 | "source": [ 923 | "### Query the documents and use the LLM to reply" 924 | ], 925 | "metadata": { 926 | "id": "UzIGm-UPsDH8" 927 | } 928 | }, 929 | { 930 | "cell_type": "code", 931 | "source": [ 932 | "#Function for QnA over a Context - the context is pure string text\n", 933 | "def QwenQnA(question,vectorstore,hits,maxtokens,model):\n", 934 | " \"\"\"\n", 935 | " basic generation with Qwen2-0.5b-Instruct/ any llama.cpp loaded model\n", 936 | " question -> string\n", 937 | " vectorstore-> a FAISS objects\n", 938 | " hits -> int, the number of results from the similarity search\n", 939 | " maxtokens -> int, number of max tokens to generate\n", 940 | " model -> llama-cpp-python instance // here is Qwen2-0.5b-Instruct AI\n", 941 | " RETURNS output -> str, docs -> list of langchain documents from similarity search\n", 942 | " \"\"\"\n", 943 | " #docs_and_scores = vectorstore.similarity_search_with_score(question,k=3) #or .similarity_search_with_relevance_scores()\n", 944 | " retriever = vectorstore.as_retriever(search_type=\"mmr\",search_kwargs={\"k\": hits})\n", 945 | " docs = retriever.invoke(question)\n", 946 | " # pack all the text from the retriever hits and remove carriage return\n", 947 | " context = ''\n", 948 | " for i in docs:\n", 949 | " context += i.page_content\n", 950 | " contesto = context.replace('\\n\\n','')\n", 951 | " query = question\n", 952 | " import datetime\n", 953 | " start = datetime.datetime.now()\n", 954 | " #create the prompt template\n", 955 | " template = f\"\"\"Answer the question based only on the following context:\n", 956 | "\n", 957 | "[context]\n", 958 | "{contesto}\n", 959 | "[end of context]\n", 960 | "\n", 961 | "Question: {query}\n", 962 | "\n", 963 | "\"\"\"\n", 964 | " #structure the prompt into a chat template\n", 965 | " messages = [\n", 966 | " {\"role\": \"system\", \"content\": \"You are a Language Model trained to answer questions based solely on the provided text.\",},\n", 967 | " {\"role\": \"user\", \"content\": template},\n", 968 | " ]\n", 969 | " with console.status(\"Qwen-0.5b-Chat AI is working ✅✅✅ ...\",spinner=\"dots12\"):\n", 970 | " output = model.create_chat_completion(\n", 971 | " messages=messages,\n", 972 | " max_tokens=maxtokens,\n", 973 | " stop=[\"\",\"[/INST]\",\"/INST\",'<|eot_id|>','<|end|>'],\n", 974 | " temperature = 0.1,\n", 975 | " repeat_penalty = 1.4)\n", 976 | " delta = datetime.datetime.now() - start\n", 977 | " console.print(f\"[bright_green bold on black]Question: {query}\")\n", 978 | " console.print(output[\"choices\"][0][\"message\"][\"content\"])\n", 979 | " console.print(f\"Completed in: [bold bright_red]{delta}\")\n", 980 | " return output[\"choices\"][0][\"message\"][\"content\"], docs" 981 | ], 982 | "metadata": { 983 | "id": "dUspnmrc5kqH" 984 | }, 985 | "execution_count": 8, 986 | "outputs": [] 987 | }, 988 | { 989 | "cell_type": "code", 990 | "source": [ 991 | "res, notetext = QwenQnA('what is a startup entrepreneurship?', vectorstore,4,500,qwen05b)" 992 | ], 993 | "metadata": { 994 | "colab": { 995 | "base_uri": "https://localhost:8080/", 996 | "height": 198, 997 | "referenced_widgets": [ 998 | "daf0f226487d447ab88b64b8cf8dd185", 999 | "b02f5d0c391644d6a7534066f8cc1193" 1000 | ] 1001 | }, 1002 | "id": "IdKLbaWW5kns", 1003 | "outputId": "1af4c3bf-eb09-4d73-85a3-0cea9308bf3e" 1004 | }, 1005 | "execution_count": 9, 1006 | "outputs": [ 1007 | { 1008 | "output_type": "display_data", 1009 | "data": { 1010 | "text/plain": [ 1011 | "Output()" 1012 | ], 1013 | "application/vnd.jupyter.widget-view+json": { 1014 | "version_major": 2, 1015 | "version_minor": 0, 1016 | "model_id": "daf0f226487d447ab88b64b8cf8dd185" 1017 | } 1018 | }, 1019 | "metadata": {} 1020 | }, 1021 | { 1022 | "output_type": "display_data", 1023 | "data": { 1024 | "text/plain": [], 1025 | "text/html": [ 1026 | "\n" 1027 | ] 1028 | }, 1029 | "metadata": {} 1030 | }, 1031 | { 1032 | "output_type": "display_data", 1033 | "data": { 1034 | "text/plain": [ 1035 | "\u001b[1;92;40mQuestion: what is a startup entrepreneurship?\u001b[0m\n" 1036 | ], 1037 | "text/html": [ 1038 | "
Question: what is a startup entrepreneurship?\n",
1039 | "\n"
1040 | ]
1041 | },
1042 | "metadata": {}
1043 | },
1044 | {
1045 | "output_type": "display_data",
1046 | "data": {
1047 | "text/plain": [
1048 | "A startup entrepreneur typically involves launching new and disruptive innovation in the \n",
1049 | "form of technology-driven solutions or entirely new businesses. These ventures are often \n",
1050 | "characterized by rapid growth potential, high risk/high reward balance between success \u001b[1m(\u001b[0min\n",
1051 | "competitive markets\u001b[1m)\u001b[0m versus failure due to inherent risks involved with running such \n",
1052 | "enterprises.\n",
1053 | "\n",
1054 | "In summary: a start-up entrepreneurship is about taking ownership for creating innovative \n",
1055 | "products/services and building something from the ground up in an environment where \n",
1056 | "there's significant opportunity but also carries some level of uncertainty.\n"
1057 | ],
1058 | "text/html": [
1059 | "A startup entrepreneur typically involves launching new and disruptive innovation in the \n", 1060 | "form of technology-driven solutions or entirely new businesses. These ventures are often \n", 1061 | "characterized by rapid growth potential, high risk/high reward balance between success (in\n", 1062 | "competitive markets) versus failure due to inherent risks involved with running such \n", 1063 | "enterprises.\n", 1064 | "\n", 1065 | "In summary: a start-up entrepreneurship is about taking ownership for creating innovative \n", 1066 | "products/services and building something from the ground up in an environment where \n", 1067 | "there's significant opportunity but also carries some level of uncertainty.\n", 1068 | "\n" 1069 | ] 1070 | }, 1071 | "metadata": {} 1072 | }, 1073 | { 1074 | "output_type": "display_data", 1075 | "data": { 1076 | "text/plain": [ 1077 | "Completed in: \u001b[1;91m0:00:54\u001b[0m\u001b[1;91m.\u001b[0m\u001b[1;91m322737\u001b[0m\n" 1078 | ], 1079 | "text/html": [ 1080 | "
Completed in: 0:00:54.322737\n", 1081 | "\n" 1082 | ] 1083 | }, 1084 | "metadata": {} 1085 | } 1086 | ] 1087 | }, 1088 | { 1089 | "cell_type": "code", 1090 | "source": [ 1091 | "console.print(notetext)" 1092 | ], 1093 | "metadata": { 1094 | "colab": { 1095 | "base_uri": "https://localhost:8080/", 1096 | "height": 1000 1097 | }, 1098 | "id": "qtMQqFgoCKUf", 1099 | "outputId": "ce2ca5a6-8b48-4c63-f55a-fd1867ae3c0e" 1100 | }, 1101 | "execution_count": 10, 1102 | "outputs": [ 1103 | { 1104 | "output_type": "display_data", 1105 | "data": { 1106 | "text/plain": [ 1107 | "\u001b[1m[\u001b[0m\n", 1108 | " \u001b[1;35mDocument\u001b[0m\u001b[1m(\u001b[0m\n", 1109 | " \u001b[33mpage_content\u001b[0m=\u001b[32m' and challenging journey filled with both immense rewards and \u001b[0m\n", 1110 | "\u001b[32mpotential setbacks.\\nI. What is entrepreneurship\\nThe world of business is brimming with \u001b[0m\n", 1111 | "\u001b[32mestablished giants and innovative upstarts. But what drives the creation of these new \u001b[0m\n", 1112 | "\u001b[32mventures? This is where the concept of entrepreneurship steps in.\\nEntrepreneurship is the\u001b[0m\n", 1113 | "\u001b[32mprocess of identifying opportunities, turning ideas into reality, and creating new \u001b[0m\n", 1114 | "\u001b[32mbusinesses. It’s a captivating blend of innovation, initiative, and calculated \u001b[0m\n", 1115 | "\u001b[32mrisk-taking. Entrepreneurs are the trailblazers who:\\nSpot a gap in the market: They have \u001b[0m\n", 1116 | "\u001b[32ma keen eye for unmet needs or problems waiting for solutions.\\nCraft unique solutions: \u001b[0m\n", 1117 | "\u001b[32mThey translate those needs into a product, service, or business model that addresses the \u001b[0m\n", 1118 | "\u001b[32midentified gap.\\nEmbrace calculated risks: They invest their time, resources, and effort \u001b[0m\n", 1119 | "\u001b[32minto bringing their vision to life, understanding the potential rewards and challenges \u001b[0m\n", 1120 | "\u001b[32mthat lie ahead.\\nBuild and manage the business: They assemble a team, secure funding, \u001b[0m\n", 1121 | "\u001b[32mnavigate the complexities of running a successful enterprise, and ensure its growth and \u001b[0m\n", 1122 | "\u001b[32msustainability.\\nIn essence, entrepreneurship is about taking ownership and turning ideas \u001b[0m\n", 1123 | "\u001b[32minto action. It’s about being the architect of your own destiny and building something \u001b[0m\n", 1124 | "\u001b[32mfrom the ground up'\u001b[0m,\n", 1125 | " \u001b[33mmetadata\u001b[0m=\u001b[1m{\u001b[0m\n", 1126 | " \u001b[32m'source'\u001b[0m: \u001b[32m'/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\u001b[0m\n", 1127 | " \u001b[1m}\u001b[0m\n", 1128 | " \u001b[1m)\u001b[0m,\n", 1129 | " \u001b[1;35mDocument\u001b[0m\u001b[1m(\u001b[0m\n", 1130 | " \u001b[33mpage_content\u001b[0m=\u001b[32m' failure in a competitive landscape.\\nFocus on Technology: Many \u001b[0m\n", 1131 | "\u001b[32mstartups leverage technology to create innovative products or services.\\n2. Small business\u001b[0m\n", 1132 | "\u001b[32mentrepreneurship\\nThe backbone of many communities, small business entrepreneurship \u001b[0m\n", 1133 | "\u001b[32mcenters around establishing a local business that caters to a specific niche or geographic\u001b[0m\n", 1134 | "\u001b[32marea. Think your friendly neighborhood bakery or a local bookstore. These ventures often \u001b[0m\n", 1135 | "\u001b[32mprioritize:\\nStability and Sustainability: Small businesses focus on building a loyal \u001b[0m\n", 1136 | "\u001b[32mcustomer base and providing reliable goods and services within their community.\\nCommunity\u001b[0m\n", 1137 | "\u001b[32mFocus: Understanding and catering to the specific needs of the local market is \u001b[0m\n", 1138 | "\u001b[32mparamount.\\nLower Risk Profile: While growth is still important, small businesses tend to \u001b[0m\n", 1139 | "\u001b[32mprioritize stability over rapid expansion.\\n3. Corporate entrepreneurship \u001b[0m\n", 1140 | "\u001b[32m(\u001b[0m\u001b[32mIntrapreneurship\u001b[0m\u001b[32m)\u001b[0m\u001b[32m\\nInnovation doesn’t have to happen outside established organizations. \u001b[0m\n", 1141 | "\u001b[32mIntrapreneurship fosters a culture of innovation within existing companies. Intrapreneurs \u001b[0m\n", 1142 | "\u001b[32mare employees who identify and develop new business ideas or products within the larger \u001b[0m\n", 1143 | "\u001b[32mcompany structure. They might:\\nDevelop new product lines or services.\\nIdentify new \u001b[0m\n", 1144 | "\u001b[32mmarket opportunities.\\nStreamline internal processes to improve \u001b[0m\n", 1145 | "\u001b[32mefficiency.\\nEntrepreneurial ventures benefit from the resources and infrastructure of the\u001b[0m\n", 1146 | "\u001b[32mestablished company, but navigating internal approval processes and overcoming'\u001b[0m,\n", 1147 | " \u001b[33mmetadata\u001b[0m=\u001b[1m{\u001b[0m\n", 1148 | " \u001b[32m'source'\u001b[0m: \u001b[32m'/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\u001b[0m\n", 1149 | " \u001b[1m}\u001b[0m\n", 1150 | " \u001b[1m)\u001b[0m,\n", 1151 | " \u001b[1;35mDocument\u001b[0m\u001b[1m(\u001b[0m\n", 1152 | " \u001b[33mpage_content\u001b[0m=\u001b[32m', and operational plan. While it’s a dynamic document that can \u001b[0m\n", 1153 | "\u001b[32mevolve as you learn and grow, a well-crafted business plan will help you stay focused and \u001b[0m\n", 1154 | "\u001b[32mattract potential investors.\\nAlso read: Crafting an Effective Product Launch Strategy: \u001b[0m\n", 1155 | "\u001b[32mBest Practices and Examples\\n3. Secure Funding\\nBootstrapping: Many entrepreneurs start by\u001b[0m\n", 1156 | "\u001b[32mbootstrapping their businesses using personal savings, loans from family and friends, or \u001b[0m\n", 1157 | "\u001b[32mcrowdfunding platforms.\\nSeeking Investors: For ventures requiring significant capital, \u001b[0m\n", 1158 | "\u001b[32mexploring options like angel investors or venture capital firms might be necessary. Be \u001b[0m\n", 1159 | "\u001b[32mprepared to present a compelling pitch that highlights the potential of your business.\\n4.\u001b[0m\n", 1160 | "\u001b[32mBuild Your Team\\nAssemble Your A-Team: Surround yourself with talented and passionate \u001b[0m\n", 1161 | "\u001b[32mindividuals who complement your skillset. Delegate tasks effectively and foster a \u001b[0m\n", 1162 | "\u001b[32mcollaborative environment where everyone feels valued and empowered to contribute.\\n5. \u001b[0m\n", 1163 | "\u001b[32mChoose a Business Structure\\nSole Proprietorship, Partnership, LLC, or Corporation? The \u001b[0m\n", 1164 | "\u001b[32mlegal structure you choose for your business can impact taxes, liabilities, and \u001b[0m\n", 1165 | "\u001b[32mregulations. Consult with a lawyer or accountant to determine the most suitable structure \u001b[0m\n", 1166 | "\u001b[32mfor your venture.\\n6. Obtain Necessary Licenses and Permits\\nComply with Regulations: \u001b[0m\n", 1167 | "\u001b[32mResearch the licenses and permits'\u001b[0m,\n", 1168 | " \u001b[33mmetadata\u001b[0m=\u001b[1m{\u001b[0m\n", 1169 | " \u001b[32m'source'\u001b[0m: \u001b[32m'/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\u001b[0m\n", 1170 | " \u001b[1m}\u001b[0m\n", 1171 | " \u001b[1m)\u001b[0m,\n", 1172 | " \u001b[1;35mDocument\u001b[0m\u001b[1m(\u001b[0m\n", 1173 | " \u001b[33mpage_content\u001b[0m=\u001b[32m' navigate the complexities of running a successful enterprise, and \u001b[0m\n", 1174 | "\u001b[32mensure its growth and sustainability.\\nIn essence, entrepreneurship is about taking \u001b[0m\n", 1175 | "\u001b[32mownership and turning ideas into action. It’s about being the architect of your own \u001b[0m\n", 1176 | "\u001b[32mdestiny and building something from the ground up.\\nII. Different types of \u001b[0m\n", 1177 | "\u001b[32mentrepreneurships\\nThe entrepreneurial spirit manifests in various forms, each with its \u001b[0m\n", 1178 | "\u001b[32munique purpose and approach.\\nLet’s delve into some of the most common types of \u001b[0m\n", 1179 | "\u001b[32mentrepreneurship ventures:\\nThere are 4 common types of entrepreneurship\\n1. Startup \u001b[0m\n", 1180 | "\u001b[32mentrepreneurship\\nOften associated with high-growth potential and disruptive innovation, \u001b[0m\n", 1181 | "\u001b[32mstartup entrepreneurship involves launching a new and innovative business. Startups \u001b[0m\n", 1182 | "\u001b[32mtypically focus on technology-driven solutions or entirely new business models. Think Uber\u001b[0m\n", 1183 | "\u001b[32mrevolutionizing transportation or Airbnb shaking up the hospitality industry. These \u001b[0m\n", 1184 | "\u001b[32mventures are often characterized by:\\nRapid Growth: Startups aim to scale quickly and \u001b[0m\n", 1185 | "\u001b[32machieve a dominant market position.\\nHigh Risk, High Reward: The potential for significant\u001b[0m\n", 1186 | "\u001b[32mreturns is balanced by the inherent risk of failure in a competitive landscape.\\nFocus on \u001b[0m\n", 1187 | "\u001b[32mTechnology: Many startups leverage technology to create innovative products or \u001b[0m\n", 1188 | "\u001b[32mservices.\\n2. Small business entrepreneurship\\nThe backbone of many communities, small \u001b[0m\n", 1189 | "\u001b[32mbusiness entrepreneurship centers around establishing a local business that caters to a \u001b[0m\n", 1190 | "\u001b[32mspecific'\u001b[0m,\n", 1191 | " \u001b[33mmetadata\u001b[0m=\u001b[1m{\u001b[0m\n", 1192 | " \u001b[32m'source'\u001b[0m: \u001b[32m'/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\u001b[0m\n", 1193 | " \u001b[1m}\u001b[0m\n", 1194 | " \u001b[1m)\u001b[0m\n", 1195 | "\u001b[1m]\u001b[0m\n" 1196 | ], 1197 | "text/html": [ 1198 | "
[\n", 1199 | " Document(\n", 1200 | " page_content=' and challenging journey filled with both immense rewards and \n", 1201 | "potential setbacks.\\nI. What is entrepreneurship\\nThe world of business is brimming with \n", 1202 | "established giants and innovative upstarts. But what drives the creation of these new \n", 1203 | "ventures? This is where the concept of entrepreneurship steps in.\\nEntrepreneurship is the\n", 1204 | "process of identifying opportunities, turning ideas into reality, and creating new \n", 1205 | "businesses. It’s a captivating blend of innovation, initiative, and calculated \n", 1206 | "risk-taking. Entrepreneurs are the trailblazers who:\\nSpot a gap in the market: They have \n", 1207 | "a keen eye for unmet needs or problems waiting for solutions.\\nCraft unique solutions: \n", 1208 | "They translate those needs into a product, service, or business model that addresses the \n", 1209 | "identified gap.\\nEmbrace calculated risks: They invest their time, resources, and effort \n", 1210 | "into bringing their vision to life, understanding the potential rewards and challenges \n", 1211 | "that lie ahead.\\nBuild and manage the business: They assemble a team, secure funding, \n", 1212 | "navigate the complexities of running a successful enterprise, and ensure its growth and \n", 1213 | "sustainability.\\nIn essence, entrepreneurship is about taking ownership and turning ideas \n", 1214 | "into action. It’s about being the architect of your own destiny and building something \n", 1215 | "from the ground up',\n", 1216 | " metadata={\n", 1217 | " 'source': '/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\n", 1218 | " }\n", 1219 | " ),\n", 1220 | " Document(\n", 1221 | " page_content=' failure in a competitive landscape.\\nFocus on Technology: Many \n", 1222 | "startups leverage technology to create innovative products or services.\\n2. Small business\n", 1223 | "entrepreneurship\\nThe backbone of many communities, small business entrepreneurship \n", 1224 | "centers around establishing a local business that caters to a specific niche or geographic\n", 1225 | "area. Think your friendly neighborhood bakery or a local bookstore. These ventures often \n", 1226 | "prioritize:\\nStability and Sustainability: Small businesses focus on building a loyal \n", 1227 | "customer base and providing reliable goods and services within their community.\\nCommunity\n", 1228 | "Focus: Understanding and catering to the specific needs of the local market is \n", 1229 | "paramount.\\nLower Risk Profile: While growth is still important, small businesses tend to \n", 1230 | "prioritize stability over rapid expansion.\\n3. Corporate entrepreneurship \n", 1231 | "(Intrapreneurship)\\nInnovation doesn’t have to happen outside established organizations. \n", 1232 | "Intrapreneurship fosters a culture of innovation within existing companies. Intrapreneurs \n", 1233 | "are employees who identify and develop new business ideas or products within the larger \n", 1234 | "company structure. They might:\\nDevelop new product lines or services.\\nIdentify new \n", 1235 | "market opportunities.\\nStreamline internal processes to improve \n", 1236 | "efficiency.\\nEntrepreneurial ventures benefit from the resources and infrastructure of the\n", 1237 | "established company, but navigating internal approval processes and overcoming',\n", 1238 | " metadata={\n", 1239 | " 'source': '/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\n", 1240 | " }\n", 1241 | " ),\n", 1242 | " Document(\n", 1243 | " page_content=', and operational plan. While it’s a dynamic document that can \n", 1244 | "evolve as you learn and grow, a well-crafted business plan will help you stay focused and \n", 1245 | "attract potential investors.\\nAlso read: Crafting an Effective Product Launch Strategy: \n", 1246 | "Best Practices and Examples\\n3. Secure Funding\\nBootstrapping: Many entrepreneurs start by\n", 1247 | "bootstrapping their businesses using personal savings, loans from family and friends, or \n", 1248 | "crowdfunding platforms.\\nSeeking Investors: For ventures requiring significant capital, \n", 1249 | "exploring options like angel investors or venture capital firms might be necessary. Be \n", 1250 | "prepared to present a compelling pitch that highlights the potential of your business.\\n4.\n", 1251 | "Build Your Team\\nAssemble Your A-Team: Surround yourself with talented and passionate \n", 1252 | "individuals who complement your skillset. Delegate tasks effectively and foster a \n", 1253 | "collaborative environment where everyone feels valued and empowered to contribute.\\n5. \n", 1254 | "Choose a Business Structure\\nSole Proprietorship, Partnership, LLC, or Corporation? The \n", 1255 | "legal structure you choose for your business can impact taxes, liabilities, and \n", 1256 | "regulations. Consult with a lawyer or accountant to determine the most suitable structure \n", 1257 | "for your venture.\\n6. Obtain Necessary Licenses and Permits\\nComply with Regulations: \n", 1258 | "Research the licenses and permits',\n", 1259 | " metadata={\n", 1260 | " 'source': '/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\n", 1261 | " }\n", 1262 | " ),\n", 1263 | " Document(\n", 1264 | " page_content=' navigate the complexities of running a successful enterprise, and \n", 1265 | "ensure its growth and sustainability.\\nIn essence, entrepreneurship is about taking \n", 1266 | "ownership and turning ideas into action. It’s about being the architect of your own \n", 1267 | "destiny and building something from the ground up.\\nII. Different types of \n", 1268 | "entrepreneurships\\nThe entrepreneurial spirit manifests in various forms, each with its \n", 1269 | "unique purpose and approach.\\nLet’s delve into some of the most common types of \n", 1270 | "entrepreneurship ventures:\\nThere are 4 common types of entrepreneurship\\n1. Startup \n", 1271 | "entrepreneurship\\nOften associated with high-growth potential and disruptive innovation, \n", 1272 | "startup entrepreneurship involves launching a new and innovative business. Startups \n", 1273 | "typically focus on technology-driven solutions or entirely new business models. Think Uber\n", 1274 | "revolutionizing transportation or Airbnb shaking up the hospitality industry. These \n", 1275 | "ventures are often characterized by:\\nRapid Growth: Startups aim to scale quickly and \n", 1276 | "achieve a dominant market position.\\nHigh Risk, High Reward: The potential for significant\n", 1277 | "returns is balanced by the inherent risk of failure in a competitive landscape.\\nFocus on \n", 1278 | "Technology: Many startups leverage technology to create innovative products or \n", 1279 | "services.\\n2. Small business entrepreneurship\\nThe backbone of many communities, small \n", 1280 | "business entrepreneurship centers around establishing a local business that caters to a \n", 1281 | "specific',\n", 1282 | " metadata={\n", 1283 | " 'source': '/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\n", 1284 | " }\n", 1285 | " )\n", 1286 | "]\n", 1287 | "\n" 1288 | ] 1289 | }, 1290 | "metadata": {} 1291 | } 1292 | ] 1293 | }, 1294 | { 1295 | "cell_type": "code", 1296 | "source": [ 1297 | "res, notetext = QwenQnA('what is the Small business entrepreneurship?', vectorstore,4,500,qwen05b)" 1298 | ], 1299 | "metadata": { 1300 | "colab": { 1301 | "base_uri": "https://localhost:8080/", 1302 | "height": 148, 1303 | "referenced_widgets": [ 1304 | "4aa3082ec7ec4df6a5c3313b81887cfa", 1305 | "6d6b2f1584db4acab1bd785342acfad8" 1306 | ] 1307 | }, 1308 | "id": "BAdyewUjwXVn", 1309 | "outputId": "53995bad-a6b8-4774-ccc2-ed1f1b366fbc" 1310 | }, 1311 | "execution_count": 11, 1312 | "outputs": [ 1313 | { 1314 | "output_type": "display_data", 1315 | "data": { 1316 | "text/plain": [ 1317 | "Output()" 1318 | ], 1319 | "application/vnd.jupyter.widget-view+json": { 1320 | "version_major": 2, 1321 | "version_minor": 0, 1322 | "model_id": "4aa3082ec7ec4df6a5c3313b81887cfa" 1323 | } 1324 | }, 1325 | "metadata": {} 1326 | }, 1327 | { 1328 | "output_type": "display_data", 1329 | "data": { 1330 | "text/plain": [], 1331 | "text/html": [ 1332 | "\n" 1333 | ] 1334 | }, 1335 | "metadata": {} 1336 | }, 1337 | { 1338 | "output_type": "display_data", 1339 | "data": { 1340 | "text/plain": [ 1341 | "\u001b[1;92;40mQuestion: what is the Small business entrepreneurship?\u001b[0m\n" 1342 | ], 1343 | "text/html": [ 1344 | "
Question: what is the Small business entrepreneurship?\n",
1345 | "\n"
1346 | ]
1347 | },
1348 | "metadata": {}
1349 | },
1350 | {
1351 | "output_type": "display_data",
1352 | "data": {
1353 | "text/plain": [
1354 | "Small Business Entrepreneurship centers on establishing local small enterprises that cater\n",
1355 | "to specific niche or geographic area, focusing primarily on stability \u001b[1m(\u001b[0mstability\u001b[1m)\u001b[0m & \n",
1356 | "sustainability \u001b[1m(\u001b[0msustainability\u001b[1m)\u001b[0m, community focus \u001b[1m(\u001b[0mcommunity\u001b[1m)\u001b[0m, lower risk profile \u001b[1m(\u001b[0mrisk\u001b[1m)\u001b[0m. \n",
1357 | "It also involves understanding and catering to a particular market. The venture often \n",
1358 | "prioritizes the establishment of stable businesses with loyal customers base within their \n",
1359 | "locality for long-term growth prospects\n"
1360 | ],
1361 | "text/html": [
1362 | "Small Business Entrepreneurship centers on establishing local small enterprises that cater\n", 1363 | "to specific niche or geographic area, focusing primarily on stability (stability) & \n", 1364 | "sustainability (sustainability), community focus (community), lower risk profile (risk). \n", 1365 | "It also involves understanding and catering to a particular market. The venture often \n", 1366 | "prioritizes the establishment of stable businesses with loyal customers base within their \n", 1367 | "locality for long-term growth prospects\n", 1368 | "\n" 1369 | ] 1370 | }, 1371 | "metadata": {} 1372 | }, 1373 | { 1374 | "output_type": "display_data", 1375 | "data": { 1376 | "text/plain": [ 1377 | "Completed in: \u001b[1;91m0:00:45\u001b[0m\u001b[1;91m.\u001b[0m\u001b[1;91m735451\u001b[0m\n" 1378 | ], 1379 | "text/html": [ 1380 | "
Completed in: 0:00:45.735451\n", 1381 | "\n" 1382 | ] 1383 | }, 1384 | "metadata": {} 1385 | } 1386 | ] 1387 | }, 1388 | { 1389 | "cell_type": "code", 1390 | "source": [ 1391 | "console.print(notetext)" 1392 | ], 1393 | "metadata": { 1394 | "colab": { 1395 | "base_uri": "https://localhost:8080/", 1396 | "height": 1000 1397 | }, 1398 | "id": "yJQgjcS1wXNu", 1399 | "outputId": "7d1750fb-4682-4611-c3dc-e98c90e97f10" 1400 | }, 1401 | "execution_count": 12, 1402 | "outputs": [ 1403 | { 1404 | "output_type": "display_data", 1405 | "data": { 1406 | "text/plain": [ 1407 | "\u001b[1m[\u001b[0m\n", 1408 | " \u001b[1;35mDocument\u001b[0m\u001b[1m(\u001b[0m\n", 1409 | " \u001b[33mpage_content\u001b[0m=\u001b[32m' failure in a competitive landscape.\\nFocus on Technology: Many \u001b[0m\n", 1410 | "\u001b[32mstartups leverage technology to create innovative products or services.\\n2. Small business\u001b[0m\n", 1411 | "\u001b[32mentrepreneurship\\nThe backbone of many communities, small business entrepreneurship \u001b[0m\n", 1412 | "\u001b[32mcenters around establishing a local business that caters to a specific niche or geographic\u001b[0m\n", 1413 | "\u001b[32marea. Think your friendly neighborhood bakery or a local bookstore. These ventures often \u001b[0m\n", 1414 | "\u001b[32mprioritize:\\nStability and Sustainability: Small businesses focus on building a loyal \u001b[0m\n", 1415 | "\u001b[32mcustomer base and providing reliable goods and services within their community.\\nCommunity\u001b[0m\n", 1416 | "\u001b[32mFocus: Understanding and catering to the specific needs of the local market is \u001b[0m\n", 1417 | "\u001b[32mparamount.\\nLower Risk Profile: While growth is still important, small businesses tend to \u001b[0m\n", 1418 | "\u001b[32mprioritize stability over rapid expansion.\\n3. Corporate entrepreneurship \u001b[0m\n", 1419 | "\u001b[32m(\u001b[0m\u001b[32mIntrapreneurship\u001b[0m\u001b[32m)\u001b[0m\u001b[32m\\nInnovation doesn’t have to happen outside established organizations. \u001b[0m\n", 1420 | "\u001b[32mIntrapreneurship fosters a culture of innovation within existing companies. Intrapreneurs \u001b[0m\n", 1421 | "\u001b[32mare employees who identify and develop new business ideas or products within the larger \u001b[0m\n", 1422 | "\u001b[32mcompany structure. They might:\\nDevelop new product lines or services.\\nIdentify new \u001b[0m\n", 1423 | "\u001b[32mmarket opportunities.\\nStreamline internal processes to improve \u001b[0m\n", 1424 | "\u001b[32mefficiency.\\nEntrepreneurial ventures benefit from the resources and infrastructure of the\u001b[0m\n", 1425 | "\u001b[32mestablished company, but navigating internal approval processes and overcoming'\u001b[0m,\n", 1426 | " \u001b[33mmetadata\u001b[0m=\u001b[1m{\u001b[0m\n", 1427 | " \u001b[32m'source'\u001b[0m: \u001b[32m'/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\u001b[0m\n", 1428 | " \u001b[1m}\u001b[0m\n", 1429 | " \u001b[1m)\u001b[0m,\n", 1430 | " \u001b[1;35mDocument\u001b[0m\u001b[1m(\u001b[0m\n", 1431 | " \u001b[33mpage_content\u001b[0m=\u001b[32m'title: What is Entrepreneurship - 5 Factors Affecting \u001b[0m\n", 1432 | "\u001b[32mEntrepreneurship\\xa0\\nauthor: Lynsey PT from Adamo Software | Predict | Jun, 2024 | \u001b[0m\n", 1433 | "\u001b[32mMedium\\nurl: \u001b[0m\n", 1434 | "\u001b[32mhttps://medium.com/predict/what-is-entrepreneurship-5-factors-affecting-entrepreneurship-4\u001b[0m\n", 1435 | "\u001b[32maadad3f161e\\n\\n\\nWhat is Entrepreneurship — 5 Factors Affecting Entrepreneurship\\nEver \u001b[0m\n", 1436 | "\u001b[32mdreamt of turning your idea into a reality? Explore the world of entrepreneurship! This \u001b[0m\n", 1437 | "\u001b[32mguide dives into what it means to be an entrepreneur.\\nHave you ever dreamt of being your \u001b[0m\n", 1438 | "\u001b[32mown boss, building something from the ground up, and making a positive impact on the \u001b[0m\n", 1439 | "\u001b[32mworld? If so, then entrepreneurship might be the path for you! But what exactly is \u001b[0m\n", 1440 | "\u001b[32mentrepreneurship?\\nEntrepreneurship is the process of identifying opportunities, creating \u001b[0m\n", 1441 | "\u001b[32mnew businesses, and taking calculated risks to bring ideas to life. It’s a dynamic and \u001b[0m\n", 1442 | "\u001b[32mchallenging journey filled with both immense rewards and potential setbacks.\\nI. What is \u001b[0m\n", 1443 | "\u001b[32mentrepreneurship\\nThe world of business is brimming with established giants and innovative\u001b[0m\n", 1444 | "\u001b[32mupstarts. But what drives the creation of these new ventures? This is where the concept'\u001b[0m,\n", 1445 | " \u001b[33mmetadata\u001b[0m=\u001b[1m{\u001b[0m\n", 1446 | " \u001b[32m'source'\u001b[0m: \u001b[32m'/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\u001b[0m\n", 1447 | " \u001b[1m}\u001b[0m\n", 1448 | " \u001b[1m)\u001b[0m,\n", 1449 | " \u001b[1;35mDocument\u001b[0m\u001b[1m(\u001b[0m\n", 1450 | " \u001b[33mpage_content\u001b[0m=\u001b[32m', and operational plan. While it’s a dynamic document that can \u001b[0m\n", 1451 | "\u001b[32mevolve as you learn and grow, a well-crafted business plan will help you stay focused and \u001b[0m\n", 1452 | "\u001b[32mattract potential investors.\\nAlso read: Crafting an Effective Product Launch Strategy: \u001b[0m\n", 1453 | "\u001b[32mBest Practices and Examples\\n3. Secure Funding\\nBootstrapping: Many entrepreneurs start by\u001b[0m\n", 1454 | "\u001b[32mbootstrapping their businesses using personal savings, loans from family and friends, or \u001b[0m\n", 1455 | "\u001b[32mcrowdfunding platforms.\\nSeeking Investors: For ventures requiring significant capital, \u001b[0m\n", 1456 | "\u001b[32mexploring options like angel investors or venture capital firms might be necessary. Be \u001b[0m\n", 1457 | "\u001b[32mprepared to present a compelling pitch that highlights the potential of your business.\\n4.\u001b[0m\n", 1458 | "\u001b[32mBuild Your Team\\nAssemble Your A-Team: Surround yourself with talented and passionate \u001b[0m\n", 1459 | "\u001b[32mindividuals who complement your skillset. Delegate tasks effectively and foster a \u001b[0m\n", 1460 | "\u001b[32mcollaborative environment where everyone feels valued and empowered to contribute.\\n5. \u001b[0m\n", 1461 | "\u001b[32mChoose a Business Structure\\nSole Proprietorship, Partnership, LLC, or Corporation? The \u001b[0m\n", 1462 | "\u001b[32mlegal structure you choose for your business can impact taxes, liabilities, and \u001b[0m\n", 1463 | "\u001b[32mregulations. Consult with a lawyer or accountant to determine the most suitable structure \u001b[0m\n", 1464 | "\u001b[32mfor your venture.\\n6. Obtain Necessary Licenses and Permits\\nComply with Regulations: \u001b[0m\n", 1465 | "\u001b[32mResearch the licenses and permits'\u001b[0m,\n", 1466 | " \u001b[33mmetadata\u001b[0m=\u001b[1m{\u001b[0m\n", 1467 | " \u001b[32m'source'\u001b[0m: \u001b[32m'/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\u001b[0m\n", 1468 | " \u001b[1m}\u001b[0m\n", 1469 | " \u001b[1m)\u001b[0m,\n", 1470 | " \u001b[1;35mDocument\u001b[0m\u001b[1m(\u001b[0m\n", 1471 | " \u001b[33mpage_content\u001b[0m=\u001b[32m' might:\\nDevelop new product lines or services.\\nIdentify new market\u001b[0m\n", 1472 | "\u001b[32mopportunities.\\nStreamline internal processes to improve efficiency.\\nEntrepreneurial \u001b[0m\n", 1473 | "\u001b[32mventures benefit from the resources and infrastructure of the established company, but \u001b[0m\n", 1474 | "\u001b[32mnavigating internal approval processes and overcoming resistance to change can be \u001b[0m\n", 1475 | "\u001b[32mchallenging.\\n4. Social entrepreneurship\\nEntrepreneurship can also be a powerful tool for\u001b[0m\n", 1476 | "\u001b[32mpositive social impact. Social entrepreneurship focuses on creating businesses that \u001b[0m\n", 1477 | "\u001b[32maddress social or environmental problems. These ventures aim to generate both financial \u001b[0m\n", 1478 | "\u001b[32mand social returns, striving for:\\nSocial Impact: The core mission is to create a positive\u001b[0m\n", 1479 | "\u001b[32mimpact on a social or environmental issue, such as poverty, education, or \u001b[0m\n", 1480 | "\u001b[32msustainability.\\nSustainable Business Model: Social enterprises need to be financially \u001b[0m\n", 1481 | "\u001b[32mviable to ensure long-term impact.\\nCommunity Focus: Social entrepreneurs often work \u001b[0m\n", 1482 | "\u001b[32mcollaboratively with communities to develop solutions that address their specific \u001b[0m\n", 1483 | "\u001b[32mneeds.\\nWhether you’re passionate about disrupting an industry, building a local haven, or\u001b[0m\n", 1484 | "\u001b[32mcreating positive social change, there’s a type of entrepreneurship that aligns with your \u001b[0m\n", 1485 | "\u001b[32mvision.\\nIII. Why entrepreneurship important\\nEntrepreneurship isn’t just about individual\u001b[0m\n", 1486 | "\u001b[32mjourneys and building successful businesses. It plays a crucial role in shaping the \u001b[0m\n", 1487 | "\u001b[32meconomic and social landscape around'\u001b[0m,\n", 1488 | " \u001b[33mmetadata\u001b[0m=\u001b[1m{\u001b[0m\n", 1489 | " \u001b[32m'source'\u001b[0m: \u001b[32m'/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\u001b[0m\n", 1490 | " \u001b[1m}\u001b[0m\n", 1491 | " \u001b[1m)\u001b[0m\n", 1492 | "\u001b[1m]\u001b[0m\n" 1493 | ], 1494 | "text/html": [ 1495 | "
[\n", 1496 | " Document(\n", 1497 | " page_content=' failure in a competitive landscape.\\nFocus on Technology: Many \n", 1498 | "startups leverage technology to create innovative products or services.\\n2. Small business\n", 1499 | "entrepreneurship\\nThe backbone of many communities, small business entrepreneurship \n", 1500 | "centers around establishing a local business that caters to a specific niche or geographic\n", 1501 | "area. Think your friendly neighborhood bakery or a local bookstore. These ventures often \n", 1502 | "prioritize:\\nStability and Sustainability: Small businesses focus on building a loyal \n", 1503 | "customer base and providing reliable goods and services within their community.\\nCommunity\n", 1504 | "Focus: Understanding and catering to the specific needs of the local market is \n", 1505 | "paramount.\\nLower Risk Profile: While growth is still important, small businesses tend to \n", 1506 | "prioritize stability over rapid expansion.\\n3. Corporate entrepreneurship \n", 1507 | "(Intrapreneurship)\\nInnovation doesn’t have to happen outside established organizations. \n", 1508 | "Intrapreneurship fosters a culture of innovation within existing companies. Intrapreneurs \n", 1509 | "are employees who identify and develop new business ideas or products within the larger \n", 1510 | "company structure. They might:\\nDevelop new product lines or services.\\nIdentify new \n", 1511 | "market opportunities.\\nStreamline internal processes to improve \n", 1512 | "efficiency.\\nEntrepreneurial ventures benefit from the resources and infrastructure of the\n", 1513 | "established company, but navigating internal approval processes and overcoming',\n", 1514 | " metadata={\n", 1515 | " 'source': '/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\n", 1516 | " }\n", 1517 | " ),\n", 1518 | " Document(\n", 1519 | " page_content='title: What is Entrepreneurship - 5 Factors Affecting \n", 1520 | "Entrepreneurship\\xa0\\nauthor: Lynsey PT from Adamo Software | Predict | Jun, 2024 | \n", 1521 | "Medium\\nurl: \n", 1522 | "https://medium.com/predict/what-is-entrepreneurship-5-factors-affecting-entrepreneurship-4\n", 1523 | "aadad3f161e\\n\\n\\nWhat is Entrepreneurship — 5 Factors Affecting Entrepreneurship\\nEver \n", 1524 | "dreamt of turning your idea into a reality? Explore the world of entrepreneurship! This \n", 1525 | "guide dives into what it means to be an entrepreneur.\\nHave you ever dreamt of being your \n", 1526 | "own boss, building something from the ground up, and making a positive impact on the \n", 1527 | "world? If so, then entrepreneurship might be the path for you! But what exactly is \n", 1528 | "entrepreneurship?\\nEntrepreneurship is the process of identifying opportunities, creating \n", 1529 | "new businesses, and taking calculated risks to bring ideas to life. It’s a dynamic and \n", 1530 | "challenging journey filled with both immense rewards and potential setbacks.\\nI. What is \n", 1531 | "entrepreneurship\\nThe world of business is brimming with established giants and innovative\n", 1532 | "upstarts. But what drives the creation of these new ventures? This is where the concept',\n", 1533 | " metadata={\n", 1534 | " 'source': '/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\n", 1535 | " }\n", 1536 | " ),\n", 1537 | " Document(\n", 1538 | " page_content=', and operational plan. While it’s a dynamic document that can \n", 1539 | "evolve as you learn and grow, a well-crafted business plan will help you stay focused and \n", 1540 | "attract potential investors.\\nAlso read: Crafting an Effective Product Launch Strategy: \n", 1541 | "Best Practices and Examples\\n3. Secure Funding\\nBootstrapping: Many entrepreneurs start by\n", 1542 | "bootstrapping their businesses using personal savings, loans from family and friends, or \n", 1543 | "crowdfunding platforms.\\nSeeking Investors: For ventures requiring significant capital, \n", 1544 | "exploring options like angel investors or venture capital firms might be necessary. Be \n", 1545 | "prepared to present a compelling pitch that highlights the potential of your business.\\n4.\n", 1546 | "Build Your Team\\nAssemble Your A-Team: Surround yourself with talented and passionate \n", 1547 | "individuals who complement your skillset. Delegate tasks effectively and foster a \n", 1548 | "collaborative environment where everyone feels valued and empowered to contribute.\\n5. \n", 1549 | "Choose a Business Structure\\nSole Proprietorship, Partnership, LLC, or Corporation? The \n", 1550 | "legal structure you choose for your business can impact taxes, liabilities, and \n", 1551 | "regulations. Consult with a lawyer or accountant to determine the most suitable structure \n", 1552 | "for your venture.\\n6. Obtain Necessary Licenses and Permits\\nComply with Regulations: \n", 1553 | "Research the licenses and permits',\n", 1554 | " metadata={\n", 1555 | " 'source': '/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\n", 1556 | " }\n", 1557 | " ),\n", 1558 | " Document(\n", 1559 | " page_content=' might:\\nDevelop new product lines or services.\\nIdentify new market\n", 1560 | "opportunities.\\nStreamline internal processes to improve efficiency.\\nEntrepreneurial \n", 1561 | "ventures benefit from the resources and infrastructure of the established company, but \n", 1562 | "navigating internal approval processes and overcoming resistance to change can be \n", 1563 | "challenging.\\n4. Social entrepreneurship\\nEntrepreneurship can also be a powerful tool for\n", 1564 | "positive social impact. Social entrepreneurship focuses on creating businesses that \n", 1565 | "address social or environmental problems. These ventures aim to generate both financial \n", 1566 | "and social returns, striving for:\\nSocial Impact: The core mission is to create a positive\n", 1567 | "impact on a social or environmental issue, such as poverty, education, or \n", 1568 | "sustainability.\\nSustainable Business Model: Social enterprises need to be financially \n", 1569 | "viable to ensure long-term impact.\\nCommunity Focus: Social entrepreneurs often work \n", 1570 | "collaboratively with communities to develop solutions that address their specific \n", 1571 | "needs.\\nWhether you’re passionate about disrupting an industry, building a local haven, or\n", 1572 | "creating positive social change, there’s a type of entrepreneurship that aligns with your \n", 1573 | "vision.\\nIII. Why entrepreneurship important\\nEntrepreneurship isn’t just about individual\n", 1574 | "journeys and building successful businesses. It plays a crucial role in shaping the \n", 1575 | "economic and social landscape around',\n", 1576 | " metadata={\n", 1577 | " 'source': '/content/What is Entrepreneurship 5 Factors Affecting Ent.txt'\n", 1578 | " }\n", 1579 | " )\n", 1580 | "]\n", 1581 | "\n" 1582 | ] 1583 | }, 1584 | "metadata": {} 1585 | } 1586 | ] 1587 | }, 1588 | { 1589 | "cell_type": "code", 1590 | "source": [ 1591 | "res, notetext = QwenQnA('what to do to get started with entrepreneurship?', vectorstore,5,500,qwen05b)" 1592 | ], 1593 | "metadata": { 1594 | "colab": { 1595 | "base_uri": "https://localhost:8080/", 1596 | "height": 296, 1597 | "referenced_widgets": [ 1598 | "f91344233fd3435ab1359dfeb2b5143a", 1599 | "669b6315922b402391e7c519c22307f2" 1600 | ] 1601 | }, 1602 | "id": "FN3eWDvEB_Z3", 1603 | "outputId": "20998f0c-a7df-46c5-a14d-0321dca9e18e" 1604 | }, 1605 | "execution_count": 29, 1606 | "outputs": [ 1607 | { 1608 | "output_type": "display_data", 1609 | "data": { 1610 | "text/plain": [ 1611 | "Output()" 1612 | ], 1613 | "application/vnd.jupyter.widget-view+json": { 1614 | "version_major": 2, 1615 | "version_minor": 0, 1616 | "model_id": "f91344233fd3435ab1359dfeb2b5143a" 1617 | } 1618 | }, 1619 | "metadata": {} 1620 | }, 1621 | { 1622 | "output_type": "display_data", 1623 | "data": { 1624 | "text/plain": [ 1625 | "\u001b[1;92;40mQuestion: what to do to get started with entrepreneurship?\u001b[0m\n" 1626 | ], 1627 | "text/html": [ 1628 | "
Question: what to do to get started with entrepreneurship?\n",
1629 | "\n"
1630 | ]
1631 | },
1632 | "metadata": {}
1633 | },
1634 | {
1635 | "output_type": "display_data",
1636 | "data": {
1637 | "text/plain": [
1638 | "To start getting into entrepreneurial ventures:\n",
1639 | "\n",
1640 | "\u001b[1;36m1\u001b[0m. Validate your idea - Market research helps understand if there's an opportunity in this\n",
1641 | "market.\n",
1642 | "\u001b[1;36m2\u001b[0m. Secure funding – Bootstrapping involves using personal savings, loans from family and \n",
1643 | "friends or crowdfunding platforms for startups.\n",
1644 | "\n",
1645 | "\u001b[1;36m3\u001b[0m. Build a team: Assemble talented individuals who complement the skills of entrepreneurs \n",
1646 | "to create innovative products/services that can drive economic growth.\n",
1647 | "\n",
1648 | "\u001b[1;36m4\u001b[0m. Choose your business structure - Sole proprietorship is often preferred as it allows \n",
1649 | "you control over all aspects while keeping taxes low.\n",
1650 | "\u001b[1;36m5\u001b[0m. Secure funding – Angel investors, venture capitalists or crowdfunding platforms are \n",
1651 | "available for startups seeking significant capital investment and support from the \n",
1652 | "community of entrepreneurs who share similar goals to yours.\n"
1653 | ],
1654 | "text/html": [
1655 | "To start getting into entrepreneurial ventures:\n", 1656 | "\n", 1657 | "1. Validate your idea - Market research helps understand if there's an opportunity in this\n", 1658 | "market.\n", 1659 | "2. Secure funding – Bootstrapping involves using personal savings, loans from family and \n", 1660 | "friends or crowdfunding platforms for startups.\n", 1661 | "\n", 1662 | "3. Build a team: Assemble talented individuals who complement the skills of entrepreneurs \n", 1663 | "to create innovative products/services that can drive economic growth.\n", 1664 | "\n", 1665 | "4. Choose your business structure - Sole proprietorship is often preferred as it allows \n", 1666 | "you control over all aspects while keeping taxes low.\n", 1667 | "5. Secure funding – Angel investors, venture capitalists or crowdfunding platforms are \n", 1668 | "available for startups seeking significant capital investment and support from the \n", 1669 | "community of entrepreneurs who share similar goals to yours.\n", 1670 | "\n" 1671 | ] 1672 | }, 1673 | "metadata": {} 1674 | }, 1675 | { 1676 | "output_type": "display_data", 1677 | "data": { 1678 | "text/plain": [ 1679 | "Completed in: \u001b[1;91m0:00:44\u001b[0m\u001b[1;91m.\u001b[0m\u001b[1;91m952537\u001b[0m\n" 1680 | ], 1681 | "text/html": [ 1682 | "
Completed in: 0:00:44.952537\n", 1683 | "\n" 1684 | ] 1685 | }, 1686 | "metadata": {} 1687 | }, 1688 | { 1689 | "output_type": "display_data", 1690 | "data": { 1691 | "text/plain": [], 1692 | "text/html": [ 1693 | "\n" 1694 | ] 1695 | }, 1696 | "metadata": {} 1697 | } 1698 | ] 1699 | }, 1700 | { 1701 | "cell_type": "code", 1702 | "source": [ 1703 | "console.print(notetext)" 1704 | ], 1705 | "metadata": { 1706 | "id": "lva1kdAq5kk8" 1707 | }, 1708 | "execution_count": null, 1709 | "outputs": [] 1710 | }, 1711 | { 1712 | "cell_type": "code", 1713 | "source": [], 1714 | "metadata": { 1715 | "id": "cggCW-qD5kil" 1716 | }, 1717 | "execution_count": null, 1718 | "outputs": [] 1719 | } 1720 | ] 1721 | } --------------------------------------------------------------------------------