Skip to content

Commit

Permalink
chore: explicit utf-8 for read_text
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Dec 14, 2024
1 parent 1bf2299 commit 51730ab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/llmling/config/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def load_mapping(self) -> ConfigMapping:
if not self.config_file.exists():
return ConfigMapping(configs={}, active=None)
try:
text = self.config_file.read_text()
text = self.config_file.read_text("utf-8")
data = json.loads(text)
active = data.get("active")
configs = data.get("configs", {})
Expand Down
4 changes: 2 additions & 2 deletions src/llmling/prompts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class FilePrompt(BasePrompt):
@property
def messages(self) -> list[PromptMessage]:
"""Get messages from file content."""
content = upath.UPath(self.path).read_text()
content = upath.UPath(self.path).read_text("utf-8")

match self.fmt:
case "text":
Expand Down Expand Up @@ -381,7 +381,7 @@ async def format(
if arg.name not in args and not arg.required:
args[arg.name] = arg.default if arg.default is not None else ""

content = upath.UPath(self.path).read_text()
content = upath.UPath(self.path).read_text("utf-8")

if self.fmt == "jinja2":
# Use jinja2 for template formatting
Expand Down
2 changes: 1 addition & 1 deletion src/llmling/resources/loaders/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _create_resource(
) -> LoadedResource:
"""Create LoadedResource from file."""
try:
content = path.read_text()
content = path.read_text("utf-8")
description = f"Repository content from {resource.repo_url} ({resource.ref})"
return create_loaded_resource(
content=content,
Expand Down

0 comments on commit 51730ab

Please sign in to comment.