Skip to content

Commit

Permalink
chore(agents-api): Format/Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
HamadaSalhab committed Feb 26, 2025
1 parent 7fc33c7 commit 125adcb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
16 changes: 8 additions & 8 deletions agents-api/agents_api/activities/humanization_utils.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import json
import random
import time

import requests
from deep_translator import GoogleTranslator
from langchain_text_splitters import MarkdownHeaderTextSplitter
from litellm import completion

from ..env import (
copyleaks_api_key,
litellm_url,
sapling_api_key,
copyleaks_api_key,
)
import json
import random
import time

# Initialize humanization as a dictionary to hold various properties
HUMANIZATION = {
Expand Down Expand Up @@ -270,16 +272,14 @@ def replace_with_homoglyphs(text, max_replacements=2):
count = random.randrange(0, max_replacements)
if count == 0:
continue

# Get random positions for replacements
positions = random.sample(range(text_len), min(count, text_len))
for pos in positions:
if text_chars[pos] == original:
text_chars[pos] = homoglyph

text = ''.join(text_chars)

return text
return "".join(text_chars)


def insert_em_dash(word: str, probability: float = 0.1, min_length: int = 7) -> str:
Expand Down
1 change: 0 additions & 1 deletion agents-api/agents_api/activities/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from ..autogen.openapi_model import SystemDef
from ..common.nlp import nlp
from ..common.utils import yaml

from .humanization_utils import process_paragraph, split_with_langchain

# Security limits
Expand Down

0 comments on commit 125adcb

Please # to comment.