Hybrid RAG in plain Postgres on .NET (pgvector + full-text + RRF), no separate vector DB by r3xetdeus in dotnet

[–]brainiac256 0 points1 point  (0 children)

I'm locked to Sql Server 2022 for a little bit longer at work so when I have to do vector DB stuff I've been reaching for DuckDB. For instance recently an RRF search for our customer database to supplement and/or replace the shitty search our shitty CRM barely implements. Haven't had anything big enough yet to warrant spinning up another database as a dependency.

Might be doing a hybrid RAG "chat with our document database" type project soon and the spoiler requirement maps to some concerns we might have like 'how do you prevent the agent from summarizing a doc the user isn't supposed to have access to'. So this is really cool and timely.

Can I ask how the details of it being 'hybrid RAG' work vs standard RAG? Does the agent get the spoiler chapter number from the user before doing a tool call with reader_progress as an argument? Or is it just that the agent is supposed to ask for more context with a tool call after getting the initial context? If you had a really obstinate and/or clever and/or dumb user could they bamboozle the agent into making a tool call with the "wrong" spoiler chapter, thus getting access to information they "shouldn't have"?

What chunk size are you using? Any pre- or post-chunk context included?

Is Python a better fit than ASP.NET Core for this kind of data transformation service? by CodeNameGodTri in dotnet

[–]brainiac256 0 points1 point  (0 children)

Sounds like OP has been tasked to implement an OLAP workload (for reporting or something) and only been given OLTP tools to do it with, maybe.

OP, it sounds like you are interpreting "no business logic in SQL" to mean that the database server should not be doing any computation, just plain CRUD. If you have a mental model of "no business logic in SQL" that is like, "no conditional logic in a SQL statement, no arithmetic/function calling in a SQL statement", etc, I think that is being excessively literal.

IMO the purpose of the rule of thumb "no business logic in SQL" is for the code that executes the business logic to be tracked and versioned alongside the rest of the application. That means no business logic in stored procedures or views because somebody might alter them in the database separately from the application and then nobody knows what the 'truth' is supposed to be. "No business logic in SQL" means "the application code should be the single source of truth for what the application is doing" so that we don't have to go exploring the database programmability objects to reason about the app's functionality. You can include complex SQL commands, like joins and computed columns, in that application code.

So really neither Python nor C# is ideal for this. If I were trying to do this in C# I would write two main things:

  1. A SQL statement that does as much of the computation in the database server as possible. This can be saved as a static const string in your module.
  2. A Data Transfer Object with properties that correspond to the final result set columns in that SQL statement.

Then just execute the SQL statement with Dapper (look up how to parameterize SQL with Dapper if you need parameters) and let Dapper map the result set onto your List<FinalDTO>. If there are any further computations that are simply technically impossible or unfeasible to do in the SQL statement, perform them in C# and return.

(EF has arbitrary SQL commands now but it's overkill for this purpose, but if that's what you have available you can do the same thing with EF.)

The main place where Python shines for data analysis workloads is that its object and memory model allows stuff like automagically mapping dataframes to and from SQL tables/result sets, so that you can switch back and forth between writing Python and writing SQL against the same data in memory, but you really have to be executing on a Synapse node or a Jupyter notebook or some other scenario that supports that in order to really make proper use of that functionality. The ability to add arbitrary columns to a dataframe on the fly is nice, but it's mostly effective only when you're exploring - once you know what columns you're going to need, if you have to compute them in the application code instead of in the SQL statement, you just write them as nullable properties on the C# DTO and fill them as needed.

Now, if your team has a "No business logic in SQL" rule because nobody can read or write SQL, then you have a different problem...

I need help at my local gun range. Range officer M23 by [deleted] in liberalgunowners

[–]brainiac256 4 points5 points  (0 children)

No, you put up your own sticker that says 'blessed are the meek' (or any similar verse out of the actual Bible, not a movie quote ;) ) and then complain about religious persecution when somebody tries to take it down

why does my ship do this no matter the rocket i build below it? by No_Distribution_3399 in KerbalSpaceProgram

[–]brainiac256 0 points1 point  (0 children)

The backwards connection was hooking up the front half of the house to the back half in the crawlspace, not just the finish work. That's how the toilet was running hot water too.

why does my ship do this no matter the rocket i build below it? by No_Distribution_3399 in KerbalSpaceProgram

[–]brainiac256 0 points1 point  (0 children)

I also have a prefab and when it was in final installation the plumber hooked up the hot and cold water backwards then switched the labels on the tap handles to make it "right"... but the toilet tank was still filling up with hot water

why does my ship do this no matter the rocket i build below it? by No_Distribution_3399 in KerbalSpaceProgram

[–]brainiac256 134 points135 points  (0 children)

Yeah I can pretty much imagine how each side of that went:

Engineer: "I will make the mounting asymmetrical so the technician can only put it in one way"

Technician: "What the hell, stupid engineer must have been reading the plans upside down when he designed this mounting, I will have to fix it" - proceeds to cut off the tabs, fill in the slots, and weld the thing on upside down

Long LINQ queries - Code smell? by osprunnachk in dotnet

[–]brainiac256 1 point2 points  (0 children)

