Spaces:
Sleeping
Sleeping
Commit ·
aacc053
1
Parent(s): 69c7540
Final
Browse files
Dockerfile
CHANGED
|
@@ -6,7 +6,7 @@ ENV HOME=/app
|
|
| 6 |
|
| 7 |
# Add ollama user and ensure home + ollama directories
|
| 8 |
RUN groupadd -r ollama && useradd -r -g ollama ollama \
|
| 9 |
-
&& mkdir -p /app/.ollama /app/.
|
| 10 |
&& chown -R ollama:ollama /app
|
| 11 |
|
| 12 |
# Install packages
|
|
|
|
| 6 |
|
| 7 |
# Add ollama user and ensure home + ollama directories
|
| 8 |
RUN groupadd -r ollama && useradd -r -g ollama ollama \
|
| 9 |
+
&& mkdir -p /app/.ollama /app/.local \
|
| 10 |
&& chown -R ollama:ollama /app
|
| 11 |
|
| 12 |
# Install packages
|
src/codeagent/src/codeagent/crews/SqlCrew/sqlcrew.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from typing import List
|
| 2 |
-
from crewai import Agent, Crew, Process, Task, LLM
|
| 3 |
from crewai.project import CrewBase, agent, crew, task
|
| 4 |
from crewai.agents.agent_builder.base_agent import BaseAgent
|
| 5 |
import sys
|
|
@@ -16,6 +16,16 @@ llm = LLM(model="ollama/llama3.1:8b-instruct-q4_0", base_url="http://localhost:1
|
|
| 16 |
def send_chat_message(output: str) -> None:
|
| 17 |
socketio.emit("event", {'kind':'agent_message', 'output': output})
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
@CrewBase
|
| 20 |
class SqlCrew:
|
| 21 |
agents: List[BaseAgent]
|
|
@@ -119,6 +129,7 @@ class SqlCrew:
|
|
| 119 |
description="Propose schema (tables, columns, PKs, FKs) if needed meaning if user specifically said so to create database or to change database.",
|
| 120 |
expected_output="Schema design in text format.",
|
| 121 |
agent=self.schema_agent(),
|
|
|
|
| 122 |
)
|
| 123 |
|
| 124 |
@task
|
|
|
|
| 1 |
from typing import List
|
| 2 |
+
from crewai import Agent, Crew, Process, Task, LLM, TaskOutput
|
| 3 |
from crewai.project import CrewBase, agent, crew, task
|
| 4 |
from crewai.agents.agent_builder.base_agent import BaseAgent
|
| 5 |
import sys
|
|
|
|
| 16 |
def send_chat_message(output: str) -> None:
|
| 17 |
socketio.emit("event", {'kind':'agent_message', 'output': output})
|
| 18 |
|
| 19 |
+
def callback_function(output: TaskOutput):
|
| 20 |
+
# Do something after the task is completed
|
| 21 |
+
# Example: Send an email to the manager
|
| 22 |
+
socketio.emit("event", {'kind':'agent_message', 'output': output})
|
| 23 |
+
print(f"""
|
| 24 |
+
Task completed!
|
| 25 |
+
Task: {output.description}
|
| 26 |
+
Output: {output.raw}
|
| 27 |
+
""")
|
| 28 |
+
|
| 29 |
@CrewBase
|
| 30 |
class SqlCrew:
|
| 31 |
agents: List[BaseAgent]
|
|
|
|
| 129 |
description="Propose schema (tables, columns, PKs, FKs) if needed meaning if user specifically said so to create database or to change database.",
|
| 130 |
expected_output="Schema design in text format.",
|
| 131 |
agent=self.schema_agent(),
|
| 132 |
+
callable = callback_function
|
| 133 |
)
|
| 134 |
|
| 135 |
@task
|