flo-ai 1.0.0.dev4__tar.gz → 1.0.0.dev6__tar.gz

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.
Files changed (33) hide show
  1. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/PKG-INFO +1 -1
  2. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/__init__.py +4 -1
  3. flo_ai-1.0.0.dev6/flo_ai/llm/__init__.py +16 -0
  4. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/llm/openai_llm.py +2 -2
  5. flo_ai-1.0.0.dev6/flo_ai/llm/openai_vllm.py +64 -0
  6. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/models/agent.py +5 -5
  7. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/pyproject.toml +1 -1
  8. flo_ai-1.0.0.dev4/flo_ai/llm/__init__.py +0 -7
  9. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/README.md +0 -0
  10. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/arium/README.md +0 -0
  11. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/arium/__init__.py +0 -0
  12. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/arium/arium.py +0 -0
  13. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/arium/base.py +0 -0
  14. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/arium/builder.py +0 -0
  15. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/arium/examples.py +0 -0
  16. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/arium/memory.py +0 -0
  17. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/arium/models.py +0 -0
  18. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/builder/agent_builder.py +0 -0
  19. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/formatter/yaml_format_parser.py +0 -0
  20. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/llm/anthropic_llm.py +0 -0
  21. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/llm/base_llm.py +0 -0
  22. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/llm/gemini_llm.py +0 -0
  23. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/llm/ollama_llm.py +0 -0
  24. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/models/__init__.py +0 -0
  25. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/models/agent_error.py +0 -0
  26. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/models/base_agent.py +0 -0
  27. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/tool/__init__.py +0 -0
  28. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/tool/base_tool.py +0 -0
  29. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/tool/flo_tool.py +0 -0
  30. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/utils/__init__.py +0 -0
  31. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/utils/flo_utils.py +0 -0
  32. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/utils/logger.py +0 -0
  33. {flo_ai-1.0.0.dev4 → flo_ai-1.0.0.dev6}/flo_ai/utils/variable_extractor.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: flo_ai
3
- Version: 1.0.0.dev4
3
+ Version: 1.0.0.dev6
4
4
  Summary: A easy way to create structured AI agents
5
5
  License: MIT
6
6
  Author: rootflo
@@ -8,7 +8,7 @@ from .models import Agent, AgentError, BaseAgent, AgentType, ReasoningPattern
8
8
  from .builder.agent_builder import AgentBuilder
9
9
 
10
10
  # LLM package - Language model integrations
11
- from .llm import BaseLLM, Anthropic, OpenAI, OllamaLLM, Gemini
11
+ from .llm import BaseLLM, Anthropic, OpenAI, OllamaLLM, Gemini, OpenAIVLLM, ImageMessage
12
12
 
13
13
  # Tool package - Tool framework components
14
14
  from .tool import Tool, ToolExecutionError, flo_tool, create_tool_from_function