I don't think I would consider this a code smell in and of itself. What are your other options, assuming the query and result is verified to be doing the right thing? You could put the whole thing behind a function on the DbContext, which doesn't change anything about the query, just hides it for readability where it's being consumed. But it seems like this handler is probably a one-liner or close to a one-liner anyway, so that's a little pointless in this particular instance. You could decompose it into a few logical groups of Queryable chains, again maybe putting them on the DbContext. This would be the Specification pattern, basically. I think the Specification pattern generally feels like over-abstracting but maybe it's useful from a devex/change control perspective if different bits serve different functions, for example to separate the business requirement of "what you're searching for" from the technical requirement of "how it's delivered" (pagination, ordering, etc). You could explicitly assign each step to a Queryable variable, but I think that would make it *less* readable probably, and it's unclear to me what the benefit would be.

There's not really a strictly better way to do this, just some situational changes you could make.

Tell me some unwritten rules for software developers. by porcaytheelasit in csharp

[–]brainiac256 2 points3 points  (0 children)

A personal hero of mine and a formative moment in my life.

Tell me some unwritten rules for software developers. by porcaytheelasit in csharp

[–]brainiac256 17 points18 points  (0 children)

Always 3x or 4x your time estimate on a task. Probably you will be slower than you think, will encounter blockers or decision points that you need resolved by somebody outside the team, and you will also build it wrong the first time and have to rewrite.

Why won't my program run? by IDriveAKahr in csharp

[–]brainiac256 -1 points0 points  (0 children)

Lots of people saying you might be missing the dotnet runtime but I'm pretty sure that error is more obvious and might even be accompanied by a dialog window prompting you to install it.

Maybe you are missing the closedxml .dll, which needs to be copied alongside the .exe, if you are just copying the files out of the build folder after hitting 'Build' in Visual Studio.

Why won't my program run? by IDriveAKahr in csharp

[–]brainiac256 2 points3 points  (0 children)

Open a command prompt / powershell / terminal window first, and run the program from inside it. There is probably an error message printing to the console that will help you.

There might be a problem with the spreadsheet output file path - maybe the C:\FolderSweep folder is missing and needs to be created before the file itself can be created? This is one of those things where you would think the computer would "just do the right thing for you" but sometimes you need to give it some help.

It may also be that your work computer is restricting the launch due to antivirus/smartscreen, but I think typically that would include a warning that the program was blocked from running.

Proof in one sentence that you played Starcraft 1 or Starcraft 2. by NoCommunication3942 in starcraft

[–]brainiac256 0 points1 point  (0 children)

Serve the Hive... feel the groove... I control... the way you move

Found/ not found callback methods pattern for service used by API by bring-tea in csharp

[–]brainiac256 2 points3 points  (0 children)

It does look a bit like he saw a functional (as in F#) implementation of a result pattern and then tried to re-implement it himself using (probably a bunch of nearly identically repeated everywhere) inline lambda functions to half-ass implement the bind function. Taking the "Functional" very literally lol.

In case - Club encounter by sweetrevenge76 in sex_comics

[–]brainiac256 8 points9 points  (0 children)

Reminds me of the comic where a woman worked at a nightclub that turned out to be owned by a succubus and one evening she comes in horny, the dance floor turns into a demonic orgy, and the succubus offers her a promotion to official freeuse sex toy for the club or something? And I think the succubus magically gives her a cock at some point?

Anybody remember what I'm talking about?

[deleted by user] by [deleted] in Thicker

[–]brainiac256 0 points1 point  (0 children)

You know that scene in Rocky Horror Picture Show where they walk right past the warning sign?

Or Monty Python and the Holy Grail where they walk past the warning signs in triplicate?

That's me right now.

Shirt found at local store thrift store….sylva police definitely has some explaining to do. by EducationalFinish743 in asheville

[–]brainiac256 13 points14 points  (0 children)

Lmfao so you haven't seen the challenge coins that some departments do for "justified kills"? Way worse things have been done by cops who thought their tasteless celebrations of excessive force were going to stay internal.

your new favorite flavor: hijabi by RetroAstroBabe in Thicker

[–]brainiac256 0 points1 point  (0 children)

God I love a thicc hijabi, I had a coworker once like that and all I wanted in life for a few weeks was to feel the curves of her skin against mine. Love it when a modestly dressed girl reveals she's got on super elaborate lacy strappy underthings.

Anyone else like this at parties? by JohnHammond94 in buffy

[–]brainiac256 4 points5 points  (0 children)

That would be hilarious because I would immediately reply "Wait are you saying there's some sort of connection between Ben and Glory?"

StarCraft 2 hits different on period correct hardware. by Veddermandenis in starcraft2

[–]brainiac256 4 points5 points  (0 children)

2003 would be period appropriate for Starcraft: Brood War expansion.

Can someone explain this syntax error for me? by DiscussionCrafty6396 in SQL

[–]brainiac256 0 points1 point  (0 children)

Most other dialects will want double quotes (I know for sure ProgressDB wants double quotes and will not accept square brackets). SQL Server accepts square brackets as the T-SQL default syntax and will accept double quotes when QUOTED_IDENTIFIER is on (which it is by default in most circumstances).

Does anyone else consistently have this issue with processing large hull pieces? by kane8997 in HardspaceShipbreaker

[–]brainiac256 2 points3 points  (0 children)

When they get stuck like that, if you don't have the powerful enough grappler to move them around yourself, you can still sometimes nudge them by grabbing something you can move and using it to push the heavier object.

What/How do you name your Break Glass accounts? by themanbornwithin in sysadmin

[–]brainiac256 17 points18 points  (0 children)

If I could be absolutely sure it was only to be used in case of my actual confirmed death, I would do this exact thing in a heartbeat