goose-py 0.9.12__py3-none-any.whl → 0.9.14__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.
goose/_internal/types/agent.py
CHANGED
@@ -1,19 +1,8 @@
|
|
1
1
|
import base64
|
2
2
|
from enum import StrEnum
|
3
|
-
from typing import
|
3
|
+
from typing import Literal, NotRequired, TypedDict
|
4
4
|
|
5
|
-
from pydantic import BaseModel
|
6
|
-
from pydantic_core import CoreSchema, core_schema
|
7
|
-
|
8
|
-
|
9
|
-
class Base64MediaContent(str):
|
10
|
-
@classmethod
|
11
|
-
def __get_pydantic_core_schema__(cls, source_type: Any, handler: GetCoreSchemaHandler) -> CoreSchema:
|
12
|
-
return core_schema.no_info_after_validator_function(cls, handler(str))
|
13
|
-
|
14
|
-
@classmethod
|
15
|
-
def from_bytes(cls, content: bytes, /) -> "Base64MediaContent":
|
16
|
-
return cls(base64.b64encode(content).decode())
|
5
|
+
from pydantic import BaseModel
|
17
6
|
|
18
7
|
|
19
8
|
class AIModel(StrEnum):
|
@@ -21,14 +10,19 @@ class AIModel(StrEnum):
|
|
21
10
|
VERTEX_PRO = "vertex_ai/gemini-1.5-pro"
|
22
11
|
VERTEX_FLASH = "vertex_ai/gemini-1.5-flash"
|
23
12
|
VERTEX_FLASH_8B = "vertex_ai/gemini-1.5-flash-8b"
|
13
|
+
VERTEX_FLASH_2_0 = "vertex_ai/gemini-2.0-flash"
|
24
14
|
|
25
15
|
# gemini (publicly available, no GCP environment required)
|
26
16
|
GEMINI_PRO = "gemini/gemini-1.5-pro"
|
27
17
|
GEMINI_FLASH = "gemini/gemini-1.5-flash"
|
28
18
|
GEMINI_FLASH_8B = "gemini/gemini-1.5-flash-8b"
|
19
|
+
GEMINI_FLASH_2_0 = "gemini/gemini-2.0-flash"
|
20
|
+
|
29
21
|
|
22
|
+
class ContentType(StrEnum):
|
23
|
+
# text
|
24
|
+
TEXT = "text/plain"
|
30
25
|
|
31
|
-
class UserMediaContentType(StrEnum):
|
32
26
|
# images
|
33
27
|
JPEG = "image/jpeg"
|
34
28
|
PNG = "image/png"
|
@@ -62,33 +56,30 @@ class LLMMessage(TypedDict):
|
|
62
56
|
cache_control: NotRequired[CacheControl]
|
63
57
|
|
64
58
|
|
65
|
-
class
|
66
|
-
|
67
|
-
|
68
|
-
def render(self) -> LLMTextMessagePart:
|
69
|
-
return {"type": "text", "text": self.text}
|
70
|
-
|
59
|
+
class MessagePart(BaseModel):
|
60
|
+
content: str
|
61
|
+
content_type: ContentType = ContentType.TEXT
|
71
62
|
|
72
|
-
|
73
|
-
content_type:
|
74
|
-
|
63
|
+
@classmethod
|
64
|
+
def from_media(cls, *, content: bytes, content_type: ContentType) -> "MessagePart":
|
65
|
+
return cls(content=base64.b64encode(content).decode(), content_type=content_type)
|
75
66
|
|
76
|
-
def render(self) -> LLMMediaMessagePart:
|
77
|
-
|
78
|
-
"type": "
|
79
|
-
|
80
|
-
|
67
|
+
def render(self) -> LLMTextMessagePart | LLMMediaMessagePart:
|
68
|
+
if self.content_type == ContentType.TEXT:
|
69
|
+
return {"type": "text", "text": self.content}
|
70
|
+
else:
|
71
|
+
return {"type": "image_url", "image_url": f"data:{self.content_type};base64,{self.content}"}
|
81
72
|
|
82
73
|
|
83
74
|
class UserMessage(BaseModel):
|
84
|
-
parts: list[
|
75
|
+
parts: list[MessagePart]
|
85
76
|
|
86
77
|
def render(self) -> LLMMessage:
|
87
78
|
content: LLMMessage = {
|
88
79
|
"role": "user",
|
89
80
|
"content": [part.render() for part in self.parts],
|
90
81
|
}
|
91
|
-
if any(
|
82
|
+
if any(part.content_type != ContentType.TEXT for part in self.parts):
|
92
83
|
content["cache_control"] = {"type": "ephemeral"}
|
93
84
|
return content
|
94
85
|
|
@@ -101,7 +92,7 @@ class AssistantMessage(BaseModel):
|
|
101
92
|
|
102
93
|
|
103
94
|
class SystemMessage(BaseModel):
|
104
|
-
parts: list[
|
95
|
+
parts: list[MessagePart]
|
105
96
|
|
106
97
|
def render(self) -> LLMMessage:
|
107
98
|
return {
|
goose/agent.py
CHANGED
@@ -2,14 +2,12 @@ from ._internal.agent import AgentResponse, IAgentLogger
|
|
2
2
|
from ._internal.types.agent import (
|
3
3
|
AIModel,
|
4
4
|
AssistantMessage,
|
5
|
-
|
5
|
+
ContentType,
|
6
6
|
LLMMediaMessagePart,
|
7
7
|
LLMMessage,
|
8
8
|
LLMTextMessagePart,
|
9
|
-
|
9
|
+
MessagePart,
|
10
10
|
SystemMessage,
|
11
|
-
TextMessagePart,
|
12
|
-
UserMediaContentType,
|
13
11
|
UserMessage,
|
14
12
|
)
|
15
13
|
|
@@ -18,13 +16,11 @@ __all__ = [
|
|
18
16
|
"AIModel",
|
19
17
|
"IAgentLogger",
|
20
18
|
"AssistantMessage",
|
21
|
-
"Base64MediaContent",
|
22
19
|
"LLMMediaMessagePart",
|
23
20
|
"LLMMessage",
|
24
21
|
"LLMTextMessagePart",
|
25
|
-
"MediaMessagePart",
|
26
22
|
"SystemMessage",
|
27
|
-
"
|
28
|
-
"
|
23
|
+
"MessagePart",
|
24
|
+
"ContentType",
|
29
25
|
"UserMessage",
|
30
26
|
]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: goose-py
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.14
|
4
4
|
Summary: A tool for AI workflows based on human-computer collaboration and structured output.
|
5
5
|
Author-email: Nash Taylor <nash@chelle.ai>, Joshua Cook <joshua@chelle.ai>, Michael Sankur <michael@chelle.ai>
|
6
6
|
Requires-Python: >=3.12
|
@@ -1,5 +1,5 @@
|
|
1
1
|
goose/__init__.py,sha256=wjGDgWzKcD6S8loVr0n-rLCpRwg-ZKAixcUaw1wobMc,243
|
2
|
-
goose/agent.py,sha256=
|
2
|
+
goose/agent.py,sha256=u6daAnn4fPgP4Jk9cHANyCEku3RmUqKLdqtyGSr8ljI,510
|
3
3
|
goose/errors.py,sha256=-0OyZQJWYTRw5YgnCB2_uorVaUsL6Z0QYQO2FqzCiyg,32
|
4
4
|
goose/flow.py,sha256=YsZLBa5I1W27_P6LYGWbtFX8ZYx9vJG3KtENYChHm5E,111
|
5
5
|
goose/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -13,7 +13,7 @@ goose/_internal/state.py,sha256=pI-C37Ybazo7EJPbZklxbiCYFy3u4I031NKBr8Jm_CI,6534
|
|
13
13
|
goose/_internal/store.py,sha256=tWmKfa1-yq1jU6lT3l6kSOmVt2m3H7I1xLMTrxnUDI8,889
|
14
14
|
goose/_internal/task.py,sha256=qjpX_wIQ2jKreMjrRy1SVedsuVzLXuOLgcyPstrgWfE,6176
|
15
15
|
goose/_internal/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
-
goose/_internal/types/agent.py,sha256=
|
17
|
-
goose_py-0.9.
|
18
|
-
goose_py-0.9.
|
19
|
-
goose_py-0.9.
|
16
|
+
goose/_internal/types/agent.py,sha256=g0KD-aPWZlUGBx72AwQd3LeniFxHATeflZ7191QjFZA,2696
|
17
|
+
goose_py-0.9.14.dist-info/METADATA,sha256=RGbV0Gcz9vC3n6TwurUc4BTT8y7NJ2d5p6OJZMKOJI8,442
|
18
|
+
goose_py-0.9.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
19
|
+
goose_py-0.9.14.dist-info/RECORD,,
|
File without changes
|