mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 04:04:14 +00:00
initial client + server for agentic system
This commit is contained in:
parent
13e1667e7a
commit
beb2870750
8 changed files with 166 additions and 3 deletions
47
source/server.py
Normal file
47
source/server.py
Normal file
|
@ -0,0 +1,47 @@
|
|||
from flask import Flask, request, jsonify
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List, Set, Optional, Union, Protocol
|
||||
from enum import Enum
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
from model_types import *
|
||||
from agentic_system_types import *
|
||||
from api_definitions import *
|
||||
|
||||
class AgenticSystemImpl(AgenticSystem):
|
||||
def create_agentic_system(self, request: AgenticSystemCreateRequest) -> AgenticSystemCreateResponse:
|
||||
# Mock implementation
|
||||
return AgenticSystemCreateResponse(agent_id="12345")
|
||||
|
||||
def create_agentic_system_execute(self, request: AgenticSystemExecuteRequest) -> Union[AgenticSystemExecuteResponse, AgenticSystemExecuteResponseStreamChunk]:
|
||||
# Mock implementation
|
||||
return AgenticSystemExecuteResponse(
|
||||
turn=AgenticSystemTurn(
|
||||
user_messages=[],
|
||||
steps=[],
|
||||
response_message=Message(
|
||||
role="assistant",
|
||||
content="Hello, I am an agent. I can help you with your tasks. What can I help you with?",
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
agentic_system = AgenticSystemImpl()
|
||||
|
||||
@app.route("/agentic_system/create", methods=["POST"])
|
||||
def create_agentic_system():
|
||||
data = request.json
|
||||
create_request = AgenticSystemCreateRequest(**data)
|
||||
response = agentic_system.create_agentic_system(create_request)
|
||||
return jsonify(response)
|
||||
|
||||
@app.route("/agentic_system/execute", methods=["POST"])
|
||||
def create_agentic_system_execute():
|
||||
data = request.json
|
||||
execute_request = AgenticSystemExecuteRequest(**data)
|
||||
response = agentic_system.create_agentic_system_execute(execute_request)
|
||||
return jsonify(response)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
Loading…
Add table
Add a link
Reference in a new issue