Skip to content

Update Codespace with latest changes. #12

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 1 commit into from
Sep 5, 2024
Merged

Update Codespace with latest changes. #12

merged 1 commit into from
Sep 5, 2024

Conversation

brannon
Copy link
Contributor

@brannon brannon commented Sep 5, 2024

This PR includes the following changes:

  • Update to the latest azure-ai-inference beta release for Python. Update the sample to move away from deprecated types.
  • Add node_modules to .gitignore so the directory does not show up in git status.
  • Use the onCreateCommand devcontainer lifecycle event to reduce Codespace startup time.

@brannon brannon merged commit 62261f9 into main Sep 5, 2024
@brannon brannon deleted the update_codespace branch September 5, 2024 20:21
@aaafhjb
Copy link

aaafhjb commented Nov 18, 2024

From 40c9e54 Mon Sep 17 00:00:00 2001
From: Brannon Jones brannon@iterator.net
Date: Wed, 4 Sep 2024 16:55:00 -0600
Subject: [PATCH] Update Codespace with latest changes.


.devcontainer/bootstrap | 4 ++++
.devcontainer/devcontainer.json | 3 +--
.gitignore | 1 +
requirements.txt | 2 +-
samples/python/azure_ai_inference/tools.py | 8 ++++----
5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/.devcontainer/bootstrap b/.devcontainer/bootstrap
index 0651f3c..db72c7d 100755
--- a/.devcontainer/bootstrap
+++ b/.devcontainer/bootstrap
@@ -1,4 +1,8 @@
#!/bin/bash
+#
+# This script runs during the container prebuild step and is used to cache dependencies
+# and other artifacts that are not expected to change frequently.
+#

ROOT_DIR=/workspaces/codespaces-models

diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index c166428..6cbdc7c 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -37,8 +37,7 @@
],
"remoteUser": "codespace",
"containerUser": "codespace",

  • "updateContentCommand": "${containerWorkspaceFolder}/.devcontainer/bootstrap",
  • "postStartCommand": "${containerWorkspaceFolder}/.devcontainer/bootstrap",
  • "onCreateCommand": "${containerWorkspaceFolder}/.devcontainer/bootstrap",
    "customizations": {
    "codespaces": {
    "disableAutomaticConfiguration": true,
    diff --git a/.gitignore b/.gitignore
    index 1cbb59b..d456b41 100644
    --- a/.gitignore
    +++ b/.gitignore
    @@ -11,3 +11,4 @@ cookbooks/python/openai/data/hotel_invoices/transformed_invoice_json/*
    cookbooks/python/openai/data/hotel_invoices/extracted_invoice_json/*
    cookbooks/python/openai/data/hotel_invoices/hotel_DB.db
    cookbooks/python/openai/hallucination_results.csv
    +node_modules/
    \ No newline at end of file
    diff --git a/requirements.txt b/requirements.txt
    index c66a430..cbd0b9e 100644
    --- a/requirements.txt
    +++ b/requirements.txt
    @@ -1,4 +1,4 @@
    -azure-ai-inference~=1.0.0b3
    +azure-ai-inference~=1.0.0b4
    openai~=1.37.1
    mistralai~=0.4.2
    python-dotenv~=1.0.1
    diff --git a/samples/python/azure_ai_inference/tools.py b/samples/python/azure_ai_inference/tools.py
    index c71566f..bfed29b 100644
    --- a/samples/python/azure_ai_inference/tools.py
    +++ b/samples/python/azure_ai_inference/tools.py
    @@ -7,8 +7,8 @@
    from azure.ai.inference import ChatCompletionsClient
    from azure.ai.inference.models import (
    AssistantMessage,
  • ChatCompletionsFunctionToolCall,
  • ChatCompletionsFunctionToolDefinition,
  • ChatCompletionsToolCall,
  • ChatCompletionsToolDefinition,
    CompletionsFinishReason,
    FunctionDefinition,
    SystemMessage,
    @@ -49,7 +49,7 @@ def get_flight_info(origin_city: str, destination_city: str):
    )
    return json.dump({"error": "No flights found between the cities"})

-flight_info = ChatCompletionsFunctionToolDefinition(
+flight_info = ChatCompletionsToolDefinition(
function=FunctionDefinition(
name="get_flight_info",
description="""Returns information about the next flight between two cities.
@@ -97,7 +97,7 @@ def get_flight_info(origin_city: str, destination_city: str):

     tool_call = response.choices[0].message.tool_calls[0]
  •    if isinstance(tool_call, ChatCompletionsFunctionToolCall):
    
  •    if isinstance(tool_call, ChatCompletionsToolCall):
    
           function_args = json.loads(tool_call.function.arguments.replace("'", '"'))
           print(
    

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants