8000 add botbuilder-ai setup scripts, add typing references in activity_adapter, fix errors in QnAMaker by stevengum · Pull Request #25 · microsoft/botbuilder-python · GitHub
[go: up one dir, main page]

Skip to content

add botbuilder-ai setup scripts, add typing references in activity_adapter, fix errors in QnAMaker #25

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

Merged
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
1 change: 1 addition & 0 deletions libraries/botbuilder-ai/microsoft/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
1 change: 1 addition & 0 deletions libraries/botbuilder-ai/microsoft/botbuilder/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
16 changes: 16 additions & 0 deletions libraries/botbuilder-ai/microsoft/botbuilder/ai/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# coding=utf-8
#------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#------------------------------------------------------------------------

from .language_map import LanguageMap
from .qna_maker import QnAMaker, QnAMakerOptions, MetaData, QueryResult, QueryResults

__all__ = ['LanguageMap',
'QnAMaker',
'QnAMakerOptions',
'MetaData',
'QueryResult',
'QueryResults']
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ class QnAMaker:

def __init__(self, options, http_client):

self.__http_client = _http_client or raise TypeError('HTTP Client failed')
self.__options = options or raise TypeError('Options config error')
self.__http_client = _http_client or False
if not self.__http_client:
raise TypeError('HTTP Client failed')
self.__options = options or False
if not self.__options:
raise TypeError('Options config error')

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

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

async def get_answers(question): # HTTP call
headers = {
__api_management_header : self.__options.subscription_key
__api_management_header : self.__options.subscription_key,
"Content-Type" : __json_mime_type
}

Expand Down
Empty file.
2 changes: 2 additions & 0 deletions libraries/botbuilder-ai/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal=0
20 changes: 20 additions & 0 deletions libraries/botbuilder-ai/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from setuptools import setup, find_packages

setup(
name='microsoft-botbuilder-ai',
version='4.0.0-a0',
url='https://www.github.com/Microsoft/botbuilder-python',
long_description='Cognitive services extensions for Microsoft BotBuilder.',
license='MIT',
author='Microsoft',
author_email='bf-reports@microsoft.com',
description='',
packages=find_packages(),
classifiers=[
'Programming Language :: Python',
'Intended Audience :: Bot Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3'
]
)
20 changes: 6 additions & 14 deletions libraries/botbuilder/microsoft/botbuilder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,13 @@
# --------------------------------------------------------------------------


from .activity import ACTIVITY_TYPES, ATTACHMENT_LAYOUTS, END_OF_CONVERSATION_CODES, TEXT_FORMATS
from .activity_adapter import ActivityAdapter
from .card_styler import CardStyler, ContentTypes
from .assertions import BotAssert
from .bot_framework_adapter import BotFrameworkAdapter
from .card_styler import CardStyler, ContentTypes

__all__ = ['activity',
'activity_adapter',
'assertions',
'card_styler',
'ACTIVITY_TYPES',
'ATTACHMENT_LAYOUTS',
'END_OF_CONVERSATION_CODES',
'TEXT_FORMATS',
'ActivityAdapter',
__all__ = ['ActivityAdapter',
'BotAssert',
'BotFrameworkAdapter',
'CardStyler',
'ContentTypes',
'BotAssert']

'ContentTypes',]
2 changes: 2 additions & 0 deletions libraries/botbuilder/microsoft/botbuilder/activity_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Licensed under the MIT License.

from abc import ABC, abstractmethod
from typing import List
from microsoft.botbuilder.schema import Activity


class ActivityAdapter(ABC):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from microsoft.botframework.connector.auth import (MicrosoftAppCredentials,
JwtTokenValidation, SimpleCredentialProvider)

from .activity_adapter import ActivityAdapter

class BotFrameworkAdapter(ActivityAdapter):

Expand Down
4 changes: 2 additions & 2 deletions libraries/botbuilder/microsoft/botbuilder/card_styler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# Licensed under the MIT License.


import enum
from enum import Enum
from copy import deepcopy


class ContentTypes(enum):
class ContentTypes(Enum):
"""List of content types for each card style."""
adaptive_card = 'application/vnd.microsoft.card.adaptive'
animation_card = 'application/vnd.microsoft.card.animation'
Expand Down
2 changes: 1 addition & 1 deletion samples/Echo.Connector.Bot.Adapter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import json
import asyncio
from microsoft.botbuilder.schema import (Activity, ActivityTypes, ChannelAccount)
from bot_framework_adapter import BotFrameworkAdapter
from microsoft.botbuilder import BotFrameworkAdapter

APP_ID = ''
APP_PASSWORD = ''
Expand Down
0