-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
93 lines (77 loc) · 2.92 KB
/
Copy pathserver.py
File metadata and controls
93 lines (77 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from sample_code import core, openai, orchestration
app = FastAPI(title="SAP AI Core Python SDK Sample Application")
# no specific error handling, simply return error message
@app.exception_handler(Exception)
async def global_exception_handler(request: Request, exc: Exception):
return JSONResponse(status_code=500, content={"error": str(exc)})
# NOTE: /docs contains an auto-generated overview of the routes
@app.get("/")
@app.get("/health")
async def health():
return {"status": "ok"}
# AI Core (Configurations/Deployments)
app.get("/core/configurations")(core.get_configurations)
app.post("/core/configuration/create")(core.create_configuration)
app.get("/core/deployments")(core.get_deployments)
app.post("/core/deployment/create")(core.create_deployment)
app.get("/core/scenarios")(core.get_scenarios)
app.get("/core/models")(core.get_models)
# OpenAI
app.get("/openai/chat-completion")(openai.chat_completion)
app.get("/openai/chat-completion-stream")(openai.chat_completion_stream)
app.get("/openai/chat-completion-structured")(openai.chat_completion_structured)
app.get("/openai/chat-completion-structured-stream")(
openai.chat_completion_structured_stream
)
app.get("/openai/responses")(openai.responses_simple)
app.get("/openai/responses-structured")(openai.responses_structured)
app.get("/openai/embedding")(openai.embedding)
app.get("/orchestration/completion")(orchestration.completion)
app.get("/orchestration/completion-stream")(orchestration.completion_stream)
app.get("/orchestration/completion-template")(orchestration.completion_template)
app.get("/orchestration/message-history")(orchestration.message_history)
app.get("/orchestration/completion-image")(orchestration.completion_image)
app.get("/orchestration/input-filtering")(orchestration.input_filtering)
app.get("/orchestration/output-filtering")(orchestration.output_filtering)
app.get("/orchestration/completion-masking")(orchestration.completion_masking)
# PARTIALLY MISSING
# Orchestration
# - completion --> with resource group and with fallback
# - stream completion --> also with json response and tools
# - template --> from registry
# - masking anonymiyation/pseudonymization/regex --> embedding and grounding with masking
# FULLY MISSING
# Orchestration
# - reasoning
# - multi turn reasoning
# - stream reasoning
# - multi string
# - file input (url, local, base 64, other input formats?)
# - grounding (sharepoint/helpsap/parameter)
# - response format json (schema/object)
# - translation
# - embedding
# - citations
# - config (?) from registry
# - from json (?)
# - SAP ABAP
# - cache control (?)
# LangChain
# - max tokens
# - structured output
# - orchestration
# - input filter
# - output filter
# - masking
# - rag
# - toolchain
# - stateful chain
# - invoke dynamic model agent
# - prompt caching agent
# - retrieve documents
# - streaming
# Prompt Registry
# RPT Models
# Amazon and Google