Python: Wrapper + Samples#5177
Python: Wrapper + Samples#5177TaoChenOSU wants to merge 10 commits intofeature/python-foundry-hosted-agent-vnextfrom
Conversation
eavanvalkenburg
left a comment
There was a problem hiding this comment.
left a bunch of comments, and also really wondering if there is way to make the samples not need 6 files?
python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py
Outdated
Show resolved
Hide resolved
python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py
Outdated
Show resolved
Hide resolved
python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py
Outdated
Show resolved
Hide resolved
python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py
Outdated
Show resolved
Hide resolved
python/samples/05-end-to-end/hosted_agents/foundry_hosted_responses/01_basic/.dockerignore
Show resolved
Hide resolved
python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py
Outdated
Show resolved
Hide resolved
python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py
Show resolved
Hide resolved
python/samples/05-end-to-end/hosted_agents/foundry_hosted_responses/02_local_tools/main.py
Show resolved
Hide resolved
| prefix: The prefix to prepend (e.g. "foundry-hosting-responses"). | ||
| """ | ||
| if prefix and prefix not in _user_agent_prefixes: | ||
| _user_agent_prefixes.append(prefix) |
There was a problem hiding this comment.
does this mean we are now keeping basically a global list of prefixes added? I don't really like that idea, can't we solve this within the foundry hosting package?
| yield update.text | ||
|
|
||
| return StreamingResponse( | ||
| stream_response(), |
There was a problem hiding this comment.
I think we should be able to add a transform_hook on the stream object that is returned from run(stream=True) because a ResponseStream should behave like a AsyncGenerator
| if self._stream: | ||
|
|
||
| async def stream_response() -> AsyncGenerator[str]: | ||
| async for update in self._agent.run(user_message, session=session, stream=True): |
There was a problem hiding this comment.
same thing here as with the responses, we need ways to pass options along
| history = await context.get_history() | ||
| messages = [*_to_messages(history), input_items] | ||
|
|
||
| chat_options = _to_chat_options(request) |
There was a problem hiding this comment.
this is a good start, I still think we need more configurability here, but that might also be something we need from the hosted team
Motivation and Context
Initial PR to add Python Foundry hosted agent wrapper and samples.
Description
Contribution Checklist