Skip to content

Commit

Permalink
Add HTTP models for BrainForge service endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Dec 18, 2024
1 parent 038cd25 commit c194037
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
20 changes: 18 additions & 2 deletions neon_data_models/models/api/http/brainforge.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
from typing import List
from typing import List, Optional
from pydantic import Field

from neon_data_models.models.base import BaseModel
from neon_data_models.models.api.llm import BrainForgeLLM
from neon_data_models.models.api.llm import BrainForgeLLM, LLMPersona, LLMRequest


class LLMGetModelsHttpResponse(BaseModel):
models: List[BrainForgeLLM]


class LLMGetPersonasHttpRequest(BaseModel):
model_id: str = Field(
description="Model ID (<name>@<version>) to get personas for")


class LLMGetPersonasHttpResponse(BaseModel):
personas: List[LLMPersona] = Field(
description="List of personas associated with the requested model.")


class LLMGetInferenceHttpRequest(LLMRequest):
llm_name: str = Field(description="Model name to request")
llm_revision: str = Field(description="Model revision to request")
model: Optional[str] = None
7 changes: 2 additions & 5 deletions neon_data_models/models/api/mq/brainforge.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from neon_data_models.models.base.contexts import MQContext
from neon_data_models.models.api.llm import BrainForgeLLM, LLMRequest, LLMResponse, LLMPersona
from neon_data_models.models.api.http.brainforge import LLMGetModelsHttpResponse
from neon_data_models.models.api.http.brainforge import LLMGetModelsHttpResponse, LLMGetPersonasHttpRequest


class LLMGetModels(MQContext):
Expand All @@ -16,10 +16,7 @@ class LLMGetModelsResponse(MQContext, LLMGetModelsHttpResponse):
pass


class LLMGetPersonas(LLMGetModels):
model_id: str = Field(
description="Model ID (<name>@<version>) to get personas for")

class LLMGetPersonas(LLMGetModels, LLMGetPersonasHttpRequest):
@property
def model_name(self):
return self.model_id.split("@")[0]
Expand Down

0 comments on commit c194037

Please sign in to comment.