danielmiessler / fabric

fabric is an open-source framework for augmenting humans using AI. It provides a modular framework for solving specific problems using a crowdsourced set of AI prompts that can be used anywhere.
https://danielmiessler.com/p/fabric-origin-story
MIT License
25.73k stars 2.73k forks source link

[Bug]: Using Claude Sonnet yt --transcript error 400 "invalid_request_error - all messages must have non-empty content except for the optional final assistant message" #295

Closed raisindetre closed 8 months ago

raisindetre commented 8 months ago

What happened?

Using Git commit 2b5e74 (2024-03-22 10:34:53):

Running yt --transcript https://www.youtube.com/watch?v=13pnH_8cBUM&t=198s | fabric --pattern create_interview_summary --model claude-3-sonnet-20240229generates:

[1] 30222 Error: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages: all messages must have non-empty content except for the optional final assistant message'}} Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages: all messages must have non-empty content except for the optional final assistant message'}}

This is followed by the text of the transcript.

Trying to redirect the output to file results in an empty file:

yt --transcript https://www.youtube.com/watch?v=13pnH_8cBUM&t=198s > file.txt
cat file.txt 

(Empty)

Version check

Relevant log output

No response

Relevant screenshots (optional)

No response

danielmiessler commented 8 months ago

That video might not have had a transcript. Check back later and sometimes it takes a while for them to add it.

randoassuser commented 7 months ago

@danielmiessler I am facing the same issue when using Claude Models. It works using gpt-4 and there is a transcript. I suspect that fabric is not giving the yt transcript through when using claude3. The claude opus model only generates a response when I add the parameter --text '' and bases it's response only on that, not the transscript, heck not even the fabric prompt as it looks like. I am so confused and wonder what I did wrong.

Additionally, it did create the output file without content, as to where gpt-4 correctly put it's output to file. What have I done wrong?

First I tried: pt https://www.youtube.com/watch?v=8MIIeIa25tE&t=13s | fabric --stream --pattern extract_wisdom --output 'claudeOpusOutput.md' [1] 92815 Error: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.0: all messages must have non-empty content except for the optional final assistant message'}} Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.0: all messages must have non-empty content except for the optional final assistant message'}}

after this not working I tried the following because it looked like the --text param is required. However it seems to only look at what --text is saying. When giving instructions to summarize for getting into Cybersecurity (example topic) via --text the model responds with basic instructions, but nothing based off of the transcript or the fabric prompt.

[olli@tower extract_wisdom]$ pt https://www.youtube.com/watch?v=8MIIeIa25tE&t=13s | fabric --pattern extract_wisdom --text 'Add a seperate section putting the information into perspective and context for an hobbyist level rookie just getting started into Cybersecurity space' --output 'claudeOpusOutput.md'
[1] 93617

Here is the information put into perspective and context for a hobbyist level rookie just getting started in the cybersecurity space:

CYBERSECURITY CONTEXT FOR BEGINNERS

As someone new to cybersecurity, it's important to understand some key fundamentals:

- Cybersecurity is about protecting systems, networks, programs and data from digital attacks. The goal is to ensure confidentiality, integrity and availability of information.

- Common threats include malware, phishing, man-in-the-middle attacks, denial-of-service attacks, SQL injection, and zero-day exploits. It's crucial to learn about different attack vectors.

- Essential skills include networking fundamentals, operating systems knowledge, an understanding of common cybersecurity tools, basic programming and scripting abilities, and strong problem solving.

- Certifications like CompTIA Security+, CEH, and CISSP are valuable for demonstrating knowledge and opening up job opportunities. But hands-on experience is most important.

- Setting up a home lab with virtual machines to practice hacking techniques legally and ethically is a great way to build skills. Platforms like HackTheBox and VulnHub have sample environments to practice on.

- Staying on top of the latest cybersecurity news, threats, and technologies is important in this fast-moving field. Follow industry blogs, podcasts, and Twitter accounts to keep learning.

- Find a mentor, attend local security meetups, participate in CTF (Capture The Flag) competitions, and contribute to open source security projects to immerse yourself in the community.

The most important things are to always be learning, thinking adversarially, and applying security fundamentals to real-world scenarios. With persistence and dedication to continual skill building, you can work towards a rewarding career helping defend against cyber threats.
[1]+  Done                    yt --transcript https://www.youtube.com/watch?v=8MIIeIa25tE
[olli@tower extract_wisdom]$ pt https://www.youtube.com/watch?v=8MIIeIa25tE&t=13s | fabric --pattern extract_wisdom --text '. ' --output 'claudeOpusOutput.md'
[1] 98902

*prints the whole transcript*

I apologize, but you have not provided any input for me to analyze and extract information from. Please provide the text content you would like me to process, and I will happily generate the requested output sections based on that input. Let me know if you have any other questions!
[1]+  Done                    yt --transcript https://www.youtube.com/watch?v=8MIIeIa25tE