Giter Site home page Giter Site logo

azure / azure-openai-samples Goto Github PK

View Code? Open in Web Editor NEW
504.0 16.0 340.0 117.83 MB

Azure OpenAI Samples is a collection of code samples illustrating how to use Azure Open AI in creating AI solution for various use cases across industries. This repository is mained by a community of volunters. We welcomed your contributions.

License: MIT License

Jupyter Notebook 100.00%
azure openai

azure-openai-samples's Introduction

GPT Fundamentals, Use Cases and Sample Solutions

This repository contains resources to help you understand how to use GPT (Generative Pre-trained Transformer) offered by Azure OpenAI at the fundamental level, explore sample end-to-end solutions, and learn about various use cases.

What is GPT?

GPT (Generative Pre-trained Transformer) is a Large Language Model (LLM) developed by OpenAI. It is a deep learning model based on the Transformer architecture. For more information, refer to OpenAI.

Resources

The following resources are available in this repository:

  • Quick Start: A collection of notebooks where you can quickly start with using GPT.

  • Fundamentals: A collection of notebooks illustrating fundamental usage of GPT.

  • Use Cases: A collection of notebooks illustrating examples on how to use GPT in various applications, such as chatbots, customer service, and content generation etc.

  • Sample Solutions: End-to-end solutions for various NLP tasks, such as question answering, text summarization, and sentiment analysis etc, in context of business applications specific to various industries, where GPT is part of the solution. Require contributions!

  • Serverless SQL GPT - Natural language processing (NLP) with GPT in Azure Synapse Analytics Serverless SQL using Azure Machine Learning.

GPT Version

As of now, the samples here are based on GPT 3.5. We will update accordingly when the GPT-4 is widely accessible.

Set Up

To use sample codes in this repo, we suggest you setup .env file where you store key informations for Azure services. See .env.sample file for example.

Contributing

We welcome contributions to this repository. If you have any ideas or suggestions, please feel free to open an issue or submit a pull request.

As technologies changes very fast, we endevour to keep this repository updated as quick as possible. However, this is heavily rely on keen community contributors to make this happen.

Solution Accelerators

Relevant Repositories

azure-openai-samples's People

Contributors

7effrey89 avatar aldelar avatar andreaskopp avatar aschauhan22 avatar balakreshnan avatar ketanvh avatar louis-li avatar mfurak avatar michalmar avatar microsoft-github-operations[bot] avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar msavita-cloud avatar ryubidragonfire avatar tirtho avatar vitaled avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-openai-samples's Issues

Train OpenAi on specific public Code Repos in GitHub?

I was wondering if it was possible to use Azure OpenAI services, and train it on a specific GitHub repo (public and free to use etc) so when you prompt it, it uses the information it knows about that code base to answer you and give you code snippets.

For example, if I was to train it on the source code of a UI Library, then I could ask it to build a Page, using what it knows about that UI library etc. And it would be perfectly accurate because it knows exactly how the UI Library code works etc.

Updates needed due to retirement of older models

According to this announcement, some of the Azure OpenAI Service Models are set to be retired/replaced. For new Azure OpenAI Service deployments, the retiring models are no longer available.

https://techcommunity.microsoft.com/t5/azure-ai-services-blog/announcing-updates-to-azure-openai-service-models/ba-p/3866757

The older models are referenced in the .env.sample and an example of where these could be updated in a notebook is here: https://github.com/Azure/azure-openai-samples/blob/main/fundamentals/langchain/01_query_based_search_with_cognitive_search.ipynb

