Skip to content

Commit c97c0be

Browse files
authored
Merge pull request #55 from mainframecomputer/sayak/mfe-442-add-model-providers-to-bt-logging
feat: add model providers to Braintrust logging
2 parents cae9bb7 + 8263c6a commit c97c0be

File tree

1 file changed

+9
-6
lines changed
  • packages/python/src/mainframe_orchestra

1 file changed

+9
-6
lines changed

packages/python/src/mainframe_orchestra/llm.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,9 +627,9 @@ async def send_openrouter_request(
627627
spinner.start()
628628

629629
try:
630-
client = AsyncOpenAI(
630+
client = wrap_openai(AsyncOpenAI(
631631
base_url="https://openrouter.ai/api/v1", api_key=config.OPENROUTER_API_KEY
632-
)
632+
))
633633
if not client.api_key:
634634
raise ValueError("OpenRouter API key not found in environment variables.")
635635

@@ -952,7 +952,10 @@ async def send_groq_request(
952952

953953
try:
954954
api_key = config.validate_api_key("GROQ_API_KEY")
955-
client = Groq(api_key=api_key)
955+
client = wrap_openai(OpenAI(
956+
base_url="https://api.groq.com/openai/v1",
957+
api_key=api_key
958+
))
956959
if not client.api_key:
957960
raise ValueError("Groq API key not found in environment variables.")
958961

@@ -1072,7 +1075,7 @@ async def send_together_request(
10721075

10731076
try:
10741077
api_key = config.validate_api_key("TOGETHERAI_API_KEY")
1075-
client = OpenAI(api_key=api_key, base_url="https://api.together.xyz/v1")
1078+
client = wrap_openai(OpenAI(api_key=api_key, base_url="https://api.together.xyz/v1"))
10761079

10771080
# Process images if present
10781081
if image_data:
@@ -1426,10 +1429,10 @@ async def send_deepseek_request(
14261429
raise ValueError("DeepSeek API key not found in environment variables.")
14271430

14281431
# Create an AsyncOpenAI client
1429-
client = AsyncOpenAI(
1432+
client = wrap_openai(AsyncOpenAI(
14301433
api_key=api_key,
14311434
base_url="https://api.deepseek.com/v1",
1432-
)
1435+
))
14331436

14341437
# Warn if image data was provided
14351438
if image_data:

0 commit comments

Comments
 (0)