This is a serverless function for converting currency from USD to other currencies and vice versa. This tool can be integrated with OpenAI, Gemini, Ollama, and other LLMs.
The currency conversion is done using the Exchange Rate API. Developers need to register for their own API key to use this tool.
curl -fsSL https://get.yomo.run | sh
Detail usages of the cli can be found on Doc: YoMo CLI.
yomo serve -c ./yomo.yml
the configuration file yomo.yml
is as below:
name: generic-llm-bridge
host: 0.0.0.0
port: 9000
bridge:
ai:
server:
addr: 0.0.0.0:9000
provider: openai
providers:
openai:
api_key: <SK-XXXXX>
model: <gpt-4o>
YoMo support multiple LLM providers, like Ollama, Mistral, Llama, Azure OpenAI, Cloudflare AI Gateway, etc. You can choose the one you want to use, details can be found on Doc: LLM Providers and Doc: Configuration.
API_KEY=<your-openexchangerates.org-api-key> yomo run app.go
Test in your terminal:
curl http://127.0.0.1:9000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "I have $10. Can I afford sunglasses that cost 1,499 yen?"
}
]
}'
Based on the real time currency exchange rate, you may get response like:
{
"id": "chatcmpl-9rLPlliiUPndzuRi2kuu2TfZHM2cz",
"object": "chat.completion",
"created": 1722500729,
"model": "gpt-4o-2024-05-13",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "With $10, you can get approximately 1,498.63 yen. Since the sunglasses cost 1,499 yen, you are just short by about 0.37 yen. So, you cannot afford the sunglasses with $10."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 223,
"completion_tokens": 70,
"total_tokens": 293
},
"system_fingerprint": "fp_4e2b2da518"
}
YoMo support concurrent function calling invokes, let's try ask How much is 100 usd in Korea and UK currency
:
$ curl http://127.0.0.1:9000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "How much is 100 usd in Korea and UK currency"
}
]
}'
You will get the response like this:
{
"id": "chatcmpl-9rL9LfkVpKgM0t88v8dErbDhlP0xM",
"object": "chat.completion",
"created": 1722499711,
"model": "gpt-4o-2024-05-13",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Based on today's exchange rates:\n\n- 100 USD is approximately 136,621.31 KRW (South Korean Won).\n- 100 USD is approximately 78.17 GBP (British Pound)."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 285,
"completion_tokens": 99,
"total_tokens": 384
},
"system_fingerprint": "fp_4e2b2da518"
}
Check Docs: Self Hosting for details on how to deploy YoMo LLM Bridge and Function Calling Serverless on your own infrastructure. Furthermore, if your AI agents become popular with users all over the world, you may consider deploying in multiple regions to improve LLM response speed. Check Docs: Geo-distributed System for instructions on making your AI applications more reliable and faster.
We know data is precious for every company, but managing multiple data regions is a big challenge. Vivgrid.com is a geo-distributed platform that routes user requests to the nearest LLM Bridge service. You can benefit from it to reduce latency and improve user experience while keeping your Function Calling Serverless deployed within your own infrastructure, even in your private cloud. Details can be found in Docs: How to keep data security in LLM Function Calling.
Accelerating your LLM tools will improve user experience and increase user engagement. If LLM response speed is your top priority, you can consider deploying your LLM Bridge service on Vivgrid. Your function calling serverless will be deployed on every continent. Check Docs: Deploy LLM function calling serverless on Vivgrid for more details.
yc deploy app.go --env API_KEY=<your-openexchangerates.org-api-key>
yc logs
For more about cli yc
usage, please check Docs: Vivgrid CLI.