Skip to content

Commit

Permalink
move to provider
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBKang committed Oct 29, 2024
1 parent ec5554c commit e35091c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/github_actions/providers/gemini_15_pro.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class GeminiInternalServiceError < StandardError; end

class Gemini15Pro
def self.call(prompt:, output_adapter:)
prompt.gsub!(/```(\w+)?\n/, '%%%\1\n').gsub!(/\n```/, "\n%%%")
response = HTTParty.post(
"https://generativelanguage.googleapis.com/v1beta/models/#{Sublayer.configuration.ai_model}:generateContent?key=#{ENV['GEMINI_API_KEY']}",
body: {
Expand Down Expand Up @@ -39,7 +40,7 @@ def self.call(prompt:, output_adapter:)

output = response.dig("candidates", 0, "content", "parts", 0, "text")

parsed_output = JSON.parse(output)[output_adapter.name]
parsed_output = JSON.parse(output)[output_adapter.name].gsub!(/%%%(\w+)?\n/, '```\1\n').gsub!(/\n%%%/, "\n```")
end

def self.system_prompt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/github_actions/update_docs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def with_retry(max_attempts = 5)
code_context = GetContextAction.new(path: code_repo_path).call
doc_context = GetContextAction.new(path: doc_repo_path).call

doc_context.gsub!(/```(\w+)?\n/, '%%%\1\n').gsub!(/\n```/, "\n%%%")
doc_context

puts "code context is #{code_context.size} long"
puts "doc context is #{doc_context.size} long"
Expand Down Expand Up @@ -86,7 +86,7 @@ def with_retry(max_attempts = 5)
suggestions: suggestions,
doc_context: doc_context,
context_ignore_list: context_ignore_list
).generate.gsub!(/%%%(\w+)?\n/, '```\1\n').gsub!(/\n%%%/, "\n```")
).generate
end
end

Expand Down

0 comments on commit e35091c

Please sign in to comment.