teleren/devto huggingface dataset:
Making your CV talk 🤖 Possible improvements 🚀
Tags: node, systemdesign, webdev, javascript
Published: 2024-06-05 10:34:25

We can always do better! Little (or not so little) pessimist in me also want to say "We can also always do worse!" 

But do not listen to him! Let's see how we might make this better.

### Best code is the one you do not write!

You can actually totally remove Backend service and have client make all the calls, problem is that you will have your API keys exposed and there is no other way to authenticate api calls as of now for Open AI and Eleven Labs.

### Cache 💵 because all cool kids are doing it!

Cache! We are making call to fetch our CMS data on each request, this might not be needed as our data for CV does not change often if at all. This can also save costs because in the example I am using Hygrpah which has a free tier but can eventually reach its free quota.

### Maybe if we use **_please_** word more in our prompt? 🤓 (do not fail to note sarcasm in the quote)

Better prompting, if you explore LlamaIndex there are ways how one can make their promoting yield better and more accurate responses. You can create custom Prompt template, or make have clear instructions about how system should behave.

## Outro 👋
This was a lot, please feel free to look at the code base and ask any question you might have.
I would also welcome any improvements that one is willing to share.

And lastly, if you make all the way, thank you so much I hope you had some fun and learn something in the process.

---

❤️If you would like to stay it touch please feel free to connect❤️

