This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies | |
| where type == "az.ai.agents" | |
| where isnotnull(customDimensions["gen_ai.usage.input_tokens"]) | |
| order by timestamp desc | |
| project | |
timestamp | |
,target | |
,duration | |
,agent_id = customDimensions["gen_ai.agent.id"] | |
,thread_id = customDimensions["gen_ai.thread.id"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_hypo_answer(self, question: str) -> str: | |
""" | |
HyDE(仮説的文書埋め込み)のためにクエリ(質問)に対する仮説的回答を生成します。 | |
Args: | |
question (str): 仮説的回答を生成するためのクエリ(質問) | |
Returns: | |
str: 生成された仮説的回答 | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install azure-ai-formrecognizer==3.3.0 | |
import json | |
from azure.core.credentials import AzureKeyCredential | |
from azure.ai.formrecognizer import DocumentAnalysisClient | |
# Azure Document Intelligence のエンドポイントとキーを設定 | |
endpoint = "https://xxx.cognitiveservices.azure.com/" | |
key = "" | |
# 処理対象の PDF ファイルのパスを設定 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from promptflow.core import Prompty | |
from promptflow.contracts.multimedia import PFBytes | |
image_urls = [ | |
"画像にアクセスすることができるURL(SAS付きURLとか)", | |
] | |
images = [PFBytes(bytes(image_url, "utf-8"), "image/jpeg", source_url=image_url) for image_url in image_urls] | |
image_paths = [str(image) for image in images] | |
f = Prompty.load(source="sample.prompty") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
import requests | |
class ImageEmbeddingsClient: | |
def __init__(self, computer_vision_endpoint: str = None, computer_vision_key: str = None,): | |
self.endpoint = computer_vision_endpoint if computer_vision_endpoint else os.getenv("AZURE_COMPUTER_VISION_ENDPOINT") | |
self.key = computer_vision_key if computer_vision_key else os.getenv("AZURE_COMPUTER_VISION_KEY") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from utilities.parallel_embeddings import ParallelEmbeddingsClient | |
client = ParallelEmbeddingsClient("embeddings_config.json") | |
texts = [ f"埋め込みを取得する対象のテキスト" for i in range(0, 10) ] | |
embeds = client.get_embeds(texts) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://learn.microsoft.com/ja-jp/rest/api/searchservice/test-analyzer | |
import os, sys, json, requests | |
search_name = os.environ["AZURE_SEARCH_NAME"] | |
index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] | |
api_key = os.environ["AZURE_SEARCH_KEY"] | |
api_version = "2020-06-30" | |
target_analyzer_name = "ja.microsoft" | |
target_analyze_text = "Azure AI Search は、従来の会話型検索アプリケーションのユーザー所有コンテンツに対して、安全な情報取得を大規模に提供します。" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dotnet add package Azure.Search.Documents | |
using Azure; | |
using Azure.Search.Documents; | |
using Azure.Search.Documents.Indexes; | |
using Azure.Search.Documents.Indexes.Models; | |
using Azure.Search.Documents.Models; | |
namespace SearchIndexCreator | |
{ | |
class CognitiveSearchClient |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" | |
content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1.0, user-scalable=no"> | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"> | |
<style> | |
* { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dotnet add package Microsoft.CognitiveServices.Speech --version 1.33.0 | |
// dotnet add package NAudio --version 2.2.1 | |
using Microsoft.CognitiveServices.Speech; | |
using Microsoft.CognitiveServices.Speech.Audio; | |
using NAudio.CoreAudioApi; | |
namespace RealtimeAudioRecognitionByAzure | |
{ | |
class Program | |
{ |
NewerOlder