clean-up and basic function call
How to run:
- create an
.env.localbased on.env.example, remove/comment-outAPI_KEYunless you need authentication - in your
.env.localadd your OpenAI key likeOPENAI_API_KEY=sk-aaa...bbb - run
make run-- this will create.venvand 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
/filterwith 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.pyfromllm = ChatOpenAI(model="gpt-3.5-turbo-0125", temperature=0.7)tollm = ChatOpenAI(model="hermes-2-pro-mistral", temperature=0.7) - test in cli in
./apisource ../.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/v1to.env.localto test via the endpoint created byserver.py
Edited by Laurian Gridinoc