Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adapter out #258

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
5 changes: 5 additions & 0 deletions services/llm-client/adapters/outputs/interactions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from wires.outputs.interactions import Interaction as WireOutInteraction
from models.interactions import InteractionRequest

def model_to_dto(interaction_request: InteractionRequest) -> WireOutInteraction:
return WireOutInteraction(request_id=interaction_request.id, response=interaction_request.response)
4 changes: 3 additions & 1 deletion services/llm-client/diplomat/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from adapters.inputs.interaction import dto_to_model
from components.component_manager import ComponentManager
from components.scylla_connection import ScyllaConnection
from adapters.outputs import interactions

app = FastAPI()

Expand All @@ -17,4 +18,5 @@ async def shutdown_event():

@app.post("/api/llm/interactions")
def greet(interaction: Interaction):
return new_interaction(dto_to_model(interaction), ComponentManager.get_component(ScyllaConnection))
return interactions.model_to_dto(new_interaction(dto_to_model(interaction), ComponentManager.get_component(ScyllaConnection)))

Binary file not shown.
Empty file.
8 changes: 8 additions & 0 deletions services/llm-client/wires/outputs/interactions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from uuid import UUID

class Interaction():
def __init__(self, request_id: UUID, response:str):
self.requestId = request_id
self.response = response


Loading