Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 113 additions & 84 deletions python/packages/ai/poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions python/packages/ai/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ aiohttp = "^3.8.5"
jsonschema = "^4.21.1"
types-pyyaml = "^6.0.12.12"
pyyaml = "^6.0.1"
botbuilder-integration-aiohttp = "^4.14.8"
dataclasses-json = "^0.6.4"
openai = "^1.11.1"

Expand Down
10 changes: 6 additions & 4 deletions python/packages/ai/teams/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
cast,
)

from botbuilder.core import Bot, BotFrameworkAdapter, InvokeResponse, TurnContext
from botbuilder.core import Bot, InvokeResponse, TurnContext
from botbuilder.integration.aiohttp import CloudAdapter
from botbuilder.schema import Activity, ActivityTypes

from teams.adaptive_cards.adaptive_cards import AdaptiveCards
Expand Down Expand Up @@ -52,7 +53,7 @@ class Application(Bot, Generic[StateT]):
_ai: Optional[AI[StateT]]
_adaptive_card: AdaptiveCards[StateT]
_options: ApplicationOptions
_adapter: Optional[BotFrameworkAdapter] = None
_adapter: Optional[CloudAdapter] = None
_before_turn: List[RouteHandler[StateT]] = []
_after_turn: List[RouteHandler[StateT]] = []
_routes: List[Route[StateT]] = []
Expand Down Expand Up @@ -86,7 +87,7 @@ def __init__(self, options=ApplicationOptions()) -> None:
)

if options.auth:
self._adapter = BotFrameworkAdapter(options.auth)
self._adapter = CloudAdapter(options.auth)

@property
def ai(self) -> AI[StateT]:
Expand Down Expand Up @@ -353,7 +354,7 @@ async def process_activity(
"cannot call `app.process_activity` when `ApplicationOptions.adapter` not provided"
)

return await self._adapter.process_activity(activity, auth_header, self.on_turn)
return await self._adapter.process_activity(auth_header, activity, self.on_turn)

async def on_turn(self, context: TurnContext):
await self._start_long_running_call(context, self._on_turn)
Expand Down Expand Up @@ -454,6 +455,7 @@ async def _start_long_running_call(
return await self._adapter.continue_conversation(
reference=context.get_conversation_reference(context.activity),
callback=func,
bot_app_id=self.options.bot_app_id,
)

return await func(context)
Expand Down
5 changes: 3 additions & 2 deletions python/packages/ai/teams/app_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from logging import Logger
from typing import Optional

from botbuilder.core import BotFrameworkAdapterSettings, Storage
from botbuilder.core import Storage
from botbuilder.integration.aiohttp import ConfigurationBotFrameworkAuthentication

from teams.adaptive_cards import AdaptiveCardsOptions
from teams.ai import AIOptions
Expand All @@ -16,7 +17,7 @@

@dataclass
class ApplicationOptions:
auth: Optional[BotFrameworkAdapterSettings] = None
auth: Optional[ConfigurationBotFrameworkAuthentication] = None
"""
Optional. Bot auth settings.
If using the `long_running_messages` option or calling the `continue_conversation_async`
Expand Down
2,459 changes: 0 additions & 2,459 deletions python/samples/01.messaging.a.echoBot/poetry.lock

This file was deleted.

2 changes: 1 addition & 1 deletion python/samples/01.messaging.a.echoBot/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
from src.bot import config

if __name__ == "__main__":
uvicorn.run(api, port=config.port)
uvicorn.run(api, port=config.PORT)
10 changes: 4 additions & 6 deletions python/samples/01.messaging.a.echoBot/src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@
import sys
import traceback

from botbuilder.core import BotFrameworkAdapterSettings, TurnContext
from botbuilder.core import TurnContext
from botbuilder.integration.aiohttp import ConfigurationBotFrameworkAuthentication
from teams import Application, ApplicationOptions, TurnState

from src.config import Config

config = Config()
app = Application[TurnState](
ApplicationOptions(
bot_app_id=config.app_id,
auth=BotFrameworkAdapterSettings(
app_id=config.app_id,
app_password=config.app_password,
),
bot_app_id=config.APP_ID,
auth=ConfigurationBotFrameworkAuthentication(config),
)
)

Expand Down
6 changes: 3 additions & 3 deletions python/samples/01.messaging.a.echoBot/src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
class Config:
"""Bot Configuration"""

port = 3978
app_id = os.environ.get("MicrosoftAppId", "")
app_password = os.environ.get("MicrosoftAppPassword", "")
PORT = 3978
APP_ID = os.environ.get("MicrosoftAppId", "")
APP_PASSWORD = os.environ.get("MicrosoftAppPassword", "")
1 change: 0 additions & 1 deletion python/samples/01.messaging.a.echoBot/teamsapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
version: 1.0.0

environmentFolderPath: ./env
projectId: e0d4ae6a-30a2-4880-9ff5-c79587aefa66
8 changes: 3 additions & 5 deletions python/samples/03.adaptiveCards.a.typeAheadBot/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

import aiohttp
import uvicorn
from botbuilder.core import BotFrameworkAdapterSettings, MemoryStorage, TurnContext
from botbuilder.core import MemoryStorage, TurnContext
from botbuilder.integration.aiohttp import ConfigurationBotFrameworkAuthentication
from botbuilder.schema import Activity
from fastapi import FastAPI, Request, Response
from teams import Application, ApplicationOptions, Query, TurnState
Expand All @@ -21,10 +22,7 @@
storage = MemoryStorage()
app = Application[TurnState](
ApplicationOptions(
auth=BotFrameworkAdapterSettings(
app_id=Config.BOT_ID,
app_password=Config.BOT_PASSWORD,
),
auth=ConfigurationBotFrameworkAuthentication(Config),
storage=storage,
)
)
Expand Down
4 changes: 2 additions & 2 deletions python/samples/03.adaptiveCards.a.typeAheadBot/src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ class Config:
"""Bot Configuration"""

PORT = 3978
BOT_ID = os.environ["BOT_ID"]
BOT_PASSWORD = os.environ["BOT_PASSWORD"]
APP_ID = os.environ["BOT_ID"]
APP_PASSWORD = os.environ["BOT_PASSWORD"]
Loading