-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from kingjulio8238/add-reranking
[FEAT] reranking base code
- Loading branch information
Showing
36 changed files
with
898 additions
and
5,419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
dev/routing_agent/memARy_tools/readme.md → dev/legacy_routing_agent/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%pip install pydantic\n", | ||
"%pip install googlemaps" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from main import handle_location_question, handle_vision_question, app" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%pip install llama_index" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# from llama_index.agent.openai import OpenAIAgent\n", | ||
"from llama_index.core.tools.tool_spec.base import BaseToolSpec" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"class CVToolSpec(BaseToolSpec):\n", | ||
" spec_functions = ['handle_vision_question']\n", | ||
"\n", | ||
" def __init__(self): #, form):\n", | ||
" # self.form = form\n", | ||
" ''''''\n", | ||
"\n", | ||
" def handle_vision_question(request):\n", | ||
" return handle_vision_question(request)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"cv_tool = CVToolSpec()\n", | ||
"cv_tool_list = cv_tool.to_tool_list()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"class LocationToolSpec(BaseToolSpec):\n", | ||
" spec_functions = ['handle_location_question']\n", | ||
"\n", | ||
" def __init__(self): #, form):\n", | ||
" # self.form = form\n", | ||
" ''''''\n", | ||
"\n", | ||
" def handle_location_question(request): \n", | ||
" return handle_location_question(request)\n", | ||
" " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from flask import request \n", | ||
"\n", | ||
"# form_data = request.form\n", | ||
"\n", | ||
"loc_tool = LocationToolSpec()\n", | ||
"loc_tool_list = loc_tool.to_tool_list(['handle_location_question'])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# from {KG repo} import {KG query method}" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"class SearchToolSpec(BaseToolSpec):\n", | ||
" spec_functions = ['']\n", | ||
"\n", | ||
" def __init__(self):\n", | ||
" ''''''\n", | ||
"\n", | ||
" def handle_search_request(request):\n", | ||
" return handle_search_request(request)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Experiment with making Agents from Tools" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from llama_index.agent.openai import OpenAIAgent\n", | ||
"from llama_index.llms.openai import OpenAI\n", | ||
"\n", | ||
"full_tool_list = cv_tool.to_tool_list() + loc_tool.to_tool_list()\n", | ||
"llm = OpenAI(model=\"gpt-3.5-turbo\")\n", | ||
"agent = OpenAIAgent.from_tools(full_tool_list, verbose=True)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "base", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
File renamed without changes.
Oops, something went wrong.