fyodorov-llm-agents 0.2.131__py3-none-any.whl → 0.2.135__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fyodorov_llm_agents/agents/agent.py +11 -9
- fyodorov_llm_agents/tools/mcp_tool.py +74 -0
- {fyodorov_llm_agents-0.2.131.dist-info → fyodorov_llm_agents-0.2.135.dist-info}/METADATA +2 -2
- fyodorov_llm_agents-0.2.135.dist-info/RECORD +8 -0
- {fyodorov_llm_agents-0.2.131.dist-info → fyodorov_llm_agents-0.2.135.dist-info}/WHEEL +1 -1
- fyodorov_llm_agents-0.2.131.dist-info/RECORD +0 -7
- {fyodorov_llm_agents-0.2.131.dist-info → fyodorov_llm_agents-0.2.135.dist-info}/top_level.txt +0 -0
@@ -87,11 +87,13 @@ class Agent(BaseModel):
|
|
87
87
|
else:
|
88
88
|
print("Provider Ollama")
|
89
89
|
model = 'ollama/'+self.model
|
90
|
-
if self.api_url
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
90
|
+
if self.api_url is None:
|
91
|
+
self.api_url = "https://api.ollama.ai/v1"
|
92
|
+
|
93
|
+
base_url = str(self.api_url)
|
94
|
+
if base_url and base_url[-1] == '/':
|
95
|
+
print("Removing trailing slash")
|
96
|
+
base_url = base_url[:-1]
|
95
97
|
|
96
98
|
messages: [] = [
|
97
99
|
{"content": self.prompt, "role": "system"},
|
@@ -101,11 +103,11 @@ class Agent(BaseModel):
|
|
101
103
|
print(f"Tools: {self.tools}")
|
102
104
|
tools = [tool.get_function() for tool in self.tools]
|
103
105
|
if tools and litellm.supports_function_calling(model=model):
|
104
|
-
print(f"calling litellm with model {model}, tools: {tools}, messages: {messages}, max_retries: 0, history: {history}, base_url: {
|
105
|
-
response = litellm.completion(model=model, messages=messages, max_retries=0, tools=tools, tool_choice="auto", base_url=
|
106
|
+
print(f"calling litellm with model {model}, tools: {tools}, messages: {messages}, max_retries: 0, history: {history}, base_url: {base_url}")
|
107
|
+
response = litellm.completion(model=model, messages=messages, max_retries=0, tools=tools, tool_choice="auto", base_url=base_url)
|
106
108
|
else:
|
107
|
-
print(f"calling litellm with model {model}, messages: {messages}, max_retries: 0, history: {history}, base_url: {
|
108
|
-
response = litellm.completion(model=model, messages=messages, max_retries=0, base_url=
|
109
|
+
print(f"calling litellm with model {model}, messages: {messages}, max_retries: 0, history: {history}, base_url: {base_url}")
|
110
|
+
response = litellm.completion(model=model, messages=messages, max_retries=0, base_url=base_url)
|
109
111
|
print(f"Response: {response}")
|
110
112
|
tool_calls = []
|
111
113
|
if hasattr(response, 'tool_calls'):
|
@@ -0,0 +1,74 @@
|
|
1
|
+
from pydantic import BaseModel, EmailStr, HttpUrl, Field
|
2
|
+
from typing import TypeVar, Optional, Dict, Any, Literal
|
3
|
+
import re
|
4
|
+
from datetime import datetime
|
5
|
+
|
6
|
+
APIUrlTypes = Literal['openapi']
|
7
|
+
|
8
|
+
# Example regex for validating textual fields; adjust as needed
|
9
|
+
VALID_CHARACTERS_REGEX = r'^[a-zA-Z0-9\s.,!?:;\'"\-_]+$'
|
10
|
+
MAX_DISPLAY_NAME_LENGTH = 80
|
11
|
+
MAX_DESCRIPTION_LENGTH = 1000
|
12
|
+
|
13
|
+
class MCPTool(BaseModel):
|
14
|
+
"""
|
15
|
+
Pydantic model corresponding to the 'mcp_tools' table.
|
16
|
+
"""
|
17
|
+
# Database columns
|
18
|
+
id: Optional[int] = None # bigserial (int8) primary key
|
19
|
+
created_at: Optional[datetime] = None # timestamptz
|
20
|
+
updated_at: Optional[datetime] = None # timestamptz
|
21
|
+
|
22
|
+
display_name: str = Field(..., max_length=MAX_DISPLAY_NAME_LENGTH)
|
23
|
+
handle: Optional[str] = None
|
24
|
+
description: Optional[str] = Field(None, max_length=MAX_DESCRIPTION_LENGTH)
|
25
|
+
logo_url: Optional[str] = None # stored as text; could be a URL
|
26
|
+
user_id: Optional[str] = None # uuid
|
27
|
+
|
28
|
+
public: bool = False
|
29
|
+
api_type: Optional[str] = None
|
30
|
+
api_url: Optional[str] = None # stored as text; could also be HttpUrl
|
31
|
+
auth_method: Optional[str] = None
|
32
|
+
auth_info: Optional[Dict[str, Any]] = None # jsonb
|
33
|
+
capabilities: Optional[Dict[str, Any]] = None # jsonb
|
34
|
+
health_status: Optional[str] = None
|
35
|
+
usage_notes: Optional[str] = None
|
36
|
+
|
37
|
+
# Example validations below. Adjust/extend to fit your needs.
|
38
|
+
|
39
|
+
def validate_model_fields(self) -> bool:
|
40
|
+
"""
|
41
|
+
Run custom validations on the model fields.
|
42
|
+
Returns True if all validations pass, otherwise raises ValueError.
|
43
|
+
"""
|
44
|
+
if self.display_name:
|
45
|
+
self._validate_display_name(self.display_name)
|
46
|
+
if self.description:
|
47
|
+
self._validate_description(self.description)
|
48
|
+
if self.api_url:
|
49
|
+
self._validate_url(self.api_url)
|
50
|
+
if self.logo_url:
|
51
|
+
self._validate_url(self.logo_url)
|
52
|
+
# Add more validations as desired...
|
53
|
+
return True
|
54
|
+
|
55
|
+
@staticmethod
|
56
|
+
def _validate_display_name(name: str) -> None:
|
57
|
+
if not re.match(VALID_CHARACTERS_REGEX, name):
|
58
|
+
raise ValueError("display_name contains invalid characters.")
|
59
|
+
|
60
|
+
@staticmethod
|
61
|
+
def _validate_description(description: str) -> None:
|
62
|
+
if not re.match(VALID_CHARACTERS_REGEX, description):
|
63
|
+
raise ValueError("description contains invalid characters.")
|
64
|
+
|
65
|
+
@staticmethod
|
66
|
+
def _validate_url(url: str) -> None:
|
67
|
+
if not HttpUrl.validate(url):
|
68
|
+
raise ValueError("{url} is not a valid URL.")
|
69
|
+
|
70
|
+
def to_dict(self) -> dict:
|
71
|
+
"""
|
72
|
+
Convert this Pydantic model to a plain dict (e.g., for inserting into Supabase).
|
73
|
+
"""
|
74
|
+
return self.dict()
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: fyodorov_llm_agents
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.135
|
4
4
|
Summary: LLM agents for the Fyodorov AI suite
|
5
5
|
Author-email: Daniel Ransom <02masseur.alibis@icloud.com>
|
6
6
|
Project-URL: Homepage, https://github.com/FyodorovAI/fyodorov-llm-agents
|
@@ -0,0 +1,8 @@
|
|
1
|
+
fyodorov_llm_agents/agents/agent.py,sha256=W1VkCeKAN7PYabUFlrchmad91P4NFcuqr1rRquwH1hI,6564
|
2
|
+
fyodorov_llm_agents/agents/openai.py,sha256=FA5RS7yn3JwvFA8PXju60XSYC_2oUZFNgBUzeIYtGv0,1154
|
3
|
+
fyodorov_llm_agents/tools/mcp_tool.py,sha256=nyqAqVLZODJOPbcfnBr302llnmLxDMwGZ_XsyEzjT_E,2827
|
4
|
+
fyodorov_llm_agents/tools/tool.py,sha256=HyOk0X_3XE23sa8J-8UZx657tJ0sxwZWMbA4OPxXU6E,7940
|
5
|
+
fyodorov_llm_agents-0.2.135.dist-info/METADATA,sha256=WSgXvrCzfYq1ITztKZ2h44ed6ifLwTiws21rNlg2fZc,552
|
6
|
+
fyodorov_llm_agents-0.2.135.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
7
|
+
fyodorov_llm_agents-0.2.135.dist-info/top_level.txt,sha256=4QOslsBp8Gh7ng25DceA7fHp4KguTIdAxwURz97gH-g,20
|
8
|
+
fyodorov_llm_agents-0.2.135.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
fyodorov_llm_agents/agents/agent.py,sha256=E4ogwm8BwC6MXOmyxjuO_TDh_Y3krOu7TEKiKwzDmAQ,6599
|
2
|
-
fyodorov_llm_agents/agents/openai.py,sha256=FA5RS7yn3JwvFA8PXju60XSYC_2oUZFNgBUzeIYtGv0,1154
|
3
|
-
fyodorov_llm_agents/tools/tool.py,sha256=HyOk0X_3XE23sa8J-8UZx657tJ0sxwZWMbA4OPxXU6E,7940
|
4
|
-
fyodorov_llm_agents-0.2.131.dist-info/METADATA,sha256=myvGBIKwMtR7200yg3kBzxsO4HMw6g9Yxkx2tGBWkr4,552
|
5
|
-
fyodorov_llm_agents-0.2.131.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
-
fyodorov_llm_agents-0.2.131.dist-info/top_level.txt,sha256=4QOslsBp8Gh7ng25DceA7fHp4KguTIdAxwURz97gH-g,20
|
7
|
-
fyodorov_llm_agents-0.2.131.dist-info/RECORD,,
|
{fyodorov_llm_agents-0.2.131.dist-info → fyodorov_llm_agents-0.2.135.dist-info}/top_level.txt
RENAMED
File without changes
|