codi-api-agent 0.3.1__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.
- api_agent/__init__.py +60 -0
- api_agent/__main__.py +5 -0
- api_agent/_version.py +2 -0
- api_agent/agent.py +6901 -0
- api_agent/catalog.py +147 -0
- api_agent/chart.py +144 -0
- api_agent/cli.py +31 -0
- api_agent/config.py +296 -0
- api_agent/doc_extract.py +431 -0
- api_agent/graphql_loader.py +309 -0
- api_agent/llm.py +470 -0
- api_agent/log.py +138 -0
- api_agent/metrics.py +1030 -0
- api_agent/openapi_loader.py +560 -0
- api_agent/prompts/__init__.py +59 -0
- api_agent/prompts/advisory.py +52 -0
- api_agent/prompts/executor.py +175 -0
- api_agent/prompts/judges.py +207 -0
- api_agent/prompts/support.py +59 -0
- api_agent/prompts/synthesis.py +350 -0
- api_agent/router.py +294 -0
- api_agent/schemas.py +250 -0
- api_agent/spec_convert.py +86 -0
- api_agent/sql_loader.py +1254 -0
- api_agent/supervisor.py +178 -0
- api_agent/ui.py +918 -0
- codi_api_agent-0.3.1.dist-info/METADATA +260 -0
- codi_api_agent-0.3.1.dist-info/RECORD +31 -0
- codi_api_agent-0.3.1.dist-info/WHEEL +5 -0
- codi_api_agent-0.3.1.dist-info/entry_points.txt +2 -0
- codi_api_agent-0.3.1.dist-info/top_level.txt +1 -0
api_agent/__init__.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""API Agent — a read-only, spec-driven agent over any API.
|
|
2
|
+
|
|
3
|
+
Point it at an **OpenAPI/Swagger** or **GraphQL** spec (or a **Postman / RAML / API Blueprint**
|
|
4
|
+
collection, which it auto-converts), ask in plain language, and it picks the right operations,
|
|
5
|
+
calls them (GET/query only), and answers with citations and an automated faithfulness check.
|
|
6
|
+
|
|
7
|
+
The LLM provider is any OpenAI-compatible endpoint (Groq / HuggingFace / Ollama / OpenAI),
|
|
8
|
+
selected through configuration so models stay swappable.
|
|
9
|
+
|
|
10
|
+
Quick start (programmatic):
|
|
11
|
+
|
|
12
|
+
from api_agent import Agent, Config, load_catalog
|
|
13
|
+
|
|
14
|
+
catalog = load_catalog("https://petstore3.swagger.io/api/v3/openapi.json")
|
|
15
|
+
agent = Agent(Config(api_key="...", base_url="https://api.groq.com/openai/v1"), catalog)
|
|
16
|
+
print(agent.run("how many pets are available?").answer)
|
|
17
|
+
|
|
18
|
+
Or launch the UI: ``api-agent`` (needs the ``[ui]`` extra).
|
|
19
|
+
"""
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
from api_agent.agent import Agent
|
|
23
|
+
from api_agent.catalog import Catalog, Tool
|
|
24
|
+
from api_agent.config import Config
|
|
25
|
+
from api_agent.graphql_loader import load_catalog, load_graphql
|
|
26
|
+
from api_agent.openapi_loader import load_openapi, merge_catalogs, spec_label
|
|
27
|
+
from api_agent.sql_loader import load_sql_catalog
|
|
28
|
+
from api_agent.supervisor import Supervisor
|
|
29
|
+
from api_agent._version import __version__
|
|
30
|
+
from api_agent.schemas import (
|
|
31
|
+
AgentResult,
|
|
32
|
+
Citation,
|
|
33
|
+
Evidence,
|
|
34
|
+
Faithfulness,
|
|
35
|
+
RubricDimension,
|
|
36
|
+
RubricReport,
|
|
37
|
+
ToolCall,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"Agent",
|
|
42
|
+
"Config",
|
|
43
|
+
"Catalog",
|
|
44
|
+
"Tool",
|
|
45
|
+
"AgentResult",
|
|
46
|
+
"Citation",
|
|
47
|
+
"Evidence",
|
|
48
|
+
"Faithfulness",
|
|
49
|
+
"RubricReport",
|
|
50
|
+
"RubricDimension",
|
|
51
|
+
"ToolCall",
|
|
52
|
+
"load_catalog",
|
|
53
|
+
"load_openapi",
|
|
54
|
+
"load_graphql",
|
|
55
|
+
"load_sql_catalog",
|
|
56
|
+
"Supervisor",
|
|
57
|
+
"merge_catalogs",
|
|
58
|
+
"spec_label",
|
|
59
|
+
"__version__",
|
|
60
|
+
]
|
api_agent/__main__.py
ADDED
api_agent/_version.py
ADDED