Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: Simplify the AzureAssistantAgent/OpenAIAssistantAgent #10605

Open
moonbox3 opened this issue Feb 19, 2025 · 0 comments · May be fixed by #10666
Open

Python: Simplify the AzureAssistantAgent/OpenAIAssistantAgent #10605

moonbox3 opened this issue Feb 19, 2025 · 0 comments · May be fixed by #10666
Assignees
Labels
agents feature_graduation Applied to all feature graduation issues python Pull requests for the Python Semantic Kernel

Comments

@moonbox3
Copy link
Contributor

Move to support the AzureAssistantAgent/OpenAIAssistantAgent similar to how the AzureAIAgent is constructed/handled. This is a "less-wrapped" abstraction.

client = AzureAssistantAgent.create_client(
    # Will use Pydantic settings if env vars exist
    api_key=<optional_api_key>,
    deployment_name=<optional_api_key>,
    endpoint=<optional_endpoint>,
    api_version=<optional_api_version>,
)

agent_definition = await client.beta.assistants.create(
    model="gpt-4o"
    description="sample description",
    instructions="You are a helpful assistant",
    tools=[GetWeatherPlugin()],
)

agent = AzureAssistantAgent(
    client=client,
    definition=agent_definition,
)

thread = await client.beta.assistants.create_thread()

user_inputs = ["What is the weather like today?", "What is the weather like tomorrow?"]

for user_input in user_inputs:
    await agent.add_chat_message(
        thread_id=thread.id,
        message=user_input,
    )
    
    # Invoke the agent for the specified thread
    content = await agent.invoke(thread_id=thread.id)
    print(f"# User: '{user_input}'\n")
    print(f"# Agent: {content.content}\n")
@moonbox3 moonbox3 added agents python Pull requests for the Python Semantic Kernel labels Feb 19, 2025
@moonbox3 moonbox3 self-assigned this Feb 19, 2025
@crickman crickman added the feature_graduation Applied to all feature graduation issues label Feb 19, 2025
@crickman crickman moved this to Sprint: In Progress in Semantic Kernel Feb 20, 2025
@moonbox3 moonbox3 linked a pull request Feb 25, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agents feature_graduation Applied to all feature graduation issues python Pull requests for the Python Semantic Kernel
Projects
Status: Sprint: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants