Replies: 1 comment
-
As a temporary workaround, I think this works: from pydantic import BaseModel
class UserInfo(BaseModel):
name: str
age: int
def build_function_request(base_model: BaseModel):
schema = base_model.model_json_schema()
openai_request = schema.copy()
name = openai_request.pop("title")
openai_request = {
'type': 'function',
'function': {
'name': name,
'parameters': {
'type': 'object',
'required': openai_request.pop('required'),
'properties': openai_request.pop('properties'),
},
'description': f"Correctly extracted `{name}` with all the required parameters with correct types"
}
}
return openai_request
build_function_request(UserInfo) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
I'd like more visibility on how Instructor post its requests.
Describe the solution you'd like
I'd like a
create_request
methodOutputs:
Describe alternatives you've considered
logfire, but I'd like to use the request downstream for LLM evaluation purposes
Additional context
Beta Was this translation helpful? Give feedback.
All reactions