A workaround until the variables can be merged might be to set the .env variables (FYI haven't tested this).
from:

DOCUMENT_MODEL_NAME=curie-search-doc
QUERY_MODEL_NAME=curie-query-doc
DEPLOYMENT_NAME=text-davinci-003
COMPLETIONS_MODEL=text-davinci-002

to

DOCUMENT_MODEL_NAME=text-embedding-ada-002
QUERY_MODEL_NAME=text-embedding-ada-002
DEPLOYMENT_NAME=gpt-35-turbo-instruct
COMPLETIONS_MODEL=gpt-35-turbo-instruct

Issue fundamentals/langchain/03_semantic_search_redis.ipynb

Hello
azure-openai-samples/fundamentals/langchain/03_semantic_search_redis.ipynb Below is the script that I have executed and getting a below error message.

**from AzureOpenAIUtil.Embedding import DocumentEmbedding
import os
from dotenv import load_dotenv
load_dotenv()

doc_emb = DocumentEmbedding(document_embedding_deployment_name=os.getenv('DOCUMENT_MODEL_NAME'),
query_embedding_deployment_name=os.getenv('QUERY_MODEL_NAME'),
summerization_deployment_name=os.getenv('DEPLOYMENT_NAME'))
doc_emb.load_documents('data/extracted/')**
Error

APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host='myopenairesource2.openai.azure.com', port=443): Max retries exceeded with url: //openai/deployments/curie-search-doc/embeddings?api-version=2022-12-01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))....

Script Error in azure-openai-samples/fundamentals/document_analysis/03-classify-documents.ipynb

Hello
azure-openai-samples/fundamentals/document_analysis/ 03-classify-documents.ipynb Below is the script that I have executed and getting an below error message.
**Error: **
NotFittedError: need to call fit or load_model beforehand,
Though I have called fit/Load functions still getting an exception, could you please take a look and do the needful. Thanks

Below is the script.

import xgboost as xgb
from xgboost import XGBClassifier
import pickle

TRAIN = False
LOAD = True

filename for trained model

fname = ('../output/models/xgb.pkl')

if TRAIN:
# create model instance
xgb = XGBClassifier(n_estimators=100, max_depth=5, learning_rate=1, objective='multi:softprob')
# fit model
xgb.fit(X_train, y_train)

# save the model to disk
with open(fname, "wb") as f:
    pickle.dump(xgb, f)

load the model from disk

if LOAD:
with open(fname, "rb") as f:
xgb= pickle.load(f)

predict

preds = xgb.predict(X_test)
probas = xgb.predict_proba(X_test)

report

report = classification_report(y_test, preds)
print(report)

chat log

Hi
Is there a chat log / transcript (i.e. history of the old conversations) generated by the application ?
If not, what is the best way to generate such a log file this, within azure environment?
Thanks in advance.

Sample Contribution for ChatGPT with Enterprise Data

I've made a sample for ChatGPT with Enterprise Data. It leverage LangChain and Azure OpenAI GPT4/ChatGPT, with support for PDF/DOCX/PPTX/TXT.

I would like to contribute to this repo, how should I proceed?
Thanks!

Script Error in azure-openai-samples/use_cases/movie_reviews/notebooks/01-get-embeddings.ipynb

Hello
azure-openai-samples/use_cases/movie_reviews/notebooks/01-get-embeddings.ipynb Below is the script that I have executed and getting a below error message.

Error:
AttributeError: module 'asyncio' has no attribute 'coroutine'
Could you please take a look and do the needful Thanks.

Below is the script.
from ratelimiter import RateLimiter

@ratelimiter(max_calls=50, period=60) # Published limit is 120 requests per minute, at the time of development, only 50 requests per minute is possible.
def request_api(df, deployment_id, i):
try:
input = 'Movie title: ' + df['Movie'][i] + '\n' + df['Review'][i]
embedding = openai.Embedding.create(input=input, deployment_id=deployment_id)
df['embedding'].iloc[i] = embedding['data'][0]['embedding']
except Exception as err:
print(i)
print(f"Unexpected {err=}, {type(err)=}")

image

code-davinci-002 model issue in Azure AI Studio

In the Azure Completions playground, while selecting the model code-davinci-002, the scrollbar on the right side automatically scrolls down rapidly, regardless of the input in the prompt text field. This makes it impossible to click the generated button.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.