@@ -43,6 +43,9 @@ __all__ = [
43
43
  'OpenAI',
44
44
  'OllamaLLM',
45
45
  'Gemini',
46
+ 'OpenAIVLLM',
47
+ # LLM DataClass
48
+ 'ImageMessage',
46
49
  # Tools
47
50
  'Tool',
48
51
  'ToolExecutionError',
@@ -0,0 +1,16 @@
1
+ from .base_llm import BaseLLM, ImageMessage
2
+ from .anthropic_llm import Anthropic
3
+ from .openai_llm import OpenAI
4
+ from .ollama_llm import OllamaLLM
5
+ from .gemini_llm import Gemini
6
+ from .openai_vllm import OpenAIVLLM
7
+
8
+ __all__ = [
9
+ 'BaseLLM',
10
+ 'Anthropic',
11
+ 'OpenAI',
12
+ 'OllamaLLM',
13
+ 'Gemini',
14
+ 'OpenAIVLLM',
15
+ 'ImageMessage',
16
+ ]
@@ -28,11 +28,11 @@ class OpenAI(BaseLLM):
28
28
  kwargs['response_format'] = {'type': 'json_object'}
29
29
  kwargs['functions'] = [
30
30
  {
31
- 'name': output_schema.get('name', 'default'),
31
+ 'name': output_schema.get('title', 'default'),
32
32
  'parameters': output_schema.get('schema', output_schema),
33
33
  }
34
34
  ]
35
- kwargs['function_call'] = {'name': output_schema.get('name', 'default')}
35
+ kwargs['function_call'] = {'name': output_schema.get('title', 'default')}
36
36
 
37
37
  # Add JSON format instruction to the system prompt
38
38
  if messages and messages[0]['role'] == 'system':
@@ -0,0 +1,64 @@
1
+ from typing import Any
2
+ from .openai_llm import OpenAI
3
+
4
+
5
+ class OpenAIVLLM(OpenAI):
6
+ def __init__(
7
+ self,
8
+ base_url: str,
9
+ model: str,
10
+ api_key: str = None,
11
+ temperature: float = 0.7,
12
+ **kwargs,
13
+ ):
14
+ super().__init__(
15
+ model=model,
16
+ api_key=api_key,
17
+ temperature=temperature,
18
+ base_url=base_url,
19
+ **kwargs,
20
+ )
21
+
22
+ # overriden
23
+ async def generate(
24
+ self, messages: list[dict], output_schema: dict = None, **kwargs
25
+ ) -> Any:
26
+ # Convert output_schema to OpenAI format if provided
27
+ if output_schema:
28
+ kwargs['response_format'] = {
29
+ 'type': 'json_schema',
30
+ 'json_schema': {
31
+ 'name': output_schema.get('title', 'default'),
32
+ 'schema': output_schema.get('schema', output_schema),
33
+ },
34
+ }
35
+
36
+ # Add JSON format instruction to the system prompt
37
+ if messages and messages[0]['role'] == 'system':
38
+ messages[0]['content'] = (
39
+ messages[0]['content']
40
+ + '\n\nPlease provide your response in JSON format according to the specified schema.'
41
+ )
42
+ else:
43
+ messages.insert(
44
+ 0,
45
+ {
46
+ 'role': 'system',
47
+ 'content': 'Please provide your response in JSON format according to the specified schema.',
48
+ },
49
+ )
50
+
51
+ # Prepare OpenAI API parameters
52
+ vllm_openai_kwargs = {
53
+ 'model': self.model,
54
+ 'messages': messages,
55
+ **kwargs,
56
+ **self.kwargs,
57
+ }
58
+
59
+ # Make the API call
60
+ response = await self.client.chat.completions.create(**vllm_openai_kwargs)
61
+ message = response.choices[0].message
62
+
63
+ # Return the full message object instead of just the content
64
+ return message
@@ -106,7 +106,7 @@ class Agent(BaseAgent):
106
106
  """Run as a conversational agent when no tools are provided"""
107
107
  variables = variables or {}
108
108
 
109
- while retry_count < self.max_retries:
109
+ while retry_count <= self.max_retries:
110
110
  try:
111
111
  # Resolve variables in system prompt
112
112
  system_content = (
@@ -150,7 +150,7 @@ class Agent(BaseAgent):
150
150
 
151
151
  should_retry, analysis = await self.handle_error(e, context)
152
152
 
153
- if should_retry and retry_count < self.max_retries:
153
+ if should_retry and retry_count <= self.max_retries:
154
154
  self.add_to_history(
155
155
  'system', f'Error occurred. Analysis: {analysis}'
156
156
  )
@@ -167,7 +167,7 @@ class Agent(BaseAgent):
167
167
  """Run as a tool-using agent when tools are provided"""
168
168
  variables = variables or {}
169
169
 
170
- while retry_count < self.max_retries:
170
+ while retry_count <= self.max_retries:
171
171
  try:
172
172
  # Resolve variables in system prompt based on reasoning pattern
173
173
  if self.reasoning_pattern == ReasoningPattern.REACT:
@@ -248,7 +248,7 @@ class Agent(BaseAgent):
248
248
  'attempt': retry_count,
249
249
  }
250
250
  should_retry, analysis = await self.handle_error(e, context)
251
- if should_retry and retry_count < self.max_retries:
251
+ if should_retry and retry_count <= self.max_retries:
252
252
  self.add_to_history(
253
253
  'system', f'Tool execution error: {analysis}'
254
254
  )
@@ -284,7 +284,7 @@ class Agent(BaseAgent):
284
284
  }
285
285
 
286
286
  should_retry, analysis = await self.handle_error(e, context)
287
- if should_retry and retry_count < self.max_retries:
287
+ if should_retry and retry_count <= self.max_retries:
288
288
  self.add_to_history(
289
289
  'system', f'Error occurred. Analysis: {analysis}'
290
290
  )
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "flo_ai"
3
- version = "1.0.0-dev4"
3
+ version = "1.0.0-dev6"
4
4
  description = "A easy way to create structured AI agents"
5
5
  authors = ["rootflo <*@rootflo.ai>"]
6
6
  license = "MIT"
@@ -1,7 +0,0 @@
1
- from .base_llm import BaseLLM
2
- from .anthropic_llm import Anthropic
3
- from .openai_llm import OpenAI
4
- from .ollama_llm import OllamaLLM
5
- from .gemini_llm import Gemini
6
-
7
- __all__ = ['BaseLLM', 'Anthropic', 'OpenAI', 'OllamaLLM', 'Gemini']
File without changes