8000 Merge pull request #25 from stevengum97/stgum/johtaylo/adapter/ai · openvelora/botbuilder-python@19b0da4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 19b0da4

Browse files
authored
Merge pull request microsoft#25 from stevengum97/stgum/johtaylo/adapter/ai
add botbuilder-ai setup scripts, add typing references in activity_adapter, fix errors in QnAMaker
2 parents 43793aa + 2f570cb commit 19b0da4

File tree

13 files changed

+59
-20
lines changed

13 files changed

+59
-20
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__import__('pkg_resources').declare_namespace(__name__)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__import__('pkg_resources').declare_namespace(__name__)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# coding=utf-8
2+
#------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#------------------------------------------------------------------------
7+
8+
from .language_map import LanguageMap
9+
from .qna_maker import QnAMaker, QnAMakerOptions, MetaData, QueryResult, QueryResults
10+
11+
__all__ = ['LanguageMap',
12+
'QnAMaker',
13+
'QnAMakerOptions',
14+
'MetaData',
15+
'QueryResult',
16+
'QueryResults']

libraries/botbuilder-ai/microsoft/botbuilder/qna_maker.py renamed to libraries/botbuilder-ai/microsoft/bo 10000 tbuilder/ai/qna_maker.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ class QnAMaker:
1010

1111
def __init__(self, options, http_client):
1212

13-
self.__http_client = _http_client or raise TypeError('HTTP Client failed')
14-
self.__options = options or raise TypeError('Options config error')
13+
self.__http_client = _http_client or False
14+
if not self.__http_client:
15+
raise TypeError('HTTP Client failed')
16+
self.__options = options or False
17+
if not self.__options:
18+
raise TypeError('Options config error')
1519

1620
self.__answerUrl = "%s%s/generateanswer" % (__qnaMakerServiceEndpoint,options.knowledge_base_id)
1721

@@ -29,7 +33,7 @@ def __init__(self, options, http_client):
2933

3034
async def get_answers(question): # HTTP call
3135
headers = {
32-
__api_management_header : self.__options.subscription_key
36+
__api_management_header : self.__options.subscription_key,
3337
"Content-Type" : __json_mime_type
3438
}
3539

libraries/botbuilder-ai/requirements.txt

Whitespace-only changes.

libraries/botbuilder-ai/setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[bdist_wheel]
2+
universal=0

libraries/botbuilder-ai/setup.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from setuptools import setup, find_packages
2+
3+
setup(
4+
name='microsoft-botbuilder-ai',
5+
version='4.0.0-a0',
6+
url='https://www.github.com/Microsoft/botbuilder-python',
7+
long_description='Cognitive services extensions for Microsoft BotBuilder.',
8+
license='MIT',
9+
author='Microsoft',
10+
author_email='bf-reports@microsoft.com',
11+
description='',
12+
packages=find_packages(),
13+
classifiers=[
14+
'Programming Language :: Python',
15+
'Intended Audience :: Bot Developers',
16+
'License :: OSI Approved :: MIT License',
17+
'Operating System :: OS Independent',
18+
'Programming Language :: Python :: 3'
19+
]
20+
)

libraries/botbuilder/microsoft/botbuilder/__init__.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,13 @@
66
# --------------------------------------------------------------------------
77

88

9-
from .activity import ACTIVITY_TYPES, ATTACHMENT_LAYOUTS, END_OF_CONVERSATION_CODES, TEXT_FORMATS
109
from .activity_adapter import ActivityAdapter
11-
from .card_styler import CardStyler, ContentTypes
1210
from .assertions import BotAssert
11+
from .bot_framework_adapter import BotFrameworkAdapter
12+
from .card_styler import CardStyler, ContentTypes
1313

14-
__all__ = ['activity',
15-
'activity_adapter',
16-
'assertions',
17-
'card_styler',
18-
'ACTIVITY_TYPES',
19-
'ATTACHMENT_LAYOUTS',
20-
'END_OF_CONVERSATION_CODES',
21-
'TEXT_FORMATS',
22-
'ActivityAdapter',
14+
__all__ = ['ActivityAdapter',
15+
'BotAssert',
16+
'BotFrameworkAdapter',
2317
'CardStyler',
24-
'ContentTypes',
25-
'BotAssert']
26-
18+
'ContentTypes',]

libraries/botbuilder/microsoft/botbuilder/activity_adapter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Licensed under the MIT License.
33

44
from abc import ABC, abstractmethod
5+
from typing import List
6+
from microsoft.botbuilder.schema import Activity
57

68

79
class ActivityAdapter(ABC):

libraries/botbuilder/microsoft/botbuilder/bot_framework_adapter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from microsoft.botframework.connector.auth import (MicrosoftAppCredentials,
99
JwtTokenValidation, SimpleCredentialProvider)
1010

11+
from .activity_adapter import ActivityAdapter
1112

1213
class BotFrameworkAdapter(ActivityAdapter):
1314

libraries/botbuilder/microsoft/botbuilder/card_styler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# Licensed under the MIT License.
33

44

5-
import enum
5+
from enum import Enum
66
from copy import deepcopy
77

88

9-
class ContentTypes(enum):
9+
class ContentTypes(Enum):
1010
"""List of content types for each card style."""
1111
adaptive_card = 'application/vnd.microsoft.card.adaptive'
1212
animation_card = 'application/vnd.microsoft.card.animation'

samples/Echo.Connector.Bot.Adapter/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import json
66
import asyncio
77
from microsoft.botbuilder.schema import (Activity, ActivityTypes, ChannelAccount)
8-
from bot_framework_adapter import BotFrameworkAdapter
8+
from microsoft.botbuilder import BotFrameworkAdapter
99

1010
APP_ID = ''
1111
APP_PASSWORD = ''

0 commit comments

Comments
 (0)
0