Skip to content
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
4 changes: 2 additions & 2 deletions chained_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions chat_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
client = openai.AsyncOpenAI(base_url=os.environ["OLLAMA_ENDPOINT"], api_key="nokeyneeded")
MODEL_NAME = os.environ["OLLAMA_MODEL"]
elif API_HOST == "github":
client = openai.AsyncOpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.AsyncOpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")
else:
client = openai.AsyncOpenAI(api_key=os.environ["OPENAI_KEY"])
MODEL_NAME = os.environ["OPENAI_MODEL"]
Expand Down
4 changes: 2 additions & 2 deletions chat_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
client = openai.OpenAI(base_url=os.environ["OLLAMA_ENDPOINT"], api_key="nokeyneeded")
MODEL_NAME = os.environ["OLLAMA_MODEL"]
elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")
else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
MODEL_NAME = os.environ["OPENAI_MODEL"]
Expand Down
4 changes: 2 additions & 2 deletions chat_history_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
client = openai.OpenAI(base_url=os.environ["OLLAMA_ENDPOINT"], api_key="nokeyneeded")
MODEL_NAME = os.environ["OLLAMA_MODEL"]
elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")
else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
MODEL_NAME = os.environ["OPENAI_MODEL"]
Expand Down
4 changes: 2 additions & 2 deletions chat_langchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
)
elif API_HOST == "github":
llm = ChatOpenAI(
model_name=os.getenv("GITHUB_MODEL", "gpt-4o"),
openai_api_base="https://models.inference.ai.azure.com",
model_name=os.getenv("GITHUB_MODEL", "openai/gpt-4o"),
openai_api_base="https://models.github.ai/inference",
openai_api_key=os.environ["GITHUB_TOKEN"],
)
else:
Expand Down
4 changes: 2 additions & 2 deletions chat_llamaindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
)
elif API_HOST == "github":
llm = OpenAILike(
model=os.getenv("GITHUB_MODEL", "gpt-4o"),
api_base="https://models.inference.ai.azure.com",
model=os.getenv("GITHUB_MODEL", "openai/gpt-4o"),
api_base="https://models.github.ai/inference",
api_key=os.environ["GITHUB_TOKEN"],
is_chat_model=True,
)
Expand Down
17 changes: 8 additions & 9 deletions chat_pydanticai.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import azure.identity
from dotenv import load_dotenv
from openai import AsyncAzureOpenAI
from openai import AsyncAzureOpenAI, AsyncOpenAI
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIModel
from pydantic_ai.providers.openai import OpenAIProvider

# Setup the OpenAI client to use either Azure, OpenAI.com, or Ollama API
load_dotenv(override=True)
Expand All @@ -21,16 +22,14 @@
)
model = OpenAIModel(os.environ["AZURE_OPENAI_DEPLOYMENT"], openai_client=client)
elif API_HOST == "ollama":
model = OpenAIModel(os.environ["OLLAMA_MODEL"], api_key="fake", base_url=os.environ["OLLAMA_ENDPOINT"])
client = AsyncOpenAI(base_url=os.environ["OLLAMA_ENDPOINT"], api_key="fake")
model = OpenAIModel(os.environ["OLLAMA_MODEL"], provider=OpenAIProvider(openai_client=client))
elif API_HOST == "github":
model = OpenAIModel(
os.getenv("GITHUB_MODEL", "gpt-4o"),
api_key=os.environ["GITHUB_TOKEN"],
base_url="https://models.inference.ai.azure.com",
)

client = AsyncOpenAI(api_key=os.environ["GITHUB_TOKEN"], base_url="https://models.github.ai/inference")
model = OpenAIModel(os.getenv("GITHUB_MODEL", "openai/gpt-4o"), provider=OpenAIProvider(openai_client=client))
else:
model = OpenAIModel(os.environ["OPENAI_MODEL"], api_key=os.environ["OPENAI_KEY"])
client = AsyncOpenAI(api_key=os.environ["OPENAI_KEY"])
model = OpenAIModel(os.environ["OPENAI_MODEL"], provider=OpenAIProvider(openai_client=client))


