初始化项目,由ModelHub XC社区提供模型

Model: ellamind/propella-1-4b
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-05-18 09:38:58 +08:00
commit 272f8486d6
27 changed files with 154867 additions and 0 deletions

26
inference_example.py Normal file
View File

@@ -0,0 +1,26 @@
from openai import OpenAI
from propella import (
create_messages,
AnnotationResponse,
get_annotation_response_schema,
)
document = "Hi, its me Max."
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="ellamind/propella-1-4b",
messages=create_messages(document),
response_format={
"type": "json_schema",
"json_schema": {
"name": "AnnotationResponse",
"schema": get_annotation_response_schema(flatten=True, compact_whitespace=True),
"strict": True,
}
},
)
response_content = response.choices[0].message.content
result = AnnotationResponse.model_validate_json(response_content)
print(result.model_dump_json(indent=4))