Skip to content

[DRAFT] Dev/OpenAI#263

Open
ygefen wants to merge 18 commits intomainfrom
dev/openai
Open

[DRAFT] Dev/OpenAI#263
ygefen wants to merge 18 commits intomainfrom
dev/openai

Conversation

@ygefen
Copy link

@ygefen ygefen commented Jan 30, 2026

Code & Config to utilize OpenAI API

Copy link
Author

@ygefen ygefen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmjoy Your thoughts would be appreciated

Copy link
Contributor

@dmjoy dmjoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far, and good questions. Let me know if anything is still unclear. I'm assuming that the extra requirements needed for the openai dependency are fairly light? Assuming the answer is yes we can go with it for now, some part of me likes the idea of just using requests or some other generic HTTP request library to truly decouple, but that's probably not worth it.


self.responses_kwargs = {
"model": self.model,
"reasoning": {"effort": "medium", "summary": "auto"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These might make more sense to go in the init args for the class, but fine to leave here for this first version.

@ygefen
Copy link
Author

ygefen commented Feb 25, 2026

@dmjoy I think this is ready for final review. Thoughts?

Copy link
Contributor

@dmjoy dmjoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general this all looks fine though I did have a few questions and minor (I think) suggestions. Also since this is an auxiliary component of the system and not necessarily / always critical path I'm not going to put too much scrutiny on it.

I would normally argue strongly for making the uv switch a separate PR, but since you need to add dependencies anyway, and I do also consider uv a strict upgrade to poetry I think it's fine to include here

return json.loads(text_content)
else:
# Return as plain text for unstructured outputs
return {"response": text_content} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe how the outlines inference engine works with the run_inference_unstructured call is it just returns strings (not dictionaries) unless this extra structure is needed here by the downstream response parsing code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def run_inference_unstructured(self, prompts: Union[str, list[str]]) -> Union[Dict, List[Dict]]:

So I am returning a dictionary or lis of dictionaries. Is that not right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh i see. I added the return type hint. I'll fix it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually for the structured output should i be returning Dialog | DialogElement objects instead of `Union[Dict, List[Dict]]?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you were able to successfully run against a local vLLM instance with this config (and the openai api inference code?)

@ygefen
Copy link
Author

ygefen commented Feb 25, 2026

In general this all looks fine though I did have a few questions and minor (I think) suggestions. Also since this is an auxiliary component of the system and not necessarily / always critical path I'm not going to put too much scrutiny on it.

I would normally argue strongly for making the uv switch a separate PR, but since you need to add dependencies anyway, and I do also consider uv a strict upgrade to poetry I think it's fine to include here

I agree in principle. If you would like I can preempt this PR with another migrating to uv, but I'm ok with combobulating them together "just this one time".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants