clean-up and basic function call
How to run:
- create an
.env.local
based on.env.example
, remove/comment-outAPI_KEY
unless you need authentication - in your
.env.local
add your OpenAI key likeOPENAI_API_KEY=sk-aaa...bbb
- run
make run
-- this will create.venv
and install required modules, then run theapi/server.py
- use a browser to see the generated API docs at http://0.0.0.0:8889/docs
- invoke
/filter
with a query
To iterate faster on function_call_chain.py
you can run it in cli: in ./api
folder run source ../.venv/bin/activate; OPENAI_API_KEY="sk-aaa...bbb" python ./function_call_chain.py
To test that the same code works with Hermes 2 model:
- run Hermes first as:
docker run -ti -p 8080:8080 localai/localai:v2.11.0-ffmpeg-core hermes-2-pro-mistral
- change in
function_call_chain.py
fromllm = ChatOpenAI(model="gpt-3.5-turbo-0125", temperature=0.7)
tollm = ChatOpenAI(model="hermes-2-pro-mistral", temperature=0.7)
- test in cli in
./api
source ../.venv/bin/activate; OPENAI_API_KEY="sk-aaa...bbb" OPENAI_API_BASE=http://localhost:8080/v1 python ./function_call_chain.py
- add
OPENAI_API_BASE=http://localhost:8080/v1
to.env.local
to test via the endpoint created byserver.py
Edited by Laurian Gridinoc