Skip to content

llm factory update#76

Merged
yisz merged 1 commit intomainfrom
fix/llm-factory
Sep 2, 2024
Merged

llm factory update#76
yisz merged 1 commit intomainfrom
fix/llm-factory

Conversation

@yisz
Copy link
Contributor

@yisz yisz commented Sep 2, 2024

Updated default eval model to gpt-4o-mini
Updated json method


🚀 This description was created by Ellipsis for commit e0d0a4d

Summary:

Updated continuous_eval/llm_factory.py to set gpt-4o-mini as default model, added JSON parsing method, and increased retry attempts for LLM responses.

Key points:

  • Updated DefaultLLM to use gpt-4o-mini as the default model in continuous_eval/llm_factory.py.
  • Added json method to LLMInterface and implemented it in LLMFactory to parse JSON from LLM output.
  • Increased retry attempts in LLMFactory._llm_response from 15 to 50.
  • Removed max_tokens parameter from LLMInterface.run method signature.
  • Adjusted CohereClient.generate call to use a fixed max_tokens value of 1024.

Generated with ❤️ by ellipsis.dev

@yisz yisz merged commit eb8384e into main Sep 2, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Reviewed everything up to e0d0a4d in 24 seconds

More details
  • Looked at 78 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. continuous_eval/llm_factory.py:241
  • Draft comment:
    Backticks are used in strip method, which is incorrect. Use regular quotes instead.
            json_output = llm_output.strip("

").strip(" ").replace("json", "")

- **Reason this comment was not posted:** 
Marked as duplicate.

</details>


Workflow ID: <workflowid>`wflow_lm2kNa2WcSNelVFV`</workflowid>

</details>


----
**Want Ellipsis to fix these issues?** Tag `@ellipsis-dev` in a comment. You can customize Ellipsis with :+1: / :-1: [feedback](https://docs.ellipsis.dev/review), review rules, user-specific overrides, `quiet` mode, and [more](https://docs.ellipsis.dev/config).

llm_output = self.run(prompt, temperature, max_tokens=max_tokens)
if "{" in llm_output:
first_bracket = llm_output.index("{")
json_output = llm_output[first_bracket:].strip("```").strip(" ")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backticks are used in strip method, which is incorrect. Use regular quotes instead.

Suggested change
json_output = llm_output[first_bracket:].strip("```").strip(" ")
json_output = llm_output[first_bracket:].strip("

").strip(" ")

elif COHERE_AVAILABLE and isinstance(self.client, CohereClient):
prompt = f"{prompt['system_prompt']}\n{prompt['user_prompt']}"
response = self.client.generate(model="command", prompt=prompt, temperature=temperature, max_tokens=max_tokens) # type: ignore
response = self.client.generate(model="command", prompt=prompt, temperature=temperature, max_tokens=1024) # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The max_tokens parameter is hardcoded to 1024. Consider using the max_tokens argument instead.

Suggested change
response = self.client.generate(model="command", prompt=prompt, temperature=temperature, max_tokens=1024) # type: ignore
response = self.client.generate(model="command", prompt=prompt, temperature=temperature, max_tokens=max_tokens) # type: ignore

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

Successfully merging this pull request may close these issues.

1 participant