feat: remove langchain from code and change to CrewStructuredTool and update Dockerilf CodeInterpreter

This commit is contained in:
Eduardo Chiarotti
2024-11-25 16:14:49 -03:00
parent a3630418f9
commit 488782fb4a
2 changed files with 8 additions and 17 deletions

View File

@@ -1,11 +1,10 @@
from abc import ABC, abstractmethod
from typing import Any, Callable, Optional, Type
from typing import Any, Callable
from langchain_core.tools import StructuredTool
from pydantic import BaseModel, ConfigDict, Field, validator
from pydantic import BaseModel as PydanticBaseModel
from crewai.tools.base_tool import BaseTool
from crewai.tools.structured_tool import CrewStructuredTool
class Tool(BaseTool):
func: Callable
@@ -16,9 +15,9 @@ class Tool(BaseTool):
def to_langchain(
tools: list[BaseTool | StructuredTool],
) -> list[StructuredTool]:
return [t.to_langchain() if isinstance(t, BaseTool) else t for t in tools]
tools: list[BaseTool | CrewStructuredTool],
) -> list[CrewStructuredTool]:
return [t.to_structured_tool() if isinstance(t, BaseTool) else t for t in tools]
def tool(*args):

View File

@@ -1,14 +1,6 @@
FROM python:3.11-slim
FROM python:3.12-alpine
# Install common utilities
RUN apt-get update && apt-get install -y \
build-essential \
curl \
wget \
software-properties-common
# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pip install requests beautifulsoup4
# Set the working directory
WORKDIR /workspace