Skip to content
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

Issue: OpenAIRealtimeBetaLLMService#0 exception: 'NoneType' object has no attribute 'add_user_content_item_as_message' #842

Open
XavierGeerinck opened this issue Dec 12, 2024 · 1 comment

Comments

@XavierGeerinck
Copy link

Description

Environment

  • pipecat-ai version: 0.50.0
  • python version: 3.12
  • OS: Mac

Issue

Receiving an issue in the latest Pipecat with an OpenAIRealtimeBeta service configured:

OpenAIRealtimeBetaLLMService#0 exception: 'NoneType' object has no attribute 'add_user_content_item_as_message'

Not to deep into the codebase yet, but I guess it's somewhere here where context is None?

image

@anthony2261
Copy link

anthony2261 commented Jan 1, 2025

Getting the same error myself, with pipecat v0.0.52. A bit about my setup:

transport = DailyTransport(...)

session_properties = SessionProperties(
    input_audio_transcription=InputAudioTranscription(),
    turn_detection=TurnDetection(silence_duration_ms=1000),
)

llm = OpenAIRealtimeBetaLLMService(
    api_key=os.getenv("OPENAI_API_KEY"), session_properties=session_properties
)

messages = [ ... ]  # initial context
context = OpenAILLMContext(messages)
context_aggregator = llm.create_context_aggregator(context)

# Add transcription processor
transcript = TranscriptProcessor()
transcript_handler = TranscriptHandler()  # Taken from the 28a-transcription-processor-openai.py example

# Register event handler for transcript updates
@transcript.event_handler("on_transcript_update")
async def on_transcript_update(processor, frame):
    await transcript_handler.on_transcript_update(processor, frame)

# Update pipeline to use transcript processor
pipeline = Pipeline(
    [
        transport.input(),
        transcript.user(),  # User transcripts
        context_aggregator.user(),
        llm,
        transport.output(),
        context_aggregator.assistant(),
        transcript.assistant(),  # Assistant transcripts
    ]
)

# Create and configure the pipeline
task = PipelineTask(
    pipeline,
    PipelineParams(
        allow_interruptions=True,
        enable_metrics=True,
    ),
)

runner = PipelineRunner()
await runner.run(task)

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

No branches or pull requests

2 participants