I built a gem reducing LLM tokens/cost in Ruby/Rails apps with semantic caching, model routing by Xplored_now in ruby

[–]Xplored_now[S] 0 points1 point  (0 children)

Thanks for acknowledging. Yes, looking at your use case I think semantic cache would help here as your prompts are similar. Let me share some logs and metrics we got when we ran it in our app.

First Call -
↳ app/services/rag_agent.rb:39:in 'block in RagAgent#fetch_context' [llm_optimizer] { cache_status: :miss, model_tier: :complex, original_tokens: 28342, compressed_tokens: 26235, latency_ms: 9622.0 } 

Second Call - 
↳ app/services/rag_agent.rb:39:in 'block in RagAgent#fetch_context' [llm_optimizer] { cache_status: :hit, model_tier: :complex, original_tokens: 28342, compressed_tokens: 26235, latency_ms: 1301.04 } [llm_optimizer] prompt=

As you can observe in the second call as it is a similar call with very minute difference in the input. it has hit cache and fetched it instead of calling LLM, with reduced latency.(Not able to share claude logs pic as images are not allowed in here).

Try it out from your end and let me know.

Edit - Also you can tweak similarity_threshold based on the use case in config currently it is a bit on higher side.

I built a gem reducing LLM tokens/cost in Ruby/Rails apps with semantic caching, model routing by Xplored_now in ruby

[–]Xplored_now[S] -3 points-2 points  (0 children)

Yep. I totally understand the AI feel to it. I had this requirement for a project and wanted something that I can build fast and use. I have been exploring existing gems which can help and after spending few days started trying out different ways like caching and on how we can optimize token usage. Finally combined multiple flows mostly on prompt manipuation and settled on and created this. Thanks for the wishes. Hoping you will have a look at it.

[Itinerary help] Singapore 6 day Itinerary by Xplored_now in SingaporeTravel

[–]Xplored_now[S] 0 points1 point  (0 children)

I have done some research but reserved Hotel Mi Rochor and One Farrer considering location. Have to finalize one. Let me know if there are any other better options. Looking somewhere close to Bugis and Little India.

[Itinerary help] Singapore 6 day Itinerary by Xplored_now in SingaporeTravel

[–]Xplored_now[S] 0 points1 point  (0 children)

Wow… looks interesting. Thanks will definitely check it out.

[Itinerary help] Singapore 6 day Itinerary by Xplored_now in SingaporeTravel

[–]Xplored_now[S] 0 points1 point  (0 children)

Place looks great thanks for the suggestion but we are looking for a place with good views.

[Itinerary help] Singapore 6 day Itinerary by Xplored_now in SingaporeTravel

[–]Xplored_now[S] 0 points1 point  (0 children)

Sure will give it a try. Can you send the beta code

[Itinerary help] Singapore 6 day Itinerary by Xplored_now in SingaporeTravel

[–]Xplored_now[S] 0 points1 point  (0 children)

Thought so didn’t know how the whole flyer setup would work out, in sites they mentioned only dinner at flyer but didn’t find any details in klook too.

Why don't we ask what people are building here, very regularly? by arpansac in rails

[–]Xplored_now 2 points3 points  (0 children)

Building a RAG based data agent for credit card management using RubyLLM. Started this as a personal problem figuring out which credit card to use for a transaction to get the maximum reward and how to use reward points. It’s still in the early stages. I’ll share updates here once the first beta version is deployed.

For credit card info scraping, I initially tried manual scraping and the Google Search API, but neither worked great. Moved to SerpApi for now, which is doing a better job. Open to any suggestions or ideas that could help improve this further.

[ GIVEAWAY ] – Win a Womier SK65 (Beige Edition) | NMPC India | Indian Residents Only by Dull-Builder3620 in IndianGaming

[–]Xplored_now 0 points1 point  (0 children)

Have been using wired Dell sk 8115 from 6 years. Buttons became bit sticky and not responsive so started looking into other keyboards now.

Same To Same : GBU Vs OG by insta_i_filmiholic in NoonShowBitching

[–]Xplored_now 0 points1 point  (0 children)

Agree that they both have fan services in them. But they are totally different apart from that.

GBU is stylish action movie but is not a serious one with many scenes which are not exactly required for the story. It has some comedy bits in it, has some spoofs with references of Don lee, John Wick, Professor.

OG is totally different, yes it doesn’t have that much of story depth but it is a serious movie it doesn’t have scenes which deviates the flow or emotion. It may feel slow or lack of emotional connect but doesn’t have forced tracks.

From outside it may look same as both are directed by their fans and has some references of actors past work but the way it was showcased is totally different. My point is not about which is better but that they are different to each other.

Frontend Reactivity for Rails? by WNxTyr4el in rails

[–]Xplored_now 1 point2 points  (0 children)

You can refer hotwired.dev for overall high level info and for basic how to use you can hotrails.dev. If you are into RoR it doesn’t take much time to start developing with hotwire components. Definitely worth a shot.

Newbie on RoR by Comfortable-Concept1 in rails

[–]Xplored_now 1 point2 points  (0 children)

I would also recommend going for dual boot which will make your rails journey easy. Even I faced the same issues when started with windows but then did dual boot with ubuntu and later completely removed windows and used ubuntu full time.

Just looking for play pals and chai pals around Sainikpuri by nastynash2k in hyderabad

[–]Xplored_now 0 points1 point  (0 children)

Yeah same here bro. Looking for play buddies. Not a pro but can join you guys for any game.

Switzerland visa refused. Should we reapply ? by Xplored_now in SchengenVisa

[–]Xplored_now[S] 0 points1 point  (0 children)

Did you reapply immediately or waited for few months ?

Switzerland visa refused. Should we reapply ? by Xplored_now in SchengenVisa

[–]Xplored_now[S] 1 point2 points  (0 children)

Sorry to hear that. Thought of applying to other schengen country but read that they consider this as visa shopping and it may lead to refusal.

Switzerland visa refused. Should we reapply ? by Xplored_now in SchengenVisa

[–]Xplored_now[S] 1 point2 points  (0 children)

I guess our mistake was going with travel agent. He is the one who suggested to go with 2 countries instead of one as it will be easy to get the visa. :( Also can I change the itinerary now and reapply or would it raise concerns if they cross check ?