-
Notifications
You must be signed in to change notification settings - Fork 13
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 #115 from rgbkrk/gorilla-functions
Custom Servers -- allow passing through base url and api key
- Loading branch information
Showing
2 changed files
with
83 additions
and
3 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
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,72 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/markdown": [ | ||
"sql.query(\"select count(*) from products order by count desc limit 10\")" | ||
], | ||
"text/plain": [ | ||
"sql.query(\"select count(*) from products order by count desc limit 10\")" | ||
] | ||
}, | ||
"metadata": { | ||
"text/markdown": { | ||
"chatlab": { | ||
"default": true | ||
} | ||
} | ||
}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"from chatlab import Chat, system\n", | ||
"\n", | ||
"chat = Chat(\n", | ||
" system(\"You are a data engineer\"),\n", | ||
" model=\"gorilla-openfunctions-v0\",\n", | ||
" base_url=\"http://luigi.millennium.berkeley.edu:8000/v1\",\n", | ||
" api_key=\"EMPTY\",\n", | ||
")\n", | ||
"\n", | ||
"\n", | ||
"def sql(query: str):\n", | ||
" \"\"\"Runs SQL query\"\"\"\n", | ||
" # Totally fake, returns an empty table for demonstration\n", | ||
"\n", | ||
" return []\n", | ||
"\n", | ||
"\n", | ||
"chat.register(sql)\n", | ||
"\n", | ||
"await chat(\"Show me the top 10 most popular products\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "chatlab-3kMKfU-i-py3.11", | ||
"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.1" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |