20241118 - Academy folder added. Here will be examples form LangChain Academy.
- Using a single tool - [calculate]
- Using Graph With ReAct Agent with multiple tools [get_templerature, convert_to_fahrenheit]
-
@app.route('/lg_tutorials/quick_start/path:path', methods = ['GET']) Changed the route to only accept the GET requests, since was having issues with uncontrollable POST requests being made - quite a reconstruction, but needed.
-
POST requests will be made to functions in route "/api, ....."
-
For part4 . . it is a version with Human in The Loop - a 2 step process, where user should click on the "Proceed To Tools" button
-
Starting from part4_2
-
For clarity reasons -> total seperation of POST and GET routes
-
Templates are:
- src/templates/quick_start/part1_2.html
- src/templates/quick_start/part2_2.html
- src/templates/quick_start/part3_2.html
- src/templates/quick_start/part4_2.html
- src/templates/quick_start/part5_2.html
- src/templates/quick_start/part6_2.html
They are all extending base template: - src/templates/quick_start/quick_start_base.html - many elements are macros from src/templates/playground/macros
-
Classes for Graphs are defined in:
- src/tutorials/quick_start/part1.py
- src/tutorials/quick_start/part2.py
- src/tutorials/quick_start/part3.py
- src/tutorials/quick_start/part4.py
- src/tutorials/quick_start/part5.py
- src/tutorials/quick_start/part6.py
-
Some data is in session variable, defined in main.py - session['messages'], session ['user']
-
In code we want to initialize graph classes at right places.Usually this are variables created in @before_route as global variables. We can access them and perform some function within route on subsequent calls.
- src/templates/quick_start/quick_start_base_2.html
- src/templates/quick_start/quick_start_base.html -> base template
- src/templates/quick_start/part1_2.html -> is extending base tempalte
- src/templates/playground/macros -> few macros defined, that are imported into templates
OnboardingAssistant added:
- @app.route("/al_cohort/lesson8", methods= ['POST', 'GET'])
- This is the flask version of Alejandro's code from lesson8 - OnboardingAssistant for Umbrella corp.
Playing around with Bootsrap. Created 3 routes:
- bootstrap/boostrap -> bootstrap/bootstrap.html
- bootstrap/info -> bootstrap/info.html
- bootstrap/test_ext -> boostrap/test_ext.html
Messing around with extending templates . . from base.html and using macros in base.html
- Create a route [GET] for rendering template -> main.py All routes are defined here
@app.route('/index')
def index():
return render_template('index.html')
- Prepare html template in 'static/templates ...' Make sure to add elements (could be empty elements, that will be used by js)
- In header, make sure to correctly import js and css file
- Prepare js file, in 'static/js folder'. For readibility make a single js file for single html code
- For api functionality, prepare [POST] routes in main.py file
- When we stream data from model, use sockets for communication between py and js. Example in playground.
- here we find the directory where we have helperz_tutorials.py
'parent_dir_of_helperz_tutorials = os.path.dirname(os.path.dirname(os.path.abspath(file)))'
- we append this directory to the sys path
'sys.path.append(parent_dir_of_helperz_tutorials)'
- now we can import function from this file/module
'from helperz_tutorials import stream_graph_updates'