agent = Agent(model, system_prompt="You are a helpful assistant that makes lots of cat references and uses emojis.")
Expand Down
4 changes: 2 additions & 2 deletions chat_safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
client = openai.OpenAI(base_url=os.environ["OLLAMA_ENDPOINT"], api_key="nokeyneeded")
MODEL_NAME = os.environ["OLLAMA_MODEL"]
elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")
else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
MODEL_NAME = os.environ["OPENAI_MODEL"]
Expand Down
4 changes: 2 additions & 2 deletions chat_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
client = openai.OpenAI(base_url=os.environ["OLLAMA_ENDPOINT"], api_key="nokeyneeded")
MODEL_NAME = os.environ["OLLAMA_MODEL"]
elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")
else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
MODEL_NAME = os.environ["OPENAI_MODEL"]
Expand Down
4 changes: 2 additions & 2 deletions few_shot_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions function_calling_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions function_calling_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions function_calling_extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions function_calling_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions prompt_engineering.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions rag_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions rag_documents_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions rag_documents_hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions rag_documents_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions rag_multiturn.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions rag_queryrewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions retrieval_augmented_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions spanish/chained_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions spanish/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
4 changes: 2 additions & 2 deletions spanish/chat_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
client = openai.AsyncOpenAI(base_url=os.environ["OLLAMA_ENDPOINT"], api_key="nokeyneeded")
MODEL_NAME = os.environ["OLLAMA_MODEL"]
elif API_HOST == "github":
client = openai.AsyncOpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.AsyncOpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")
else:
client = openai.AsyncOpenAI(api_key=os.environ["OPENAI_KEY"])
MODEL_NAME = os.environ["OPENAI_MODEL"]
Expand Down
4 changes: 2 additions & 2 deletions spanish/chat_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
client = openai.OpenAI(base_url=os.environ["OLLAMA_ENDPOINT"], api_key="nokeyneeded")
MODEL_NAME = os.environ["OLLAMA_MODEL"]
elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")
else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
MODEL_NAME = os.environ["OPENAI_MODEL"]
Expand Down
4 changes: 2 additions & 2 deletions spanish/chat_history_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
client = openai.OpenAI(base_url=os.environ["OLLAMA_ENDPOINT"], api_key="nokeyneeded")
MODEL_NAME = os.environ["OLLAMA_MODEL"]
elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")
else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
MODEL_NAME = os.environ["OPENAI_MODEL"]
Expand Down
4 changes: 2 additions & 2 deletions spanish/chat_langchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
)
elif API_HOST == "github":
llm = ChatOpenAI(
model_name=os.getenv("GITHUB_MODEL", "gpt-4o"),
openai_api_base="https://models.inference.ai.azure.com",
model_name=os.getenv("GITHUB_MODEL", "openai/gpt-4o"),
openai_api_base="https://models.github.ai/inference",
openai_api_key=os.environ["GITHUB_TOKEN"],
)
else:
Expand Down
4 changes: 2 additions & 2 deletions spanish/chat_llamaindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
)
elif API_HOST == "github":
llm = OpenAILike(
model=os.getenv("GITHUB_MODEL", "gpt-4o"),
api_base="https://models.inference.ai.azure.com",
model=os.getenv("GITHUB_MODEL", "openai/gpt-4o"),
api_base="https://models.github.ai/inference",
api_key=os.environ["GITHUB_TOKEN"],
is_chat_model=True,
)
Expand Down
4 changes: 2 additions & 2 deletions spanish/chat_pydanticai.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
model = OpenAIModel(os.environ["OLLAMA_MODEL"], api_key="fake", base_url=os.environ["OLLAMA_ENDPOINT"])
elif API_HOST == "github":
model = OpenAIModel(
os.getenv("GITHUB_MODEL", "gpt-4o"),
os.getenv("GITHUB_MODEL", "openai/gpt-4o"),
api_key=os.environ["GITHUB_TOKEN"],
base_url="https://models.inference.ai.azure.com",
base_url="https://models.github.ai/inference",
)

else:
Expand Down
4 changes: 2 additions & 2 deletions spanish/chat_safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
client = openai.OpenAI(base_url=os.environ["OLLAMA_ENDPOINT"], api_key="nokeyneeded")
MODEL_NAME = os.environ["OLLAMA_MODEL"]
elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")
else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
MODEL_NAME = os.environ["OPENAI_MODEL"]
Expand Down
4 changes: 2 additions & 2 deletions spanish/chat_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
client = openai.OpenAI(base_url=os.environ["OLLAMA_ENDPOINT"], api_key="nokeyneeded")
MODEL_NAME = os.environ["OLLAMA_MODEL"]
elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")
else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
MODEL_NAME = os.environ["OPENAI_MODEL"]
Expand Down
4 changes: 2 additions & 2 deletions spanish/few_shot_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
MODEL_NAME = os.environ["OLLAMA_MODEL"]

elif API_HOST == "github":
client = openai.OpenAI(base_url="https://models.inference.ai.azure.com", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "gpt-4o")
client = openai.OpenAI(base_url="https://models.github.ai/inference", api_key=os.environ["GITHUB_TOKEN"])
MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

else:
client = openai.OpenAI(api_key=os.environ["OPENAI_KEY"])
Expand Down
Loading