Skip to content

Would openai-responses-python work with langchain_openai? #58

Closed
@ffreemt

Description

@ffreemt

Hello.

Maybe it's a silly question but I had a hard time trying pytest with langchain_openai. Can your lib work with langchain_openai with some tweaking? Thanks.

I ran a quick test.

import langchain_openai as openai

import openai_responses


@openai_responses.mock()
def test_create_assistant():
    client = openai.Client(api_key="sk-fake123")

    assistant = client.beta.assistants.create(
        instructions="You are a personal math tutor.",
        name="Math Tutor",
        tools=[{"type": "code_interpreter"}],
        model="gpt-4-turbo",
    )

    assert assistant.name == "Math Tutor"

I tried this (replacing openai with langchain_openai), but got

AttributeError: module 'langchain_openai' has no attribute 'Client'

when running test_create_assistant(), probably for an obvious reason.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentatione0 🌵Low efforti0 🌵Low impactquestionFurther information is requested

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions