genkit-fastapi 0.9.0__tar.gz → 0.11.0__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.
- {genkit_fastapi-0.9.0 → genkit_fastapi-0.11.0}/PKG-INFO +12 -9
- {genkit_fastapi-0.9.0 → genkit_fastapi-0.11.0}/README.md +3 -3
- {genkit_fastapi-0.9.0 → genkit_fastapi-0.11.0}/pyproject.toml +8 -12
- {genkit_fastapi-0.9.0 → genkit_fastapi-0.11.0}/src/genkit_fastapi/__init__.py +10 -12
- {genkit_fastapi-0.9.0 → genkit_fastapi-0.11.0}/.gitignore +0 -0
- {genkit_fastapi-0.9.0 → genkit_fastapi-0.11.0}/LICENSE +0 -0
- {genkit_fastapi-0.9.0 → genkit_fastapi-0.11.0}/src/genkit_fastapi/handler.py +0 -0
- {genkit_fastapi-0.9.0 → genkit_fastapi-0.11.0}/src/genkit_fastapi/py.typed +0 -0
- {genkit_fastapi-0.9.0 → genkit_fastapi-0.11.0}/tests/agent_handler_test.py +0 -0
- {genkit_fastapi-0.9.0 → genkit_fastapi-0.11.0}/tests/fastapi_test.py +0 -0
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: genkit-fastapi
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.11.0
|
|
4
|
+
Summary: Hang flows and agents on the FastAPI app you already have
|
|
5
5
|
Project-URL: Bug Tracker, https://github.com/genkit-ai/genkit/issues
|
|
6
|
-
Project-URL:
|
|
6
|
+
Project-URL: Changelog, https://github.com/genkit-ai/genkit/releases
|
|
7
|
+
Project-URL: Documentation, https://genkit.dev/docs/get-started/?lang=python
|
|
7
8
|
Project-URL: Homepage, https://github.com/genkit-ai/genkit
|
|
8
9
|
Project-URL: Repository, https://github.com/genkit-ai/genkit/tree/main/py
|
|
9
10
|
Author: Google
|
|
10
11
|
License-Expression: Apache-2.0
|
|
11
12
|
License-File: LICENSE
|
|
12
|
-
Keywords:
|
|
13
|
-
Classifier: Development Status ::
|
|
13
|
+
Keywords: fastapi,genkit,streaming
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
15
|
Classifier: Environment :: Console
|
|
15
16
|
Classifier: Environment :: Web Environment
|
|
17
|
+
Classifier: Framework :: FastAPI
|
|
16
18
|
Classifier: Intended Audience :: Developers
|
|
17
19
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
18
20
|
Classifier: Operating System :: OS Independent
|
|
@@ -25,6 +27,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
25
27
|
Classifier: Programming Language :: Python :: 3.14
|
|
26
28
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
27
29
|
Classifier: Topic :: Software Development :: Libraries
|
|
30
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
28
31
|
Classifier: Typing :: Typed
|
|
29
32
|
Requires-Python: >=3.10
|
|
30
33
|
Requires-Dist: fastapi>=0.100.0
|
|
@@ -54,7 +57,7 @@ from genkit import Genkit
|
|
|
54
57
|
from genkit_fastapi import serve_flow
|
|
55
58
|
from genkit_google_genai import GoogleAI
|
|
56
59
|
|
|
57
|
-
ai = Genkit(plugins=[GoogleAI()], model='
|
|
60
|
+
ai = Genkit(plugins=[GoogleAI()], model=GoogleAI.gemini_model('gemini-flash-latest'))
|
|
58
61
|
app = FastAPI()
|
|
59
62
|
|
|
60
63
|
|
|
@@ -86,7 +89,7 @@ from genkit import Genkit
|
|
|
86
89
|
from genkit_fastapi import serve_agent
|
|
87
90
|
from genkit_google_genai import GoogleAI
|
|
88
91
|
|
|
89
|
-
ai = Genkit(plugins=[GoogleAI()], model='
|
|
92
|
+
ai = Genkit(plugins=[GoogleAI()], model=GoogleAI.gemini_model('gemini-flash-latest'))
|
|
90
93
|
app = FastAPI()
|
|
91
94
|
|
|
92
95
|
|
|
@@ -97,7 +100,7 @@ async def get_weather(location: str) -> str:
|
|
|
97
100
|
|
|
98
101
|
weather_agent = ai.define_agent(
|
|
99
102
|
name='weatherAgent',
|
|
100
|
-
model='
|
|
103
|
+
model=GoogleAI.gemini_model('gemini-flash-latest'),
|
|
101
104
|
system='You are a helpful weather assistant.',
|
|
102
105
|
tools=[get_weather],
|
|
103
106
|
)
|
|
@@ -20,7 +20,7 @@ from genkit import Genkit
|
|
|
20
20
|
from genkit_fastapi import serve_flow
|
|
21
21
|
from genkit_google_genai import GoogleAI
|
|
22
22
|
|
|
23
|
-
ai = Genkit(plugins=[GoogleAI()], model='
|
|
23
|
+
ai = Genkit(plugins=[GoogleAI()], model=GoogleAI.gemini_model('gemini-flash-latest'))
|
|
24
24
|
app = FastAPI()
|
|
25
25
|
|
|
26
26
|
|
|
@@ -52,7 +52,7 @@ from genkit import Genkit
|
|
|
52
52
|
from genkit_fastapi import serve_agent
|
|
53
53
|
from genkit_google_genai import GoogleAI
|
|
54
54
|
|
|
55
|
-
ai = Genkit(plugins=[GoogleAI()], model='
|
|
55
|
+
ai = Genkit(plugins=[GoogleAI()], model=GoogleAI.gemini_model('gemini-flash-latest'))
|
|
56
56
|
app = FastAPI()
|
|
57
57
|
|
|
58
58
|
|
|
@@ -63,7 +63,7 @@ async def get_weather(location: str) -> str:
|
|
|
63
63
|
|
|
64
64
|
weather_agent = ai.define_agent(
|
|
65
65
|
name='weatherAgent',
|
|
66
|
-
model='
|
|
66
|
+
model=GoogleAI.gemini_model('gemini-flash-latest'),
|
|
67
67
|
system='You are a helpful weather assistant.',
|
|
68
68
|
tools=[get_weather],
|
|
69
69
|
)
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
[project]
|
|
18
18
|
authors = [{ name = "Google" }]
|
|
19
19
|
classifiers = [
|
|
20
|
-
"Development Status ::
|
|
20
|
+
"Development Status :: 4 - Beta",
|
|
21
21
|
"Environment :: Console",
|
|
22
22
|
"Environment :: Web Environment",
|
|
23
|
+
"Framework :: FastAPI",
|
|
23
24
|
"Intended Audience :: Developers",
|
|
24
25
|
"Operating System :: OS Independent",
|
|
25
26
|
"Programming Language :: Python",
|
|
@@ -31,32 +32,27 @@ classifiers = [
|
|
|
31
32
|
"Programming Language :: Python :: 3.14",
|
|
32
33
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
33
34
|
"Topic :: Software Development :: Libraries",
|
|
35
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
34
36
|
"Typing :: Typed",
|
|
35
37
|
"License :: OSI Approved :: Apache Software License",
|
|
36
38
|
]
|
|
37
39
|
dependencies = ["genkit", "pydantic>=2.10.5", "fastapi>=0.100.0"]
|
|
38
|
-
description = "
|
|
40
|
+
description = "Hang flows and agents on the FastAPI app you already have"
|
|
39
41
|
keywords = [
|
|
40
42
|
"genkit",
|
|
41
|
-
"ai",
|
|
42
|
-
"llm",
|
|
43
|
-
"machine-learning",
|
|
44
|
-
"artificial-intelligence",
|
|
45
|
-
"generative-ai",
|
|
46
43
|
"fastapi",
|
|
47
|
-
"
|
|
48
|
-
"server",
|
|
49
|
-
"async",
|
|
44
|
+
"streaming",
|
|
50
45
|
]
|
|
51
46
|
license = "Apache-2.0"
|
|
52
47
|
name = "genkit-fastapi"
|
|
53
48
|
readme = "README.md"
|
|
54
49
|
requires-python = ">=3.10"
|
|
55
|
-
version = "0.
|
|
50
|
+
version = "0.11.0"
|
|
56
51
|
|
|
57
52
|
[project.urls]
|
|
58
53
|
"Bug Tracker" = "https://github.com/genkit-ai/genkit/issues"
|
|
59
|
-
|
|
54
|
+
Changelog = "https://github.com/genkit-ai/genkit/releases"
|
|
55
|
+
"Documentation" = "https://genkit.dev/docs/get-started/?lang=python"
|
|
60
56
|
"Homepage" = "https://github.com/genkit-ai/genkit"
|
|
61
57
|
"Repository" = "https://github.com/genkit-ai/genkit/tree/main/py"
|
|
62
58
|
|
|
@@ -26,28 +26,26 @@ Example:
|
|
|
26
26
|
```python
|
|
27
27
|
from fastapi import FastAPI
|
|
28
28
|
from genkit import Genkit
|
|
29
|
-
from genkit_fastapi import
|
|
29
|
+
from genkit_fastapi import serve_flow
|
|
30
30
|
from genkit_google_genai import GoogleAI
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
ai = Genkit(plugins=[GoogleAI()])
|
|
32
|
+
ai = Genkit(plugins=[GoogleAI()], model=GoogleAI.gemini_model('gemini-flash-latest'))
|
|
34
33
|
app = FastAPI()
|
|
35
34
|
|
|
36
35
|
|
|
37
|
-
# 2. Define flow and expose as FastAPI endpoint in one clean decorator stack
|
|
38
|
-
@app.post('/chat', response_model=None)
|
|
39
|
-
@genkit_fastapi_handler(ai)
|
|
40
36
|
@ai.flow()
|
|
41
37
|
async def chat_flow(prompt: str) -> str:
|
|
42
|
-
res = await ai.generate(
|
|
43
|
-
model='googleai/gemini-flash-latest',
|
|
44
|
-
prompt=f'Answer concisely: {prompt}',
|
|
45
|
-
)
|
|
38
|
+
res = await ai.generate(prompt=prompt)
|
|
46
39
|
return res.text
|
|
47
40
|
|
|
48
41
|
|
|
49
|
-
#
|
|
50
|
-
|
|
42
|
+
# Mount flow endpoint at POST /api/chat_flow
|
|
43
|
+
app.include_router(serve_flow(chat_flow), prefix='/api')
|
|
44
|
+
|
|
45
|
+
# serve_agent(agent) mounts the same JSON protocol for an agent, plus
|
|
46
|
+
# /getSnapshot and /abort when session storage is enabled.
|
|
47
|
+
|
|
48
|
+
# For a custom route, decorate with @genkit_fastapi_handler(ai) over @ai.flow().
|
|
51
49
|
```
|
|
52
50
|
|
|
53
51
|
Running:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|