1. [X](https://x.com/mitic_dev)
2. [Linkedin](https://www.linkedin.com/in/nikola-mitic-6a5b11119/)
3. nikola.mitic.dev@gmail.com

---
Making your CV talk 🤖 How to use express JS routes to listen for Web socket API?
Tags: websocket, node, nextjs
Published: 2024-06-05 10:34:20

All you need to do is to open web socket towards web socket api inside Express JS route. `streamAudioAnswer` func is doing exactly that.

Here is the flow:

1. Client request api path
2. Express Js Open web socket connection
3. Express JS sends message to web socket api
4. Web socket api responds
5. Express JS takes response and returns it to the Client


🔗🔗🔗 [For full implementation click here](https://github.com/nmitic/ai-interviewer/blob/49f55956c919b1b5ce2d32bdb97571fd4abf8fe9/src/routes/talk/route.ts)

Example of `streamAudioAnswer` usage.

```
  streamAudioAnswer({
    question: question,
    onChunkReceived: (chunk) => {
      const buffer = Buffer.from(chunk, "base64");
      res.write(buffer);
    },
    onChunkFinal: () => {
      res.end();
    },
    onError: (error) => {
      console.error(`WebSocket Error: ${error}`);
      res.status(500).send(`WebSocket Error: ${error}`);
    },
    onClose: (event) => {
      if (event.wasClean) {
        console.info(
          `Connection closed cleanly, code=${event.code}, reason=${event.reason}`
        );
      } else {
        console.warn("Connection died");
      }
      res.end();
    },
  });
```

Function implementation:
```
export const streamAudioAnswer = ({
  question,
  onChunkReceived,
  onChunkFinal,
  onError,
  onClose,
}: {
  question: string;
  onChunkReceived: (audioChunk: string) => void;
  onChunkFinal: () => void;
  onError: (error: ErrorEvent) => void;
  onClose: (event: CloseEvent) => void;
}) => {
  const voiceId = "IcOKBAbsVAB6WkEg78QO";
  const model = "eleven_turbo_v2";
  const wsUrl = `wss://api.elevenlabs.io/v1/text-to-speech/${voiceId}/stream-input?model_id=${model}`;
  const socket = new WebSocket(wsUrl);

  socket.onopen = async function (_event) {
    console.log("OPEN SOCKET");

    const answerSource = await getAnswerSource();
    const answerChunks = await getAnswerChunks(answerSource, question);

    const bosMessage = {
      text: " ",
      voice_settings: {
        stability: 0.5,
        similarity_boost: 0.5,
      },
      xi_api_key: process.env.ELEVEN_LABS_API_KEY,
    };

    socket.send(JSON.stringify(bosMessage));

    for await (const text of textChunker(answerChunks)) {
      socket.send(JSON.stringify({ text: text, try_trigger_generation: true }));
    }

    const eosMessage = {
      text: "",
    };

    socket.send(JSON.stringify(eosMessage));
  };

  socket.onmessage = function (event) {
    const response = JSON.parse(event.data.toString());

    if (response.audio) {
      onChunkReceived(response.audio);
    } else {
      console.log("No audio data in the response");
    }

    if (response.isFinal) {
      console.log("Audio stream chunks final");
      onChunkFinal();
    }
  };

  socket.onerror = onError;

  socket.onclose = onClose;
};
```

---

❤️If you would like to stay it touch please feel free to connect❤️

1. [X](https://x.com/mitic_dev)
2. [Linkedin](https://www.linkedin.com/in/nikola-mitic-6a5b11119/)
3. nikola.mitic.dev@gmail.com

---
Digital Shield: How to Protect Yourself in the World of Information Threats
Published: 2024-06-05 09:15:06

Hi all! Quite often I go online and don’t even suspect that danger could be lurking at literally every step. Today I will try to explain to you the basics of information security.

Information security today plays a huge role in the life of every person. After all, we store a lot of personal information on the Internet: from financial data to personal photos. And it can become the target of attacks from cybercriminals who are ready to use this information to harm us.

In order to protect yourself and your data, you must follow a few simple but very important rules. First, use strong passwords to access your online accounts. Remember that "123456" or "qwerty" are not secure passwords!

Secondly, pay attention to the addresses of the sites you go to. Check SSL certificates to make sure you're on a secure site and not a fake one designed to steal your data.

Also keep an eye on software updates on your devices. Often, developers release patches to fix discovered vulnerabilities in the system, and it is necessary to install them in order to be protected from new types of attacks.
It is also important to remember to back up your data regularly. Back up your information so that in the event of loss or a cyber attack, you can quickly restore your data. This will give you an additional level of protection and confidence in the safety of your valuable files and documents.

Don't forget to use antivirus software and firewalls. These tools will help protect your devices from malware and hacker attacks. Update your antivirus software regularly so it can detect and block new threats that appear online.

Educating yourself and your loved ones about cybersecurity is also important. Communicate with children and older relatives about what information should be avoided online, what threats can lurk on the Internet, and how to properly respond to suspicious situations. This will help not only you, but also those around you to be more secure online.

Remember that information security is an ongoing process that requires attention. Follow best internet security practices and you can reduce your risk of becoming a victim of cybercrime. Do not neglect this issue, because your security and confidentiality of information should remain a priority.

And of course, do not share personal information with suspicious people on the Internet. Do not respond to suspicious emails or follow suspicious links - this may lead to the theft of your data or infection of your device with viruses.

Information security is an integral part of our digital life. Keep this in mind and follow these simple rules to protect yourself and your data from cyber threats. Don't ignore security issues - your personal information is worth much more than it seems at first glance.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21to4ine40t7kw0x7iqa.png)
Making your CV talk 🤖 How to combine Open AI text stream response with Eleven Lab Web socket streaming in TypeScript?
Tags: elevenlabs, openai, typescript
Published: 2024-06-05 10:34:15

Let's briefly refer back to this part of our system design.

![Eleven Labs web socket api with open AI system design](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4a6xfcqbs7j9dmjqtrdk.png)

We have three parts:

1. Fetch Relevant CMS data
2. Fetch stream from Open AI
3. Feed Web socket audio stream api with text stream from Open AI

Eleven Labs uses web socket api to enable for audio stream, open AI uses rest api to return text stream.

What is important here to achieve is that we do not want to wait for the open AI response before we can start streaming audio from eleven labs.

> This means we need a way to send first chunk of Open AI stream as soon as possible to eleven labs.
 
But we have a problem, Open AI or any other LLM api (Groq as well) returns chunks which do not represent any meaningful words which eleven labs requires in order to work as intended.

This means that we need to buffer chunks into words from Open AI and only when we have our first word buffered we send a message to web socket of Eleven Labs and start streaming audio.

For this purpose I wrote `textChunker` which is TS version of Python example Eleven Labs has in their docs. 🔗🔗🔗 [Click here to see Python version ](https://elevenlabs.io/docs/api-reference/websockets#example-voice-streaming-using-elevenlabs-and-openai)

🔗🔗🔗 [Click here for TextChunker code]( https://github.com/nmitic/ai-interviewer/blob/43935b78ad06f6c459908a675d9cf743bfd8396f/src/routes/talk/stream.ts#L30-L68)

Example of Text Chunker usage.

```
  socket.onopen = async function (_event) {
    console.log("OPEN SOCKET");

    const answerSource = await getAnswerSource();
    const answerChunks = await getAnswerChunks(answerSource, question);

    const bosMessage = {
      text: " ",
      voice_settings: {
        stability: 0.5,
        similarity_boost: 0.5,
      },
      xi_api_key: process.env.ELEVEN_LABS_API_KEY,
    };

    socket.send(JSON.stringify(bosMessage));

    for await (const text of textChunker(answerChunks)) {
      socket.send(JSON.stringify({ text: text, try_trigger_generation: true }));
    }

    const eosMessage = {
      text: "",
    };

    socket.send(JSON.stringify(eosMessage));
  };
```
🔗🔗🔗 [For full implementation of Open AI with Eleven Labs click here](https://github.com/nmitic/ai-interviewer/blob/43935b78ad06f6c459908a675d9cf743bfd8396f/src/routes/talk/stream.ts#L70-L136)

---

❤️If you would like to stay it touch please feel free to connect❤️

1. [X](https://x.com/mitic_dev)
2. [Linkedin](https://www.linkedin.com/in/nikola-mitic-6a5b11119/)
3. nikola.mitic.dev@gmail.com

---
Understanding MS-102 A Beginner's Guide
Published: 2024-06-05 10:34:13

<a href="https://dumpsarena.com/microsoft-dumps/md-102/">MS-102</a> How to use MS-102 exam dumps to achieve certification success?
Utilizing MS-102 exam dumps effectively can significantly increase your chances of success in achieving Microsoft 365 Mobility and Security certification. To maximize the benefits of these dumps, follow the strategies outlined below.

Familiarize yourself with the exam objectives and structure. Exam dumps are most effective when used as a supplementary study tool alongside other resources like textbooks, videos, and practice exams.

Next, identify reputable sources for obtaining MS-102 exam dumps. Trustworthy providers will offer <a href="https://dumpsarena.com/microsoft-dumps/md-102/">MS-102 exam dumps</a>  up-to-date material that closely mirrors actual test questions. Look for recommendations from peers or online forums to find reliable exam dump providers.

Once you have acquired high-quality MS-102 exam dumps, use them consistently throughout your preparation process. Allocate ample time to work through all the practice questions multiple times until you become comfortable answering them accurately and confidently.

Additionally, analyze your performance on each set of practice questions. Identify areas where you struggle or need improvement so that you can dedicate more time to review those specific topics thoroughly before retaking the relevant sections within the exam dump materials.

Incorporate timed testing into your study routine using MS-102 exam dumps. Simulating real test conditions will improve your ability to manage time effectively during actual exams while reducing stress levels on test day by increasing familiarity with question formats and content types commonly found within this certification examination field.


Click here more info>>>>   https://dumpsarena.com/microsoft-dumps/md-102/

. https://chng.it/Y9WY8GxK87

42. https://rentry.co/5mzdf9n2

43. https://velog.io/@shoutheasken/MS-102-Explained-A-Beginners-Handbook-vovw98rn

44. https://penzu.com/p/13d071bc3d69a804

45. https://www.goalissimo.org/forum/viewtopic.php?f=16&t=581291
Making your CV talk 🤖 How to read audio stream on client using Next JS?
Tags: node, nextjs
Published: 2024-06-05 10:34:11

Considering that our backend exposes url which streams audio solution is rather simple, we make use of html Audio element and use the correct path. 


![moving image of audio streaming component](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oq3ix8dnme8giffgunzl.gif)

Nothing about this is Next JS related, this is pure React JS TS solution, so you can use it in your React JS code base as well.

For this purpose I created React component that can be re used.
Code here: https://github.com/nmitic/nikola.mitic.dev/blob/745b103829874d0bb7b19d1668d793b99e23653b/components/InterviewerAITalk/components/AudioAnswer.tsx

```
export const AudioAnswer = ({
  question,
  onAnswerDone,
  onAnswerStart,
}: {
  question: string;
  onAnswerDone: () => void;
  onAnswerStart: () => void;
}) => {
  const demo = process.env.NEXT_PUBLIC_AI_DEMO === "true";

  return (
    <audio autoPlay onPlay={onAnswerStart} onEnded={onAnswerDone}>
      <source
        src={`${process.env.NEXT_PUBLIC_AI_INTERVIEWER_SERVICE}/api/talk?question=${question}&demo=${demo}`}
        type="audio/mp3"
      />
    </audio>
  );
};
```

---

❤️If you would like to stay it touch please feel free to connect❤️

1. [X](https://x.com/mitic_dev)
2. [Linkedin](https://www.linkedin.com/in/nikola-mitic-6a5b11119/)
3. nikola.mitic.dev@gmail.com

---
Making your CV talk 🤖 How to read text stream on client using Next JS?
Tags: node, nextjs
Published: 2024-06-05 10:34:07

I have wrote a function which takes answer and callbacks to which UI can listen to and react as it finds fit.

Nothing about this is Next JS related, this is pure React JS TS solution, so you can use it in your React JS code base as well.

Here are the steps:

1. Make request to fetch stream - code here: https://github.com/nmitic/nikola.mitic.dev/blob/745b103829874d0bb7b19d1668d793b99e23653b/components/InterviewerAI/InterviewerAI.func.ts#L15-L34
2. Get stream reader - code here:https://github.com/nmitic/nikola.mitic.dev/blob/745b103829874d0bb7b19d1668d793b99e23653b/components/InterviewerAI/InterviewerAI.func.ts#L52-L58
3. Iterate over he stream and call a function on each iteration so UI can listen and react to it - code here: https://github.com/nmitic/nikola.mitic.dev/blob/745b103829874d0bb7b19d1668d793b99e23653b/components/InterviewerAI/InterviewerAI.func.ts#L64-L76

Full implementation of `answerQuestionWithStream`:
```
export const answerQuestionWithStream = async ({
  onStreamStart,
  onStream,
  onStreamDone,
  onError,
  question,
}: {
  onStreamStart: () => void;
  onStream: (chunk: string) => void;
  onStreamDone: (answer: string) => void;
  onError: () => void;
  question: string;
}) => {
  try {
    const demo = process.env.NEXT_PUBLIC_AI_DEMO === "true";

    const reader = await getStreamReader(demo, question);

    if (!reader) {
      console.error("Stream reader undefined");

      return;
    }

    const textDecoder = new TextDecoder();

    onStreamStart();

    // Keeps track of streamed answer and will evaluate to full once streaming is done
    let fullDecodedAnswer = "";

    while (true) {
      const { done, value } = await reader.read();
      if (done) {
        break;
      }
      const decodedText = textDecoder.decode(value);

      fullDecodedAnswer = fullDecodedAnswer + decodedText;
      onStream(decodedText);
    }
    onStreamDone(fullDecodedAnswer);
  } catch (error) {
    console.error(error);
    // indicated to the user the error has happen
    onError();
  }
};

---

❤️If you would like to stay it touch please feel free to connect❤️

1. [X](https://x.com/mitic_dev)
2. [Linkedin](https://www.linkedin.com/in/nikola-mitic-6a5b11119/)
3. nikola.mitic.dev@gmail.com

---
Arbor IT Support: Providing Seamless Solutions for Your Technology Needs
Published: 2024-06-05 10:27:20

At Arbor IT Support, we are committed to delivering excellence in every aspect of our service delivery. Our team comprises highly skilled professionals with extensive experience in the field of information technology, who are dedicated to providing proactive support, innovative solutions, and unparalleled customer service.

Partner with Arbor IT Support today and take your business to new heights with cutting-edge technology solutions tailored to your needs. Whether you're looking to enhance efficiency, improve security, or drive innovation, we have the expertise and resources to help you succeed in today's digital world.

Contact us now to learn more about our services and discover how Arbor IT Support can empower your business for success in the digital age.

https://remedian.co.uk/arbor
Making your CV talk 🤖 How to send audio stream from Express JS?
Tags: audio, node, express
Published: 2024-06-05 10:34:03

For our case this part was easy, as all we need to do is:

1. Get buffered chunk
2. Write to response object

And it looks like this.

```
    onChunkReceived: (chunk) => {
      const buffer = Buffer.from(chunk, "base64");
      res.write(buffer);
    },
```

I will talk more about onChunkReceived method in the next section. Long story short, it it accepts a callback with chunk that come from web socket api. This is implementation details of how to work with Eleven Labs API.

Each time web socket sends an event that chunk is received it will write to response object and return chunk to the client.

This is the simplest way to combine express js with web socket api. 

---

❤️If you would like to stay it touch please feel free to connect❤️

1. [X](https://x.com/mitic_dev)
2. [Linkedin](https://www.linkedin.com/in/nikola-mitic-6a5b11119/)
3. nikola.mitic.dev@gmail.com

---
Making your CV talk 🤖 How to send text stream from Express JS?
Tags: express, streaming, node
Published: 2024-06-05 10:33:59

Here we have stream coming from Open AI. We need to read chunks and stream it back as soon as chunk is ready. In a way we are streaming a stream.

One can make a case that this is not needed, however I am doing this in order to hide API keys for Groq, Open AI and Hygraph headless CMS. As I do not want them to be exposed to the client.

Route handler for `/api/ask` route:

```
export const route = async (req: Request, res: Response) => {
  const { question } = req.query;

  if (typeof question !== "string") {
    return res
      .status(400)
      .send(`Client error: question query not type of string`);
  }
  try {
    const answerSource = await getAnswerSource();
    
    const answerChunks = await getAnswerChunks(answerSource, question, false);
    
    for await (const chunk of answerChunks) {
      console.log(chunk.response);
      if (req.closed) {
        res.end();
        return;
      }
      res.write(chunk.response);
    }
    
  } catch (error) {
    return res.status(500).send(`Server error: ${error}`);
  }

  res.end();
};
```

Let's dissect it a bit:

```
const answerSource = await getAnswerSource();
```
Here we are getting all our relevant data, CV, blog posts plus any pages you would like your AI clone to be aware of.

```
const answerChunks = await getAnswerChunks(answerSource, question, false);
```

Here we are feeding out LLM with our custom data and question. And getting stream back as a response.

```
    for await (const chunk of answerChunks) {
      console.log(chunk.response);
      if (req.closed) {
        res.end();
        return;
      }
      res.write(chunk.response);
    }
```

Here we simply iterate over chunks and make sure we close connection in case client do so as well.

And our streamception is done! 🎏

---

❤️If you would like to stay it touch please feel free to connect❤️

1. [X](https://x.com/mitic_dev)
2. [Linkedin](https://www.linkedin.com/in/nikola-mitic-6a5b11119/)
3. nikola.mitic.dev@gmail.com

---
What Are The Uses Of Custom Drawstring Pouches?
Published: 2024-06-05 10:29:25


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bng4k461nd9tljh36nmr.jpg)

Are you looking for eco-friendly and sustainable solutions? **A cotton drawstring pouch** is one of the best options, and you can use it in many ways. These pouches are versatile and can be used in not just one way but many other ways. First of all, you need to know what your preference is and why you want to use it. 

Custom Drawstring pouches offered by Bagwalas are available in many varieties and colors. You will have many options from which you can choose according to your choice, like plain cotton pouches, designer pouches, Tye-dye pouches, and satin pouches. This is the best solution for packaging and storage.
**The drawstring cotton bags offered by us have several common uses, which are as follows:**
**For promotional purposes**: These pouches are used for promotional purposes by small and big businesses as it is necessary to promote their brand. These pouches are customizable, so you can customize them with your company name and brand logo.
 
These also serve as the best promotional giveaways for any events or marketing campaigns.

**Storing and packaging**: Drawstring pouches are the best solution when it comes to storing jewelry, as they can be used very well. You can keep your precious jewelry, herbal items, and cosmetics in it. Apart from storing, it is also the best option for gift packaging because you can use the pouches to gift jewelry at weddings or any function. These bags help you provide a good presentation and luxurious packaging.

**Travel Organizers**:  [Personalized drawstring pouches](url) also work as travel organizers since they are portable and can easily be carried while traveling. You can use these to carry essential items while traveling without any risk.

**Retail Packaging**: These pouches are ideal as retail packaging for small and large businesses. Often, businesses require such bags and packaging as they increase the chances of their business growth and brand promotion.

**For Ayurveda and cosmetics**: These pouches are the best option for storing Ayurveda and cosmetics items. If you have an Ayurveda and cosmetics store, then you can use these bags to keep items and give them to your customers. You can also customize your brand's logo, which will help you identify your product.

**Conclusion:**
As you might already know, Bagwalas are helpful in providing you with [small drawstring pouches](url), which are very popular for their versatility, eco-friendliness, portability, customization, and durability. You can use these bags in all the ways mentioned above. We provide you with these pouches at discounted rates.