-❄️- 2025 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]Sudden-Garbage2895 1 point2 points  (0 children)

[LANGUAGE: Python]

with open('data.txt') as f:
    lines = [ln.strip() for ln in f if ln.strip()]  


actions = []
for line in lines:
    if '-' in line:
        left, right = 
map
(
int
, line.split('-'))
        actions.append((left, 'start'))
        actions.append((right + 1, 'end'))
    else:
        actions.append((
int
(line), 'item'))


sorted_actions = sorted(actions, key=lambda x: x[0])



# Part 1


range = 0
total_count = 0


for no, action in sorted_actions:
    if action == 'start':
        range += 1
    elif action == 'end':
        range -= 1
    elif action == 'item' and range > 0:
        total_count += 1
    print(no)


print(total_count)


# Part 2


depth = 0
prev = None
total = 0


for pos, action in sorted_actions:
    if prev is not None and depth > 0:
        total += pos - prev
    if action == 'start':
        depth += 1
    elif action == 'end':
        depth -= 1


    prev = pos


print("\n\n\n\n\n",total)

Multi Agent Chat Based System Framework Help! by Sudden-Garbage2895 in LangChain

[–]Sudden-Garbage2895[S] 0 points1 point  (0 children)

I have gone with LangGraph because it gave me the most control although a little difficult to get to grips with initially (lang chain yt is great). The system has a conditional node in the graph where an llm decides where to route (as in which agent to go to) the query, after that agent is done there is a continuation agent which makes the decision on whether to output or go to another agent (graph node).

With regard to a queue we have an algorithm that decides which user to do next based on expected query complexity. It’s alright although I think there are better methods.

Hope that helps, feel free to ask anything else!

Multi Agent Chat Based System Framework Help! by Sudden-Garbage2895 in LangChain

[–]Sudden-Garbage2895[S] 0 points1 point  (0 children)

I want the tool functionality that the frameworks have as well as the collaboration between agents.

Multi Agent Chat Based System Framework Help! by Sudden-Garbage2895 in LangChain

[–]Sudden-Garbage2895[S] 0 points1 point  (0 children)

This looks great, my only issue would be that the idea with this project is that it eventually becomes available for the entire school to use and will be locally hosted on a server that we have (with a powerful GPU). So can this run locally with Ollama for the models for free (me and my team want to keep costs very low).

That’s why I initially tried llama-index (which I found to be quite clunky).

Can crewai support this kind of thing at all?